diff options
author | Evan Cheng <evan.cheng@apple.com> | 2008-09-18 07:54:21 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2008-09-18 07:54:21 +0000 |
commit | 5cc53c34c366fa8b6e389c7c1751c50c0f64041a (patch) | |
tree | 00effcc2f02134686e78be25d8938c46d4ed3992 /llvm/lib/ExecutionEngine | |
parent | 933b392f657c6abcc6bca68bc14cf77301c6d4cc (diff) | |
download | bcm5719-llvm-5cc53c34c366fa8b6e389c7c1751c50c0f64041a.tar.gz bcm5719-llvm-5cc53c34c366fa8b6e389c7c1751c50c0f64041a.zip |
Preliminary support for systems which require changing JIT memory regions privilege from read / write to read / executable.
llvm-svn: 56303
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r-- | llvm/lib/ExecutionEngine/ExecutionEngine.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp | 4 |
3 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp index 2a7b914ac34..52a69eaea77 100644 --- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp @@ -86,7 +86,8 @@ Function *ExecutionEngine::FindFunctionNamed(const char *FnName) { /// existing data in memory. void ExecutionEngine::addGlobalMapping(const GlobalValue *GV, void *Addr) { MutexGuard locked(lock); - + + DOUT << "Map " << *GV << " to " << Addr << "\n"; void *&CurVal = state.getGlobalAddressMap(locked)[GV]; assert((CurVal == 0 || Addr == 0) && "GlobalMapping already established!"); CurVal = Addr; diff --git a/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp b/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp index 02752a01cdd..4803fdf153d 100644 --- a/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp +++ b/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp @@ -925,6 +925,9 @@ bool JITEmitter::finishFunction(MachineFunction &F) { << Relocations.size() << " relocations\n"; Relocations.clear(); + // Mark code region readable and executable if it's not so already. + sys::Memory::SetRXPrivilege(FnStart, FnEnd-FnStart); + #ifndef NDEBUG { DOUT << std::hex; diff --git a/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp b/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp index d2d5c2f8e0d..804e88df4ca 100644 --- a/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp +++ b/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp @@ -370,7 +370,11 @@ namespace { DefaultJITMemoryManager::DefaultJITMemoryManager() { // Allocate a 16M block of memory for functions. +#if defined(__APPLE__) && defined(__arm__) + sys::MemoryBlock MemBlock = getNewMemoryBlock(4 << 20); +#else sys::MemoryBlock MemBlock = getNewMemoryBlock(16 << 20); +#endif unsigned char *MemBase = static_cast<unsigned char*>(MemBlock.base()); |