From 020f4e861a9a32059f76377e787703c92ba55a98 Mon Sep 17 00:00:00 2001 From: Jim Grosbach Date: Mon, 16 Jan 2012 23:50:55 +0000 Subject: ExecutionEngine interface to re-map addresses for engines that support it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148264 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ExecutionEngine/ExecutionEngine.h | 8 ++++++++ include/llvm/ExecutionEngine/RuntimeDyld.h | 14 +++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'include/llvm/ExecutionEngine') diff --git a/include/llvm/ExecutionEngine/ExecutionEngine.h b/include/llvm/ExecutionEngine/ExecutionEngine.h index 9f77ebe..62adb55 100644 --- a/include/llvm/ExecutionEngine/ExecutionEngine.h +++ b/include/llvm/ExecutionEngine/ExecutionEngine.h @@ -239,6 +239,14 @@ public: virtual void *getPointerToNamedFunction(const std::string &Name, bool AbortOnFailure = true) = 0; + /// mapSectionAddress - map a section to its target address space value. + /// Map the address of a JIT section as returned from the memory manager + /// to the address in the target process as the running code will see it. + /// This is the address which will be used for relocation resolution. + virtual void mapSectionAddress(void *LocalAddress, uint64_t TargetAddress) { + assert(0 && "Re-mapping of section addresses not supported with this EE!"); + } + /// runStaticConstructorsDestructors - This method is used to execute all of /// the static constructors or destructors for a program. /// diff --git a/include/llvm/ExecutionEngine/RuntimeDyld.h b/include/llvm/ExecutionEngine/RuntimeDyld.h index d937ab4..8ad316b 100644 --- a/include/llvm/ExecutionEngine/RuntimeDyld.h +++ b/include/llvm/ExecutionEngine/RuntimeDyld.h @@ -64,6 +64,10 @@ class RuntimeDyld { // interface. RuntimeDyldImpl *Dyld; RTDyldMemoryManager *MM; +protected: + // Change the address associated with a section when resolving relocations. + // Any relocations already associated with the symbol will be re-resolved. + void reassignSectionAddress(unsigned SectionID, uint64_t Addr); public: RuntimeDyld(RTDyldMemoryManager*); ~RuntimeDyld(); @@ -75,9 +79,13 @@ public: void *getSymbolAddress(StringRef Name); // Resolve the relocations for all symbols we currently know about. void resolveRelocations(); - // Change the address associated with a section when resolving relocations. - // Any relocations already associated with the symbol will be re-resolved. - void reassignSectionAddress(unsigned SectionID, uint64_t Addr); + + /// mapSectionAddress - map a section to its target address space value. + /// Map the address of a JIT section as returned from the memory manager + /// to the address in the target process as the running code will see it. + /// This is the address which will be used for relocation resolution. + void mapSectionAddress(void *LocalAddress, uint64_t TargetAddress); + StringRef getErrorString(); }; -- cgit v1.1