13 #ifndef LLVM_EXECUTIONENGINE_RUNTIMEDYLD_H 14 #define LLVM_EXECUTIONENGINE_RUNTIMEDYLD_H 30 #include <system_error> 50 std::error_code convertToErrorCode()
const override;
62 void reassignSectionAddress(
unsigned SectionID, uint64_t Addr);
77 : RTDyld(RTDyld), ObjSecToIDMap(
std::move(ObjSecToIDMap)) {}
86 virtual void anchor();
104 virtual uint8_t *allocateCodeSection(uintptr_t
Size,
unsigned Alignment,
111 virtual uint8_t *allocateDataSection(uintptr_t
Size,
unsigned Alignment,
114 bool IsReadOnly) = 0;
125 uintptr_t RODataSize,
127 uintptr_t RWDataSize,
139 virtual void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr,
141 virtual void deregisterEHFrames() = 0;
152 virtual bool finalizeMemory(std::string *ErrMsg =
nullptr) = 0;
169 virtual void anchor();
171 bool FinalizationLocked =
false;
201 std::map<StringRef, JITEvaluatedSymbol> getSymbolTable()
const;
204 void resolveRelocations();
210 void mapSectionAddress(
const void *LocalAddress, uint64_t TargetAddress);
213 StringRef getSectionContent(
unsigned SectionID)
const;
217 uint64_t getSectionLoadAddress(
unsigned SectionID)
const;
222 this->NotifyStubEmitted = std::move(NotifyStubEmitted);
230 void registerEHFrames();
232 void deregisterEHFrames();
246 assert(!Dyld &&
"setProcessAllSections must be called before loadObject.");
247 this->ProcessAllSections = ProcessAllSections;
267 void finalizeWithMemoryManagerLocking();
272 std::unique_ptr<MemoryBuffer> UnderlyingBuffer,
274 bool ProcessAllSections,
276 std::map<StringRef, JITEvaluatedSymbol>)>
282 std::unique_ptr<RuntimeDyldImpl> Dyld;
285 bool ProcessAllSections;
298 bool ProcessAllSections,
300 std::map<StringRef, JITEvaluatedSymbol>)>
306 #endif // LLVM_EXECUTIONENGINE_RUNTIMEDYLD_H virtual void reserveAllocationSpace(uintptr_t CodeSize, uint32_t CodeAlign, uintptr_t RODataSize, uint32_t RODataAlign, uintptr_t RWDataSize, uint32_t RWDataAlign)
Inform the memory manager about the total amount of memory required to allocate all sections to be lo...
Information about the loaded object.
This class represents lattice values for constants.
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
void jitLinkForORC(object::ObjectFile &Obj, std::unique_ptr< MemoryBuffer > UnderlyingBuffer, RuntimeDyld::MemoryManager &MemMgr, JITSymbolResolver &Resolver, bool ProcessAllSections, unique_function< Error(std::unique_ptr< RuntimeDyld::LoadedObjectInfo >, std::map< StringRef, JITEvaluatedSymbol >)> OnLoaded, unique_function< void(Error)> OnEmitted)
This class is the base class for all object file types.
static unsigned getSymbolSectionID(const ObjectFile &O, SymbolRef Sym)
void setNotifyStubEmitted(NotifyStubEmittedFunction NotifyStubEmitted)
Set the NotifyStubEmitted callback.
constexpr char SymbolName[]
Key for Kernel::Metadata::mSymbolName.
virtual bool needsToReserveAllocationSpace()
Override to return true to enable the reserveAllocationSpace callback.
std::function< void(StringRef FileName, StringRef SectionName, StringRef SymbolName, unsigned SectionID, uint32_t StubOffset)> NotifyStubEmittedFunction
RuntimeDyldError(std::string ErrMsg)
void setProcessAllSections(bool ProcessAllSections)
By default, only sections that are "required for execution" are passed to the RTDyldMemoryManager, and other sections are discarded.
virtual void notifyObjectLoaded(RuntimeDyld &RTDyld, const object::ObjectFile &Obj)
This method is called after an object has been loaded into memory but before relocations are applied ...
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
Symbol resolution interface.
ObjSectionToIDMap ObjSecToIDMap
An inferface for inquiring the load address of a loaded object file to be used by the DIContext imple...
Represents a symbol that has been evaluated to an address already.
Base class for user error types.
Base class for errors originating in RuntimeDyld, e.g.
const std::string & getErrorMessage() const
std::map< object::SectionRef, unsigned > ObjSectionToIDMap
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Lightweight error class with error context and mandatory checking.
This class implements an extremely fast bulk output stream that can only output to a stream...
print Print MemDeps of function
StringRef - Represent a constant reference to a string, i.e.
LoadedObjectInfo(RuntimeDyldImpl &RTDyld, ObjSectionToIDMap ObjSecToIDMap)
This is a value type class that represents a single section in the list of sections in the object fil...