[llvm] r253341 - [JIT/Memory] Fix up semantic of setExecutable().
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 17 08:34:29 PST 2015
Author: davide
Date: Tue Nov 17 10:34:28 2015
New Revision: 253341
URL: http://llvm.org/viewvc/llvm-project?rev=253341&view=rev
Log:
[JIT/Memory] Fix up semantic of setExecutable().
setExecutable() should do everything that's needed to make the memory
executable on host, i.e. unconditionally set permissions + invalidate
instruction cache. llvm-rtdyld will be updated in my next commit.
Discusseed with: Lang Hames (as part of D13631).
Modified:
llvm/trunk/lib/Support/Unix/Memory.inc
Modified: llvm/trunk/lib/Support/Unix/Memory.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Memory.inc?rev=253341&r1=253340&r2=253341&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Memory.inc (original)
+++ llvm/trunk/lib/Support/Unix/Memory.inc Tue Nov 17 10:34:28 2015
@@ -264,15 +264,12 @@ bool Memory::setWritable (MemoryBlock &M
}
bool Memory::setExecutable (MemoryBlock &M, std::string *ErrMsg) {
-#if defined(__APPLE__) && (defined(__arm__) || defined(__arm64__))
if (M.Address == 0 || M.Size == 0) return false;
Memory::InvalidateInstructionCache(M.Address, M.Size);
+#if defined(__APPLE__) && (defined(__arm__) || defined(__arm64__))
kern_return_t kr = vm_protect(mach_task_self(), (vm_address_t)M.Address,
(vm_size_t)M.Size, 0, VM_PROT_READ | VM_PROT_EXECUTE | VM_PROT_COPY);
return KERN_SUCCESS == kr;
-#elif defined(__arm__) || defined(__aarch64__)
- Memory::InvalidateInstructionCache(M.Address, M.Size);
- return true;
#else
return true;
#endif
More information about the llvm-commits
mailing list