26#define DEBUG_TYPE "dyld"
30class LoadedCOFFObjectInfo final
32 RuntimeDyld::LoadedObjectInfo> {
40 getObjectForDebug(
const ObjectFile &Obj)
const override {
48std::unique_ptr<RuntimeDyldCOFF>
65std::unique_ptr<RuntimeDyld::LoadedObjectInfo>
68 return std::make_unique<LoadedCOFFObjectInfo>(*
this, *ObjSectionToIDOrErr);
84 bool SetSectionIDMinus1) {
87 "Not a DLLImport symbol?");
90 auto I = Stubs.find(Reloc);
91 if (
I != Stubs.end()) {
98 auto EntryOffset =
alignTo(Sec.getStubOffset(), PointerSize);
99 Sec.advanceStubOffset(EntryOffset + PointerSize - Sec.getStubOffset());
100 Stubs[Reloc] = EntryOffset;
105 if (SetSectionIDMinus1)
110 dbgs() <<
"Creating entry at "
111 <<
formatv(
"{0:x16} + {1:x8} ( {2:x16} )", Sec.getLoadAddress(),
112 EntryOffset, Sec.getLoadAddress() + EntryOffset)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
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 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 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.
auto formatv(const char *Fmt, Ts &&...Vals) -> formatv_object< decltype(std::make_tuple(support::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.
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