diff options
Diffstat (limited to 'llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h')
| -rw-r--r-- | llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h index a4f1c55ca39..615a7280a3a 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h @@ -240,7 +240,6 @@ typedef StringMap<SymbolTableEntry> RTDyldSymbolTable; class RuntimeDyldImpl { friend class RuntimeDyld::LoadedObjectInfo; - friend class RuntimeDyldCheckerImpl; protected: static const unsigned AbsoluteSymbolSection = ~0U; @@ -250,9 +249,6 @@ protected: // The symbol resolver to use for external symbols. JITSymbolResolver &Resolver; - // Attached RuntimeDyldChecker instance. Null if no instance attached. - RuntimeDyldCheckerImpl *Checker; - // A list of all sections emitted by the dynamic linker. These sections are // referenced in the code by means of their index in this list - SectionID. typedef SmallVector<SectionEntry, 64> SectionList; @@ -312,20 +308,16 @@ protected: // the end of the list while the list is being processed. sys::Mutex lock; + using NotifyStubEmittedFunction = + RuntimeDyld::NotifyStubEmittedFunction; + NotifyStubEmittedFunction NotifyStubEmitted; + virtual unsigned getMaxStubSize() = 0; virtual unsigned getStubAlignment() = 0; bool HasError; std::string ErrorStr; - uint64_t getSectionLoadAddress(unsigned SectionID) const { - return Sections[SectionID].getLoadAddress(); - } - - uint8_t *getSectionAddress(unsigned SectionID) const { - return Sections[SectionID].getAddress(); - } - void writeInt16BE(uint8_t *Addr, uint16_t Value) { if (IsTargetLittleEndian) sys::swapByteOrder(Value); @@ -471,7 +463,7 @@ protected: public: RuntimeDyldImpl(RuntimeDyld::MemoryManager &MemMgr, JITSymbolResolver &Resolver) - : MemMgr(MemMgr), Resolver(Resolver), Checker(nullptr), + : MemMgr(MemMgr), Resolver(Resolver), ProcessAllSections(false), HasError(false) { } @@ -481,13 +473,22 @@ public: this->ProcessAllSections = ProcessAllSections; } - void setRuntimeDyldChecker(RuntimeDyldCheckerImpl *Checker) { - this->Checker = Checker; - } - virtual std::unique_ptr<RuntimeDyld::LoadedObjectInfo> loadObject(const object::ObjectFile &Obj) = 0; + uint64_t getSectionLoadAddress(unsigned SectionID) const { + return Sections[SectionID].getLoadAddress(); + } + + uint8_t *getSectionAddress(unsigned SectionID) const { + return Sections[SectionID].getAddress(); + } + + StringRef getSectionContent(unsigned SectionID) const { + return StringRef(reinterpret_cast<char*>(Sections[SectionID].getAddress()), + Sections[SectionID].getSize()); + } + uint8_t* getSymbolLocalAddress(StringRef Name) const { // FIXME: Just look up as a function for now. Overly simple of course. // Work in progress. @@ -501,6 +502,13 @@ public: return getSectionAddress(SymInfo.getSectionID()) + SymInfo.getOffset(); } + unsigned getSymbolSectionID(StringRef Name) const { + auto GSTItr = GlobalSymbolTable.find(Name); + if (GSTItr == GlobalSymbolTable.end()) + return ~0U; + return GSTItr->second.getSectionID(); + } + JITEvaluatedSymbol getSymbol(StringRef Name) const { // FIXME: Just look up as a function for now. Overly simple of course. // Work in progress. @@ -559,6 +567,10 @@ public: virtual bool isCompatibleFile(const ObjectFile &Obj) const = 0; + void setNotifyStubEmitted(NotifyStubEmittedFunction NotifyStubEmitted) { + this->NotifyStubEmitted = std::move(NotifyStubEmitted); + } + virtual void registerEHFrames(); void deregisterEHFrames(); |

