|
| 1 | +Imported from Alpine: https://gitlab.alpinelinux.org/alpine/aports/-/blob/9e8202998fa718a7be6fb2d8aba639f97a94bb6a/main/llvm21/fix-memory-mf_exec-on-aarch64.patch |
| 2 | + |
| 3 | +Fix failures in AllocationTests/MappedMemoryTest.* on aarch64: |
| 4 | + |
| 5 | + Failing Tests (8): |
| 6 | + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3 |
| 7 | + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3 |
| 8 | + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3 |
| 9 | + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3 |
| 10 | + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3 |
| 11 | + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3 |
| 12 | + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3 |
| 13 | + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3 |
| 14 | + |
| 15 | +Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10 |
| 16 | + |
| 17 | +diff --git a/llvm/lib/Support/Unix/Memory.inc b/llvm/lib/Support/Unix/Memory.inc |
| 18 | +index 4c8f6b2ea..6cddae13b 100644 |
| 19 | +--- a/llvm/lib/Support/Unix/Memory.inc |
| 20 | ++++ b/llvm/lib/Support/Unix/Memory.inc |
| 21 | +@@ -50,7 +50,7 @@ static int getPosixProtectionFlags(unsigned Flags) { |
| 22 | + llvm::sys::Memory::MF_EXEC: |
| 23 | + return PROT_READ | PROT_WRITE | PROT_EXEC; |
| 24 | + case llvm::sys::Memory::MF_EXEC: |
| 25 | +-#if defined(__FreeBSD__) || defined(__powerpc__) |
| 26 | ++#if defined(__FreeBSD__) || defined(__powerpc__) || (defined(__linux__) && defined(__aarch64__)) |
| 27 | + // On PowerPC, having an executable page that has no read permission |
| 28 | + // can have unintended consequences. The function InvalidateInstruction- |
| 29 | + // Cache uses instructions dcbf and icbi, both of which are treated by |
0 commit comments