Repository navigation
PHP 8.5.0: preserve_none check fails on macOS (undefined symbol fun as macOS uses _fun) #20546
Copy link
Copy link
Closed
Labels
Description
Description
While preparing PHP 8.5.0 release in Homebrew (Homebrew/homebrew-core#255299), I noticed that the new TAILCALL VM feature wasn't getting enabled on macOS.
From config.log, the error is
configure:81621: checking for preserve_none calling convention
configure:81715: clang -o conftest -g -O2 -ffp-contract=off -fvisibility=hidden -DNDEBUG -D_GNU_SOURCE -Wl,-rpath,/opt/homebrew/Cellar/openssl@3/3.6.0/lib -L/opt/homebrew/Cellar/openssl@3/3.6.0/lib -Wl,-rpath,/opt/homebrew/Cellar/pcre2/10.47/lib -L/opt/homebrew/Cellar/pcre2/10.47/lib -Wl,-rpath,/opt/homebrew/opt/sqlite/lib -L/opt/homebrew/opt/sqlite/lib -Wl,-rpath,/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/lib -Wl,-rpath,/opt/homebrew/Cellar/curl/8.17.0/lib -L/opt/homebrew/Cellar/curl/8.17.0/lib -Wl,-rpath,/opt/homebrew/Cellar/gd/2.3.3_6/lib -L/opt/homebrew/Cellar/gd/2.3.3_6/lib -Wl,-rpath,/opt/homebrew/opt/gettext/lib -L/opt/homebrew/opt/gettext/lib -Wl,-rpath,/opt/homebrew/opt/gmp/lib -L/opt/homebrew/opt/gmp/lib -Wl,-rpath,/opt/homebrew/opt/openldap/lib -L/opt/homebrew/opt/openldap/lib -Wl,-rpath,/opt/homebrew/Cellar/oniguruma/6.9.10/lib -L/opt/homebrew/Cellar/oniguruma/6.9.10/lib -Wl,-rpath,/opt/homebrew/Cellar/unixodbc/2.3.14/lib -L/opt/homebrew/Cellar/unixodbc/2.3.14/lib -Wl,-rpath,/opt/homebrew/opt/freetds/lib -L/opt/homebrew/opt/freetds/lib -Wl,-rpath,/opt/homebrew/opt/libpq/lib -L/opt/homebrew/opt/libpq/lib -Wl,-rpath,/opt/homebrew/Cellar/net-snmp/5.9.4/lib -L/opt/homebrew/Cellar/net-snmp/5.9.4/lib -Wl,-rpath,/opt/homebrew/opt/openssl@3/lib -L/opt/homebrew/opt/openssl@3/lib -Wl,-rpath,/opt/homebrew/Cellar/libsodium/1.0.20/lib -L/opt/homebrew/Cellar/libsodium/1.0.20/lib -Wl,-rpath,/opt/homebrew/Cellar/argon2/20190702_1/lib -L/opt/homebrew/Cellar/argon2/20190702_1/lib -Wl,-rpath,/opt/homebrew/opt/tidy-html5/lib -L/opt/homebrew/opt/tidy-html5/lib -Wl,-rpath,/opt/homebrew/Cellar/libzip/1.11.4/lib -L/opt/homebrew/Cellar/libzip/1.11.4/lib conftest.c >&5
Undefined symbols for architecture arm64:
"fun", referenced from:
_test in conftest-4b4b9c.o
_main in conftest-4b4b9c.o
This can also be reproduced by just trying to manually compile - https://github.com/php/php-src/blob/php-8.5.0/Zend/Zend.m4#L479
The issue is due to macOS symbol being _fun not fun, e.g.
❯ clang -c test.c && nm -gU test.o | grep fun
0000000000000000 T _funLine 518 in ca7f556
| "bl fun\n" |
Also, minor issue but there is a typo (preverve) which I noticed when trying to override the cache variable
Line 477 in 685e996
| [php_cv_preverve_none], |
PHP Version
PHP 8.5.0 (cli) (built: Nov 18 2025 08:02:20) (NTS)
Copyright (c) The PHP Group
Built by Homebrew
Zend Engine v4.5.0, Copyright (c) Zend Technologies
with Zend OPcache v8.5.0, Copyright (c), by Zend Technologies
Operating System
macOS 26
Reacted by David CARLIER
Activity
devnexen commentedon Nov 22, 2025
Nice report. The following little changes fix it for me (I know mac intel are no longer a thing but just in case..)
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 <stdio.h> #include <stdint.h> @@ -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)Fix phpGH-20546: Zend preserve_none attribute config check on macOs i…
Merge branch 'PHP-8.5'
Fix GH-20546: Zend preserve_none attribute config check on macOs issue.
Fix PHP 8.5 TAILCALL VM musttail error on Intel Macs