sljit-macos11-conditional.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. From de8fc816bc6698ab97316ed954e133e7e5098262 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= <carenas@gmail.com>
  3. Date: Thu, 21 Apr 2022 21:01:12 -0700
  4. Subject: [PATCH] macos: somehow allow building with a target below 11.0
  5. While building for macOS older than 11 in Apple Silicon makes no
  6. sense, some build systems lack the flexibility to set a target per
  7. architecture while aiming to support multi architecture binaries.
  8. Allow an option in those cases by using the slower runtime checks
  9. if the toolchain allows it.
  10. Fixes: PCRE2Project/pcre2#109
  11. ---
  12. sljit_src/sljitExecAllocator.c | 3 +++
  13. 1 file changed, 3 insertions(+)
  14. diff --git a/sljit_src/sljitExecAllocator.c b/sljit_src/sljitExecAllocator.c
  15. index 92d940dd..6359848c 100644
  16. --- a/sljit_src/sljitExecAllocator.c
  17. +++ b/sljit_src/sljitExecAllocator.c
  18. @@ -152,6 +152,9 @@ static SLJIT_INLINE void apple_update_wx_flags(sljit_s32 enable_exec)
  19. {
  20. #if MAC_OS_X_VERSION_MIN_REQUIRED >= 110000
  21. pthread_jit_write_protect_np(enable_exec);
  22. +#elif defined(__clang__)
  23. + if (__builtin_available(macOS 11.0, *))
  24. + pthread_jit_write_protect_np(enable_exec);
  25. #else
  26. #error "Must target Big Sur or newer"
  27. #endif /* BigSur */