aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Support/Unix
diff options
context:
space:
mode:
authorTim Northover <t.p.northover@gmail.com>2013-05-19 15:28:16 +0000
committerTim Northover <t.p.northover@gmail.com>2013-05-19 15:28:16 +0000
commit820b147493d6d534f9482f1e7d4ff5af99d095b4 (patch)
tree4aff1b9fa116a096d343896fd388bb0b3955a63d /lib/Support/Unix
parentff9a6b44e003f4abcc0231335824c4fe2b616950 (diff)
downloadexternal_llvm-820b147493d6d534f9482f1e7d4ff5af99d095b4.zip
external_llvm-820b147493d6d534f9482f1e7d4ff5af99d095b4.tar.gz
external_llvm-820b147493d6d534f9482f1e7d4ff5af99d095b4.tar.bz2
Invalidate instruction cache when setting memory to be executable.
lli's remote MCJIT code calls setExecutable just prior to running code. In line with Darwin behaviour this seems to be the place to invalidate any caches needed so that relocations can take effect properly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182213 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Unix')
-rw-r--r--lib/Support/Unix/Memory.inc3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Support/Unix/Memory.inc b/lib/Support/Unix/Memory.inc
index cdd475c..1c6af7f 100644
--- a/lib/Support/Unix/Memory.inc
+++ b/lib/Support/Unix/Memory.inc
@@ -268,6 +268,9 @@ bool Memory::setExecutable (MemoryBlock &M, std::string *ErrMsg) {
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