From 89c3b788a70c5408ce18a3a621df0d1123cb321b Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Fri, 12 Sep 2025 16:55:36 -0700 Subject: [PATCH] [compiler-rt] Remove enable_execute_stack support on arm64 Darwin `enable_execute_stack` is not supported on arm64 Darwin because: - It calls mprotect with `PROT_WRITE | PROT_EXEC`, which is rejected on this platform. - It assumes a fixed 4K page size, which is not guaranteed. This change disables building `enable_execute_stack` on arm64 Darwin and fixes the failing test: `compiler-rt/test/builtins/Unit/enable_execute_stack_test.c`. rdar://159705691 --- compiler-rt/lib/builtins/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt index 1dadb6a810efb..0d7fc65cfd3e9 100644 --- a/compiler-rt/lib/builtins/CMakeLists.txt +++ b/compiler-rt/lib/builtins/CMakeLists.txt @@ -674,6 +674,11 @@ if (MINGW) ) endif() +# Don't build enable_execute_stack on arm64 darwin. +if (APPLE) + list(REMOVE_ITEM aarch64_SOURCES enable_execute_stack.c) +endif() + set(amdgcn_SOURCES ${GENERIC_SOURCES}) set(armv4t_SOURCES ${arm_min_SOURCES})