On PowerPC, the cache-flush instructions dcbf and icbi are treated as
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>
Wed, 20 Feb 2013 18:24:30 +0000 (18:24 +0000)
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>
Wed, 20 Feb 2013 18:24:30 +0000 (18:24 +0000)
loads. On FreeBSD, add PROT_READ page protection flag before flushing
cache.

llvm-svn: 175646

llvm/lib/Support/Unix/Memory.inc

index 40d6b3f..a66e3c7 100644 (file)
@@ -51,7 +51,11 @@ int getPosixProtectionFlags(unsigned Flags) {
         llvm::sys::Memory::MF_EXEC:
     return PROT_READ | PROT_WRITE | PROT_EXEC;
   case llvm::sys::Memory::MF_EXEC:
+#if defined(__FreeBSD__)
+    return PROT_READ | PROT_EXEC;
+#else
     return PROT_EXEC;
+#endif
   default:
     llvm_unreachable("Illegal memory protection flag specified!");
   }