-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Reintroduce "Fix detection of unknown gcc function attributes" #9586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: PHP-8.1
Are you sure you want to change the base?
Reintroduce "Fix detection of unknown gcc function attributes" #9586
Conversation
279fe0a
to
f8a8974
Compare
Doesn't this indicate that this change to the m4 macro is completely broken? It only checks for TBH I think we should just burn this with fire and switch everything that doesn't already do so over to |
f8a8974
to
1a5f307
Compare
Hi @nikic, thanks for the review! I extended the m4 macro to account for clang's Regarding replacing the macro, should I file a separate PR for that (against Note that once this is solved, I was planning on checking any other embedded m4 macros for upstream updates as mentioned in the previous PR. |
This reverts commit 0a47fdf, which originally reverted this patch due to MacOS build failures.
As described in commit 813d942, the embedded GCC macro in `build/ax_gcc_func_attribute.m4` throws false negatives anytime unrelated warnings are raised, setting `have_func_attribute` to no. The fix proposed in the macro upstream changed detecting any warnings to detecting issues related to `-Wattributes` only in order to decide when to set `HAVE_FUNC_ATTRIBUTE_*`. However, the Clang front-end equivalent is `-Wunknown-attribute`. This patch extends ax_gcc_func_attribute.m4 checks to also match the Clang warning.
b6ec519
to
2555ec4
Compare
Updating this one to target PHP-8.1 |
Since the diff --git a/build/ax_gcc_func_attribute.m4 b/build/ax_gcc_func_attribute.m4
index 79f3eef82b..5ed7d8b4e5 100644
--- a/build/ax_gcc_func_attribute.m4
+++ b/build/ax_gcc_func_attribute.m4
@@ -222,7 +222,12 @@ AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [
m4_warn([syntax], [Unsupported attribute $1, the test may fail])
int foo( void ) __attribute__(($1));
]
- )], [])
+ )], [
+ m4_case([$1],
+ [ifunc],
+ [resolve_foo();],
+ [])
+ ])
],
dnl GCC doesn't exit with an error if an unknown attribute is
dnl provided but only outputs a warning, so accept the attribute |
For the warning of On GCC it works ok. Perhaps we can simply remove the static keyword from the test or do something like this: diff --git a/build/ax_gcc_func_attribute.m4 b/build/ax_gcc_func_attribute.m4
index 79f3eef82b..92a62698b8 100644
--- a/build/ax_gcc_func_attribute.m4
+++ b/build/ax_gcc_func_attribute.m4
@@ -151,7 +151,11 @@ AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [
],
[ifunc], [
int my_foo( void ) { return 0; }
+ #if defined(__clang__) && (__clang_major__ < 19)
+ int (*resolve_foo(void))(void) { return my_foo; }
+ #else
static int (*resolve_foo(void))(void) { return my_foo; }
+ #endif
int foo( void ) __attribute__(($1("resolve_foo")));
],
[leaf], [ |
This PR approach has changed (see comments below and commit messages), but the original text was kept here for further discussions
Disable ifunc support on darwin to reintroduce 813d942
As described in commit 813d942, the embedded GCC macro in
build/ax_gcc_func_attribute.m4
throws false negatives anytime unrelated warnings are reaised, settinghave_func_attribute
to no.darwin builds do throw such warnings, meaning the ifunc support is never compiled there. Commit 813d942 introduced a fix to the macro, by only disabling the support in question when an attribute warning is raised. This revealed a possible incompatibility error in the MacOS pipeline:
This PR disables ifunc support on darwin so the GCC macro can be fixed to support builds which enable additional compiler warning flags such as
-Wall
.P.S.: I do not have access to a MacOS, therefore, Icould only rely on the github pipeline run to verify the MacOS counterpart of this fix. Note that the GCC macro bit of this patch has been applied in Ubuntu and Debian distributions.