Invalidate instruction cache when setting memory to be executable.
authorTim Northover <t.p.northover@gmail.com>
Sun, 19 May 2013 15:28:16 +0000 (15:28 +0000)
committerTim Northover <t.p.northover@gmail.com>
Sun, 19 May 2013 15:28:16 +0000 (15:28 +0000)
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

lib/Support/Unix/Memory.inc
test/ExecutionEngine/MCJIT/remote/lit.local.cfg [deleted file]
test/ExecutionEngine/MCJIT/remote/test-common-symbols-remote.ll
test/ExecutionEngine/MCJIT/remote/test-data-align-remote.ll
test/ExecutionEngine/MCJIT/remote/test-global-init-nonzero-remote.ll
test/ExecutionEngine/MCJIT/remote/test-ptr-reloc-remote.ll

index cdd475c17f7a7154626a0d731b80e3d13ef8101c..1c6af7fa0f2ff8869ddc52ca97ec64d2813f8ea1 100644 (file)
@@ -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
diff --git a/test/ExecutionEngine/MCJIT/remote/lit.local.cfg b/test/ExecutionEngine/MCJIT/remote/lit.local.cfg
deleted file mode 100644 (file)
index 12fcda0..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
-
-def getRoot(config):
-    if not config.parent:
-        return config
-    return getRoot(config.parent)
-
-root = getRoot(config)
-
-if 'arm' in root.target_triple:
-    config.unsupported = True
index a336c017c0803d3af68ae5b4b320f3f21ecb6d6c..eb2e68606da4e5965223cac0098b3481d974a169 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: %lli_mcjit -remote-mcjit -O0 -disable-lazy-compilation=false %s
-; XFAIL: arm, mips
+; XFAIL: mips
 
 ; The intention of this test is to verify that symbols mapped to COMMON in ELF
 ; work as expected.
index 9daf1684de8167d04d959faa79277c524cc270f4..874eeae206921f47b4cfea353b3932f7fe1692ce 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN:  %lli_mcjit -remote-mcjit -O0 %s
-; XFAIL: armv7, mips
+; XFAIL: mips
 
 ; Check that a variable is always aligned as specified.
 
index b8d94b50cfe2821c5245d18b1696fc0efcc62de2..5337c5d2582f361fb17028d76a34593f5497d9b3 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: %lli_mcjit -remote-mcjit %s > /dev/null
-; XFAIL: arm, mips
+; XFAIL: mips
 
 @count = global i32 1, align 4
 
index 833a56a4a95c039e94f6fe8e7e54cc13b5b979cb..1a55879f8f61c3847629579dfe33c335396acbde 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: %lli_mcjit -remote-mcjit -O0 %s
-; XFAIL: arm, mips
+; XFAIL: mips
 
 @.str = private unnamed_addr constant [6 x i8] c"data1\00", align 1
 @ptr = global i8* getelementptr inbounds ([6 x i8]* @.str, i32 0, i32 0), align 4