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
diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h
index bbfef76..59c8636 100644
--- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h
+++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h
@@ -16,6 +16,7 @@
#include "llvm/ExecutionEngine/RuntimeDyld.h"
#include "llvm/Object/MachOObject.h"
+#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/IndexedMap.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/Twine.h"
@@ -45,10 +46,14 @@
// Indexed by SectionID.
SmallVector<sys::MemoryBlock, 32> Sections;
// For each section, the address it will be considered to live at for
- // relocations. The same as the pointer the above memory block for hosted
+ // relocations. The same as the pointer to the above memory block for hosted
// JITs. Indexed by SectionID.
SmallVector<uint64_t, 32> SectionLoadAddress;
+ // Keep a map of starting local address to the SectionID which references it.
+ // Lookup function for when we assign virtual addresses.
+ DenseMap<void *, unsigned> SectionLocalMemToID;
+
// Master symbol table. As modules are loaded and external symbols are
// resolved, their addresses are stored here as a SectionID/Offset pair.
typedef std::pair<unsigned, uint64_t> SymbolLoc;
@@ -90,6 +95,8 @@
virtual void reassignSectionAddress(unsigned SectionID, uint64_t Addr) = 0;
+ void mapSectionAddress(void *LocalAddress, uint64_t TargetAddress);
+
// Is the linker in an error state?
bool hasError() { return HasError; }