[llvm] r182213 - Invalidate instruction cache when setting memory to be executable.

Tim Northover t.p.northover at gmail.com
Sun May 19 08:28:16 PDT 2013


Author: tnorthover
Date: Sun May 19 10:28:16 2013
New Revision: 182213

URL: http://llvm.org/viewvc/llvm-project?rev=182213&view=rev
Log:
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.

Removed:
    llvm/trunk/test/ExecutionEngine/MCJIT/remote/lit.local.cfg
Modified:
    llvm/trunk/lib/Support/Unix/Memory.inc
    llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-common-symbols-remote.ll
    llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-data-align-remote.ll
    llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-global-init-nonzero-remote.ll
    llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-ptr-reloc-remote.ll

Modified: llvm/trunk/lib/Support/Unix/Memory.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Memory.inc?rev=182213&r1=182212&r2=182213&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Memory.inc (original)
+++ llvm/trunk/lib/Support/Unix/Memory.inc Sun May 19 10:28:16 2013
@@ -268,6 +268,9 @@ bool Memory::setExecutable (MemoryBlock
   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

Removed: llvm/trunk/test/ExecutionEngine/MCJIT/remote/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/MCJIT/remote/lit.local.cfg?rev=182212&view=auto
==============================================================================
--- llvm/trunk/test/ExecutionEngine/MCJIT/remote/lit.local.cfg (original)
+++ llvm/trunk/test/ExecutionEngine/MCJIT/remote/lit.local.cfg (removed)
@@ -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

Modified: llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-common-symbols-remote.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-common-symbols-remote.ll?rev=182213&r1=182212&r2=182213&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-common-symbols-remote.ll (original)
+++ llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-common-symbols-remote.ll Sun May 19 10:28:16 2013
@@ -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.

Modified: llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-data-align-remote.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-data-align-remote.ll?rev=182213&r1=182212&r2=182213&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-data-align-remote.ll (original)
+++ llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-data-align-remote.ll Sun May 19 10:28:16 2013
@@ -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.
 

Modified: llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-global-init-nonzero-remote.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-global-init-nonzero-remote.ll?rev=182213&r1=182212&r2=182213&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-global-init-nonzero-remote.ll (original)
+++ llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-global-init-nonzero-remote.ll Sun May 19 10:28:16 2013
@@ -1,5 +1,5 @@
 ; RUN: %lli_mcjit -remote-mcjit %s > /dev/null
-; XFAIL: arm, mips
+; XFAIL: mips
 
 @count = global i32 1, align 4
 

Modified: llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-ptr-reloc-remote.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-ptr-reloc-remote.ll?rev=182213&r1=182212&r2=182213&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-ptr-reloc-remote.ll (original)
+++ llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-ptr-reloc-remote.ll Sun May 19 10:28:16 2013
@@ -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





More information about the llvm-commits mailing list