Skip to content

__builtin_cpu_init configure check relies on void return value #12273

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

Closed
Freaky opened this issue Sep 22, 2023 · 4 comments
Closed

__builtin_cpu_init configure check relies on void return value #12273

Freaky opened this issue Sep 22, 2023 · 4 comments

Comments

@Freaky
Copy link
Contributor

Freaky commented Sep 22, 2023

Description

Testing enabling ifunc support on FreeBSD, alongside having to remove the hardcoded check that disables it I also run into:

  checking for __builtin_cpu_init... no

return __builtin_cpu_init()? 1 : 0;

  AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
    return __builtin_cpu_init()? 1 : 0;
  ]])], [

While this does technically appear to return int on gcc, it's documented as void __builtin_cpu_init (void), and indeed returns such on clang. Changing this to:

  AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
    __builtin_cpu_init(); return 1;
  ]])], [

Results in a successful check and much faster addslashes, base64_encode, etc.

PHP Version

PHP 8.1.23

Operating System

FreeBSD 13.2-RELEASE

@devnexen
Copy link
Member

Would you mind creating a PR ?

Freaky added a commit to Freaky/php-src that referenced this issue Sep 22, 2023
__builtin_cpu_init() is documented as having a void return type.  It happens to
return int on gcc, but is void on clang.
@Freaky
Copy link
Contributor Author

Freaky commented Sep 22, 2023

Created as #12274. Looks like the return is superfluous.

@devnexen
Copy link
Member

Seeing what you've done in the bugzilla ticket, do you think it would be possible to make a more targeted version ? meaning still disabling ifunc for freebsd but release < 12 ? I think it would be good to have it here instead but just few months ago we had an user using freebsd 9.2.

@Freaky
Copy link
Contributor Author

Freaky commented Sep 23, 2023

I just created #12288.

devnexen pushed a commit that referenced this issue Sep 24, 2023
__builtin_cpu_init() is documented as having a void return type.  It happens to
return int on gcc, but is void on clang.

Close GH-122274
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants