Skip to content

cpu_ppc64le.c: fix build on FreeBSD #2520

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

Merged
merged 1 commit into from
Jul 10, 2025
Merged

cpu_ppc64le.c: fix build on FreeBSD #2520

merged 1 commit into from
Jul 10, 2025

Conversation

pkubaj
Copy link
Contributor

@pkubaj pkubaj commented Jul 3, 2025

FreeBSD uses elf_aux_info() function instead of getauxval():

  In file included from /wrkdirs/usr/ports/security/rustls-ffi/work/rustls-ffi-0.15.0/cargo-crates/aws-lc-sys-0.24.0/aws-lc/crypto/fipsmodule/bcm.c:86:                                                                                                                                                                                                                   
  /wrkdirs/usr/ports/security/rustls-ffi/work/rustls-ffi-0.15.0/cargo-crates/aws-lc-sys-0.24.0/aws-lc/crypto/fipsmodule/cpucap/cpu_ppc64le.c:72:28: error: call to undeclared function 'getauxval'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
     72 |   OPENSSL_ppc64le_hwcap2 = getauxval(AT_HWCAP2);                                                                                  
        |                            ^

Description of changes:

Currently aws-lc doesn't build on FreeBSD/powerpc64* because of using getauxval(). This PR addresses the issue.

Testing:

Try building on FreeBSD 14.3-RELEASE on powerpc64le and powerpc64.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.

@pkubaj pkubaj requested a review from a team as a code owner July 3, 2025 08:05
@@ -69,7 +69,11 @@ extern uint8_t OPENSSL_cpucap_initialized;

void OPENSSL_cpuid_setup(void) {
#if defined(AT_HWCAP2)
#if defined(__linux__)
Copy link
Contributor

Choose a reason for hiding this comment

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

@codecov-commenter
Copy link

codecov-commenter commented Jul 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.90%. Comparing base (5d04886) to head (3a51720).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2520      +/-   ##
==========================================
+ Coverage   78.88%   78.90%   +0.01%     
==========================================
  Files         640      640              
  Lines      109755   109766      +11     
  Branches    15523    15526       +3     
==========================================
+ Hits        86580    86608      +28     
+ Misses      22478    22463      -15     
+ Partials      697      695       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

FreeBSD uses elf_aux_info() function instead of getauxval():
  In file included from /wrkdirs/usr/ports/security/rustls-ffi/work/rustls-ffi-0.15.0/cargo-crates/aws-lc-sys-0.24.0/aws-lc/crypto/fipsmodule/bcm.c:86:
  /wrkdirs/usr/ports/security/rustls-ffi/work/rustls-ffi-0.15.0/cargo-crates/aws-lc-sys-0.24.0/aws-lc/crypto/fipsmodule/cpucap/cpu_ppc64le.c:72:28: error: call to undeclared function 'getauxval'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
     72 |   OPENSSL_ppc64le_hwcap2 = getauxval(AT_HWCAP2);
        |                            ^
@torben-hansen
Copy link
Contributor

Can you confirm that this patch works for your build environment?

@torben-hansen torben-hansen requested a review from dkostic July 7, 2025 13:53
@justsmth justsmth requested a review from torben-hansen July 10, 2025 14:38
@torben-hansen torben-hansen merged commit 2d68e78 into aws:main Jul 10, 2025
114 of 118 checks passed
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.

5 participants