summaryrefslogtreecommitdiff
path: root/tools/llvm-rtdyld
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2012-01-16 22:26:39 +0000
committerJim Grosbach <grosbach@apple.com>2012-01-16 22:26:39 +0000
commit61425c0a7f4e3608a85f7bbf254cd052a15b7446 (patch)
tree54cde5d3f935fec86f9d6bd60ce2ccbea3376cf7 /tools/llvm-rtdyld
parent27bf56056bed53d55d7ef0fd67d1851fa860b4f2 (diff)
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/llvm-rtdyld')
-rw-r--r--tools/llvm-rtdyld/llvm-rtdyld.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/llvm-rtdyld/llvm-rtdyld.cpp b/tools/llvm-rtdyld/llvm-rtdyld.cpp
index 0065880bcbb..9fec7c464c5 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();