Skip to content

Fix GH-20767: build failure with preserve_none attribute enabled on mac.#20777

Closed
devnexen wants to merge 6 commits into
php:PHP-8.5from
devnexen:gh20767
Closed

Fix GH-20767: build failure with preserve_none attribute enabled on mac.#20777
devnexen wants to merge 6 commits into
php:PHP-8.5from
devnexen:gh20767

Conversation

@devnexen

Copy link
Copy Markdown
Member

Established that build < 1700.4.4.1 tends to fail thus we disable the preserve_none attribute feature for these cases.

…n mac.

Established that build < 1700.4.4.1 tends to fail thus we disable the
preserve_none attribute feature for these cases.
@dktapps

dktapps commented Dec 25, 2025

Copy link
Copy Markdown
Contributor

This doesn't fix the issue for me. I also don't see any sign of the Apple clang build train message in my config.log.

Output of clang --version if it's helpful:

% clang --version
Apple clang version 17.0.0 (clang-1700.0.13.5)
Target: arm64-apple-darwin24.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

@devnexen devnexen marked this pull request as draft December 25, 2025 20:37
@dktapps

dktapps commented Dec 25, 2025

Copy link
Copy Markdown
Contributor

Removing the -n from the sed command allowed it to check the version, but the check still passes. Looks like AS_VERSION_COMPARE doesn't understand it.

It might be better to use this, which is defined by clang:

#define __apple_build_version__ 17000013

The working version should be 17000404 I believe.

@devnexen

Copy link
Copy Markdown
Member Author

let me know if this is working out for you this time. Cheers.

@dktapps

dktapps commented Dec 26, 2025

Copy link
Copy Markdown
Contributor

Yep, that did the trick

@devnexen devnexen marked this pull request as ready for review December 26, 2025 00:45
@arnaud-lb

Copy link
Copy Markdown
Member

@devnexen do you think it would work if we added the __apple_build_version__ check here instead of what I suggested earlier?

It would be simpler, and would more directly be related to musttail.

@petk

petk commented Dec 27, 2025

Copy link
Copy Markdown
Member

Would this work instead of parsing the build version from a command in shell?

diff --git a/Zend/Zend.m4 b/Zend/Zend.m4
index 33009e9909f..b89f1f26d74 100644
--- a/Zend/Zend.m4
+++ b/Zend/Zend.m4
@@ -476,6 +476,13 @@ AC_DEFUN([ZEND_CHECK_PRESERVE_NONE], [dnl
   AC_CACHE_CHECK([for preserve_none calling convention],
    [php_cv_preserve_none],
    [AC_RUN_IFELSE([AC_LANG_SOURCE([[
+
+#ifdef __apple_build_version__
+# if __apple_build_version__ < 17000404
+#  error This version of Apple Clang doesn't support preserve_none
+# endif
+#endif
+
 #include <stdio.h>
 #include <stdint.h>

@devnexen

Copy link
Copy Markdown
Member Author

nice suggestion, going to try it.

@arnaud-lb arnaud-lb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not able to test right now, but the zend_portability.h change looks right to me, and is probably enough. It also makes sense that it’s disabling musttail rather than preserve_none, even if the end result is the same, as the build issue is related to musttail.

Comment thread Zend/zend_portability.h
#endif


#if !defined(__apple_build_version__) || (defined(__apple_build_version__) && __apple_build_version__ >= 17000404)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: please indent the nested cpp directives (with a space after the #)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not get your suggestion @henderkes, it is not within a nested part is it ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, didn't see the #endif just above. Ignore the suggestion then.

@arnaud-lb arnaud-lb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @devnexen!

@devnexen devnexen closed this in 95a8395 Dec 31, 2025
@dktapps

dktapps commented Dec 31, 2025

Copy link
Copy Markdown
Contributor

Thanks. Confirmed working on both broken clang (1700.0.13.5) and working (1700.6.3.2) with expected VM types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compile fail on macOS 15.5 fatal error: error in backend: failed to perform tail call elimination on a call site marked musttail

5 participants