summaryrefslogtreecommitdiff
path: root/user/llvm8/fix-memory-mf_exec-on-aarch64.patch
diff options
context:
space:
mode:
authorZach van Rijn <me@zv.io>2022-06-10 10:44:01 +0000
committerZach van Rijn <me@zv.io>2022-10-21 18:34:01 -0500
commitb86743e2b6013cb965564d3d4a4b87f0e01b952e (patch)
treeaf8362c2936adc9b78fbd49b70d010e668cbf005 /user/llvm8/fix-memory-mf_exec-on-aarch64.patch
parent156f4768d73b15ec0df4299b78e700d25d69ce20 (diff)
downloadpackages-b86743e2b6013cb965564d3d4a4b87f0e01b952e.tar.gz
packages-b86743e2b6013cb965564d3d4a4b87f0e01b952e.tar.bz2
packages-b86743e2b6013cb965564d3d4a4b87f0e01b952e.tar.xz
packages-b86743e2b6013cb965564d3d4a4b87f0e01b952e.zip
user/llvm8: add patch for PROT_READ on aarch64 and ppc64. fixes #711.
Diffstat (limited to 'user/llvm8/fix-memory-mf_exec-on-aarch64.patch')
-rw-r--r--user/llvm8/fix-memory-mf_exec-on-aarch64.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/user/llvm8/fix-memory-mf_exec-on-aarch64.patch b/user/llvm8/fix-memory-mf_exec-on-aarch64.patch
new file mode 100644
index 000000000..a70b39733
--- /dev/null
+++ b/user/llvm8/fix-memory-mf_exec-on-aarch64.patch
@@ -0,0 +1,33 @@
+Fix failures in AllocationTests/MappedMemoryTest.* on aarch64:
+
+ Failing Tests (8):
+ LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3
+ LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3
+ LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3
+ LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3
+ LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3
+ LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3
+ LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3
+ LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3
+
+Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+
+--- a/lib/Support/Unix/Memory.inc
++++ b/lib/Support/Unix/Memory.inc
+@@ -54,7 +54,7 @@
+ llvm::sys::Memory::MF_EXEC:
+ return PROT_READ | PROT_WRITE | PROT_EXEC;
+ case llvm::sys::Memory::MF_EXEC:
+-#if defined(__FreeBSD__)
++#if defined(__FreeBSD__) || (defined(__linux__) && (defined(__aarch64__) || defined(__powerpc64__)))
+ // On PowerPC, having an executable page that has no read permission
+ // can have unintended consequences. The function InvalidateInstruction-
+ // Cache uses instructions dcbf and icbi, both of which are treated by
+@@ -62,6 +62,7 @@
+ // executing these instructions will result in a segmentation fault.
+ // Somehow, this problem is not present on Linux, but it does happen
+ // on FreeBSD.
++ // The same problem is present even on aarch64 Linux (at least on musl).
+ return PROT_READ | PROT_EXEC;
+ #else
+ return PROT_EXEC;