Index: include/llvm/ExecutionEngine/RuntimeDyld.h =================================================================== --- include/llvm/ExecutionEngine/RuntimeDyld.h +++ include/llvm/ExecutionEngine/RuntimeDyld.h @@ -68,6 +68,8 @@ uint64_t getSectionLoadAddress(StringRef Name) const; + uint64_t getSectionLoadAddress(const object::SectionRef &Section) const; + protected: virtual void anchor(); Index: lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp =================================================================== --- lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp +++ lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp @@ -143,9 +143,6 @@ MemMgr.reserveAllocationSpace(CodeSize, DataSizeRO, DataSizeRW); } - // Used sections from the object file - ObjSectionToIDMap LocalSections; - // Common symbols requiring allocation, with their sizes and alignments CommonSymbolList CommonSymbols; @@ -826,6 +823,12 @@ return 0; } +uint64_t RuntimeDyld::LoadedObjectInfo::getSectionLoadAddress( + const SectionRef &Section) const { + unsigned SectionId = RTDyld.LocalSections[Section]; + return RTDyld.Sections[SectionId].LoadAddress; +} + void RuntimeDyld::MemoryManager::anchor() {} void RuntimeDyld::SymbolResolver::anchor() {} Index: lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h =================================================================== --- lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h +++ lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h @@ -208,6 +208,7 @@ // Keep a map of sections from object file to the SectionID which // references it. typedef std::map ObjSectionToIDMap; + ObjSectionToIDMap LocalSections; // A global symbol table for symbols from all loaded modules. RTDyldSymbolTable GlobalSymbolTable;