Skip to content

Fix AX_GCC_FUNC_ATTRIBUTE failure - #13784

Closed
remicollet wants to merge 1 commit into
php:PHP-8.2from
remicollet:fix-target-detection
Closed

Fix AX_GCC_FUNC_ATTRIBUTE failure#13784
remicollet wants to merge 1 commit into
php:PHP-8.2from
remicollet:fix-target-detection

Conversation

@remicollet

Copy link
Copy Markdown
Member

AX_GCC_FUNC_ATTRIBUTE([target]) may fail breaking various optimization (ex: base64_encode/base64_decode)

In config.log

configure:17050: checking for __attribute__((target))
configure:17072: cc -o conftest -Wall -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Werror=incompatible-pointer-types -fvisibility=hidden  -D_GNU_SOURCE  conftest.c -lm  >&5
conftest.c:146:32: warning: 'bar' declared 'static' but never defined [-Wunused-function]
  146 |                     static int bar( void ) __attribute__((target("sse2")));
      |                                ^~~
configure:17072: $? = 0
configure:17087: result: no

Dropping the static keyword allow the test to work

Notice, this file is outdated, see http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_gcc_func_attribute.m4 (serial 9 => 13) but "target" is not part of this upstream file, and only ifunc and target are used.

@petk

petk commented Mar 22, 2024

Copy link
Copy Markdown
Member

I was checking if this should be added in the upstream archive, but the issue is that this target addition is very specific and would require additional argument (that "sse2" string). #11712 and this is also in need of rechecking #9586

I think this macro can be forked and bundled but we update it with the upstream recent changes.

@remicollet

Copy link
Copy Markdown
Member Author

Thanks for the quick review

Merged in 8.2+ as 09a3681

@remicollet remicollet closed this Mar 22, 2024
@remicollet
remicollet deleted the fix-target-detection branch March 22, 2024 10:31
@athos-ribeiro

Copy link
Copy Markdown
Contributor

Hi, @remicollet, I just saw this one landed. Thanks for fixing that.

FWIW, we are still carrying #9586 in Debian/Ubuntu since any new warnings introduced would disable those optimizations in future builds.

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.

3 participants