Go to the documentation of this file.
26 #define DEBUG_TYPE "dyld"
30 class LoadedCOFFObjectInfo final
32 RuntimeDyld::LoadedObjectInfo> {
40 getObjectForDebug(
const ObjectFile &Obj)
const override {
48 std::unique_ptr<RuntimeDyldCOFF>
55 return std::make_unique<RuntimeDyldCOFFI386>(MemMgr,
Resolver);
57 return std::make_unique<RuntimeDyldCOFFThumb>(MemMgr,
Resolver);
59 return std::make_unique<RuntimeDyldCOFFX86_64>(MemMgr,
Resolver);
61 return std::make_unique<RuntimeDyldCOFFAArch64>(MemMgr,
Resolver);
65 std::unique_ptr<RuntimeDyld::LoadedObjectInfo>
67 if (
auto ObjSectionToIDOrErr = loadObjectImpl(
O)) {
68 return std::make_unique<LoadedCOFFObjectInfo>(*
this, *ObjSectionToIDOrErr);
84 bool SetSectionIDMinus1) {
86 assert(
Name.startswith(getImportSymbolPrefix()) &&
"Not a DLLImport symbol?");
89 auto I = Stubs.find(Reloc);
90 if (
I != Stubs.end()) {
95 assert(SectionID < Sections.size() &&
"SectionID out of range");
96 auto &Sec = Sections[SectionID];
98 Sec.advanceStubOffset(EntryOffset +
PointerSize - Sec.getStubOffset());
99 Stubs[Reloc] = EntryOffset;
104 if (SetSectionIDMinus1)
106 addRelocationForSymbol(RE,
Name.drop_front(getImportSymbolPrefix().
size()));
109 dbgs() <<
"Creating entry at "
110 <<
formatv(
"{0:x16} + {1:x8} ( {2:x16} )", Sec.getLoadAddress(),
111 EntryOffset, Sec.getLoadAddress() + EntryOffset)
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
std::unique_ptr< RuntimeDyld::LoadedObjectInfo > loadObject(const object::ObjectFile &Obj) override
This is an optimization pass for GlobalISel generic memory operations.
Expected< uint64_t > getValue() const
Return the value of the symbol depending on the object this can be an offset or a virtual address.
A raw_ostream that writes to an std::string.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
auto formatv(const char *Fmt, Ts &&... Vals) -> formatv_object< decltype(std::make_tuple(detail::build_format_adapter(std::forward< Ts >(Vals))...))>
unsigned Log2_64(uint64_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
RelocationEntry - used to represent relocations internally in the dynamic linker.
bool isCompatibleFile(const object::ObjectFile &Obj) const override
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
constexpr uint64_t PointerSize
x86_64 pointer size.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
uint64_t getDLLImportOffset(unsigned SectionID, StubMap &Stubs, StringRef Name, bool SetSectionIDMinus1=false)
uint64_t getSymbolOffset(const SymbolRef &Sym)
StringRef - Represent a constant reference to a string, i.e.
This class is the base class for all object file types.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
void logAllUnhandledErrors(Error E, raw_ostream &OS, Twine ErrorBanner={})
Log all errors (if any) in E to OS.
std::map< object::SectionRef, unsigned > ObjSectionToIDMap
Symbol resolution interface.
This is a value type class that represents a single symbol in the list of symbols in the object file.
std::map< RelocationValueRef, uintptr_t > StubMap
static std::unique_ptr< RuntimeDyldCOFF > create(Triple::ArchType Arch, RuntimeDyld::MemoryManager &MemMgr, JITSymbolResolver &Resolver)