diff options
author | Jim Grosbach <grosbach@apple.com> | 2012-01-16 22:26:39 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2012-01-16 22:26:39 +0000 |
commit | 61425c0a7f4e3608a85f7bbf254cd052a15b7446 (patch) | |
tree | 54cde5d3f935fec86f9d6bd60ce2ccbea3376cf7 /tools | |
parent | 27bf56056bed53d55d7ef0fd67d1851fa860b4f2 (diff) | |
download | external_llvm-61425c0a7f4e3608a85f7bbf254cd052a15b7446.zip external_llvm-61425c0a7f4e3608a85f7bbf254cd052a15b7446.tar.gz external_llvm-61425c0a7f4e3608a85f7bbf254cd052a15b7446.tar.bz2 |
MCJIT support for non-function sections.
Move to a by-section allocation and relocation scheme. This allows
better support for sections which do not contain externally visible
symbols.
Flesh out the relocation address vs. local storage address separation a
bit more as well. Remote process JITs use this to tell the relocation
resolution code where the code will live when it executes.
The startFunctionBody/endFunctionBody interfaces to the JIT and the
memory manager are deprecated. They'll stick around for as long as the
old JIT does, but the MCJIT doesn't use them anymore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148258 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/llvm-rtdyld/llvm-rtdyld.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/llvm-rtdyld/llvm-rtdyld.cpp b/tools/llvm-rtdyld/llvm-rtdyld.cpp index 0065880..9fec7c4 100644 --- a/tools/llvm-rtdyld/llvm-rtdyld.cpp +++ b/tools/llvm-rtdyld/llvm-rtdyld.cpp @@ -51,12 +51,30 @@ EntryPoint("entry", class TrivialMemoryManager : public RTDyldMemoryManager { public: SmallVector<sys::MemoryBlock, 16> FunctionMemory; + SmallVector<sys::MemoryBlock, 16> DataMemory; + + uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment, + unsigned SectionID); + uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment, + unsigned SectionID); uint8_t *startFunctionBody(const char *Name, uintptr_t &Size); void endFunctionBody(const char *Name, uint8_t *FunctionStart, uint8_t *FunctionEnd); }; +uint8_t *TrivialMemoryManager::allocateCodeSection(uintptr_t Size, + unsigned Alignment, + unsigned SectionID) { + return (uint8_t*)sys::Memory::AllocateRWX(Size, 0, 0).base(); +} + +uint8_t *TrivialMemoryManager::allocateDataSection(uintptr_t Size, + unsigned Alignment, + unsigned SectionID) { + return (uint8_t*)sys::Memory::AllocateRWX(Size, 0, 0).base(); +} + uint8_t *TrivialMemoryManager::startFunctionBody(const char *Name, uintptr_t &Size) { return (uint8_t*)sys::Memory::AllocateRWX(Size, 0, 0).base(); |