Skip to content

Properly detect CRC32 APIs on aarch64 from configure. #5564

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

Conversation

oerdnj
Copy link
Contributor

@oerdnj oerdnj commented May 13, 2020

The CRC32 APIs are optional for armv8-a. They became mandatory since
armv8.1-a.

@oerdnj
Copy link
Contributor Author

oerdnj commented May 13, 2020

The hard requirement for crc32 APIs on arm64 breaks compilation on Debian Jessie (I know, I know, this is going away) and on any compilation where CRC32 APIs are not available, f.e. the Renesas board doesn't have them implemented according to OSSystems/meta-browser@527ff15

@oerdnj
Copy link
Contributor Author

oerdnj commented May 13, 2020

@remicollet the old(er) CentOS probably don't have arm64 architecture, so this is not a problem for you, right?

@nikic
Copy link
Member

nikic commented May 13, 2020

Just to make sure, you did check that it continues to work if the API is available?

This seems somewhat weird in that actual availability of the ISA extension usually doesn't matter when it comes to compiling code (as the decision whether to use the code will be made at runtime). I guess this doesn't hold up if the specified target doesn't support it in any configuration...

@oerdnj oerdnj force-pushed the ondrej/make-aarch64-crc32-api-optional branch from df717a9 to 0520357 Compare May 13, 2020 09:42
@oerdnj
Copy link
Contributor Author

oerdnj commented May 13, 2020

Ok, this needs slight update. The __crc32d functions are header only, so it needs AC_LINK_IFELSE() macro. With that I get:

  1. CFLAGS="-march=armv8-a -Og -g" ./configure --disable-all produces:
checking for aarch64 CRC32 API... no
  1. CFLAGS="-march=armv8.1-a -Og -g" ./configure --disable-all produces:
checking for aarch64 CRC32 API... yes

And by manually adding #error macros to ext/standard/crc32.c branch, I get the correct results with both -march settings.

(I am running Debian buster arm64 in schroot using qemu-user-static FWIW...)

@oerdnj
Copy link
Contributor Author

oerdnj commented May 13, 2020

This seems somewhat weird in that actual availability of the ISA extension usually doesn't matter when it comes to compiling code (as the decision whether to use the code will be made at runtime). I guess this doesn't hold up if the specified target doesn't support it in any configuration...

It is weird, but from distro perspective it's the decision that's being made by the distros (e.g. what is the minimal denominator). This is already causing big problem on Raspbian because somebody made a decision that armhf on Raspbian is something else than armhf on stock Debian virtually making the packages not compatible on older arm architectures (RPi Zero, RPi 1/2a)...

But there's not much you can do apart from having an emulator that would kick in everytime invalid instruction is encountered... well and properly detecting the features based on -march.

@oerdnj oerdnj force-pushed the ondrej/make-aarch64-crc32-api-optional branch from 0520357 to ac05894 Compare May 13, 2020 09:53
@nikic
Copy link
Member

nikic commented May 13, 2020

Looks like an ltmain.sh update snuck in here.

The CRC32 APIs are optional for armv8-a. They became mandatory since
armv8.1-a.
@oerdnj oerdnj force-pushed the ondrej/make-aarch64-crc32-api-optional branch from ac05894 to 1450dcf Compare May 13, 2020 11:01
@oerdnj
Copy link
Contributor Author

oerdnj commented May 13, 2020

Looks like an ltmain.sh update snuck in here.

Ooops, sorry, removed.

Copy link
Member

@nikic nikic left a comment

Choose a reason for hiding this comment

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

LGTM, CI failures are unrelated.

@carusogabriel
Copy link
Contributor

Should we apply these changes to

#elif defined(__aarch64__) && defined(__GNUC__)

as well?

@nikic
Copy link
Member

nikic commented May 13, 2020

@carusogabriel As zend_multiply.h does not use crc32 instructions: No.

@php-pulls php-pulls closed this in d4bebc8 May 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants