RuntimeDyld should use the memory manager API.

Start teaching the runtime Dyld interface to use the memory manager API
for allocating space. Rather than mapping directly into the MachO object,
we extract the payload for each object and copy it into a dedicated buffer
allocated via the memory manager. For now, just do Segment64, so this works
on x86_64, but not yet on ARM.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128973 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jim Grosbach
2011-04-06 01:11:05 +00:00
parent 2009c49a0b
commit c41ab789a0
4 changed files with 96 additions and 99 deletions

View File

@@ -44,14 +44,14 @@ Action(cl::desc("Action to perform:"),
// support library allocation routines directly.
class TrivialMemoryManager : public RTDyldMemoryManager {
public:
uint64_t startFunctionBody(const char *Name, uintptr_t &Size);
void endFunctionBody(const char *Name, uint64_t FunctionStart,
uint64_t FunctionEnd) {}
uint8_t *startFunctionBody(const char *Name, uintptr_t &Size);
void endFunctionBody(const char *Name, uint8_t *FunctionStart,
uint8_t *FunctionEnd) {}
};
uint64_t TrivialMemoryManager::startFunctionBody(const char *Name,
uint8_t *TrivialMemoryManager::startFunctionBody(const char *Name,
uintptr_t &Size) {
return (uint64_t)sys::Memory::AllocateRWX(Size, 0, 0).base();
return (uint8_t*)sys::Memory::AllocateRWX(Size, 0, 0).base();
}
static const char *ProgramName;