From 178776569620b64cee308211dd4329e8f08d7e76 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sat, 22 Nov 2025 11:05:39 +0000 Subject: [PATCH] Fix GH-20546: Zend preserve_none attribute config check on macOs issue. This attribute fails on macOs due to the inline assembly test. Due to an old Darwin C ABI convention, symbols are prefixed with an underscore so we need to take in account also for x86_64. close GH-20559 --- NEWS | 2 ++ Zend/Zend.m4 | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index b6efe0d85e5..cf93f7af656 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,8 @@ PHP NEWS . Sync all boost.context files with release 1.86.0. (mvorisek) . Fixed bug GH-20435 (SensitiveParameter doesn't work for named argument passing to variadic parameter). (ndossche) + . Fixed bug GH-20546 (preserve_none attribute configure check on macOs + issue). (David Carlier/cho-m) - Bz2: . Fix assertion failures resulting in crashes with stream filter diff --git a/Zend/Zend.m4 b/Zend/Zend.m4 index 1e1853167cf..33009e9909f 100644 --- a/Zend/Zend.m4 +++ b/Zend/Zend.m4 @@ -474,7 +474,7 @@ dnl expectations. dnl AC_DEFUN([ZEND_CHECK_PRESERVE_NONE], [dnl AC_CACHE_CHECK([for preserve_none calling convention], - [php_cv_preverve_none], + [php_cv_preserve_none], [AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include @@ -504,7 +504,11 @@ uintptr_t __attribute__((preserve_none)) test(void) { "movq %2, %%r13\n" "xorq %3, %%r13\n" "xorq %%rax, %%rax\n" +#if defined(__APPLE__) + "call _fun\n" +#else "call fun\n" +#endif : "=a" (ret) : "r" (const1), "r" (const2), "r" (key) : "r12", "r13" @@ -515,7 +519,11 @@ uintptr_t __attribute__((preserve_none)) test(void) { "eor x20, %1, %3\n" "eor x21, %2, %3\n" "eor x0, x0, x0\n" +#if defined(__APPLE__) + "bl _fun\n" +#else "bl fun\n" +#endif "mov %0, x0\n" : "=r" (ret) : "r" (const1), "r" (const2), "r" (key)