From 61425c0a7f4e3608a85f7bbf254cd052a15b7446 Mon Sep 17 00:00:00 2001 From: Jim Grosbach Date: Mon, 16 Jan 2012 22:26:39 +0000 Subject: 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 --- tools/llvm-rtdyld/llvm-rtdyld.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tools/llvm-rtdyld') 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 FunctionMemory; + SmallVector 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(); -- cgit v1.2.3