diff options
author | Davide Italiano <davide@freebsd.org> | 2015-11-17 16:34:28 +0000 |
---|---|---|
committer | Davide Italiano <davide@freebsd.org> | 2015-11-17 16:34:28 +0000 |
commit | 7f9f835cfb8bfab9977934d9d538a997bfa7f264 (patch) | |
tree | 47c61b3d175a9be480ee7e6a06318404cf5de3fe /llvm/lib/Support/Unix/Memory.inc | |
parent | 6c1b0b9a88f32f0ca25abe7b598704b2e7a7ca13 (diff) | |
download | bcm5719-llvm-7f9f835cfb8bfab9977934d9d538a997bfa7f264.tar.gz bcm5719-llvm-7f9f835cfb8bfab9977934d9d538a997bfa7f264.zip |
[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).
llvm-svn: 253341
Diffstat (limited to 'llvm/lib/Support/Unix/Memory.inc')
-rw-r--r-- | llvm/lib/Support/Unix/Memory.inc | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/llvm/lib/Support/Unix/Memory.inc b/llvm/lib/Support/Unix/Memory.inc index 4c66b8a01b0..7bffdf38773 100644 --- a/llvm/lib/Support/Unix/Memory.inc +++ b/llvm/lib/Support/Unix/Memory.inc @@ -264,15 +264,12 @@ bool Memory::setWritable (MemoryBlock &M, std::string *ErrMsg) { } 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 |