25#define DEBUG_TYPE "dyld"
29class LoadedCOFFObjectInfo final
31 RuntimeDyld::LoadedObjectInfo> {
39 getObjectForDebug(
const ObjectFile &Obj)
const override {
47std::unique_ptr<RuntimeDyldCOFF>
64std::unique_ptr<RuntimeDyld::LoadedObjectInfo>
67 return std::make_unique<LoadedCOFFObjectInfo>(*
this, *ObjSectionToIDOrErr);
83 bool SetSectionIDMinus1) {
86 "Not a DLLImport symbol?");
89 auto I = Stubs.find(Reloc);
90 if (
I != Stubs.end()) {
97 auto EntryOffset =
alignTo(Sec.getStubOffset(), PointerSize);
98 Sec.advanceStubOffset(EntryOffset + PointerSize - Sec.getStubOffset());
99 Stubs[Reloc] = EntryOffset;
104 if (SetSectionIDMinus1)
109 dbgs() <<
"Creating entry at "
110 <<
formatv(
"{0:x16} + {1:x8} ( {2:x16} )", Sec.getLoadAddress(),
111 EntryOffset, Sec.getLoadAddress() + EntryOffset)
125 if (!TargetNameOrErr)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Tagged union holding either a T or a Error.
Symbol resolution interface.
RelocationEntry - used to represent relocations internally in the dynamic linker.
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
uint64_t getSymbolOffset(const SymbolRef &Sym)
static constexpr StringRef getImportSymbolPrefix()
std::unique_ptr< RuntimeDyld::LoadedObjectInfo > loadObject(const object::ObjectFile &Obj) override
static std::unique_ptr< RuntimeDyldCOFF > create(Triple::ArchType Arch, RuntimeDyld::MemoryManager &MemMgr, JITSymbolResolver &Resolver)
bool relocationNeedsDLLImportStub(const RelocationRef &R) const override
bool isCompatibleFile(const object::ObjectFile &Obj) const override
uint64_t getDLLImportOffset(unsigned SectionID, StubMap &Stubs, StringRef Name, bool SetSectionIDMinus1=false)
std::map< RelocationValueRef, uintptr_t > StubMap
void addRelocationForSymbol(const RelocationEntry &RE, StringRef SymbolName)
RuntimeDyld::MemoryManager & MemMgr
Expected< ObjSectionToIDMap > loadObjectImpl(const object::ObjectFile &Obj)
std::map< object::SectionRef, unsigned > ObjSectionToIDMap
StringRef - Represent a constant reference to a string, i.e.
This class is the base class for all object file types.
This is a value type class that represents a single relocation in the list of relocations in the obje...
This is a value type class that represents a single symbol in the list of symbols in the object file.
A raw_ostream that writes to an std::string.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
void logAllUnhandledErrors(Error E, raw_ostream &OS, Twine ErrorBanner={})
Log all errors (if any) in E to OS.
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.
unsigned Log2_64(uint64_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
LoadedObjectInfoHelper()=default