Skip to content
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

[builtins] Fix CPU feature detection for FreeBSD on AArch64 #76532

Merged

Conversation

DimitryAndric
Copy link
Collaborator

This is a follow-up to #75635 which broke the build for FreeBSD on AArch64:

compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/freebsd.inc:3:16: error: call to undeclared function 'elf_aux_info'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    3 |   int result = elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap);
      |                ^

Using elf_aux_info() requires including <sys/auxv.h> first. To prevent redeclaration issues with hwcap.inc attempting to define HWCAP_xxx macros before <sys/auxv.h> does so, include <sys/auxv.h> before any of the .inc files on FreeBSD.

This is a follow-up to #75635 which broke the build for FreeBSD on
AArch64:

```
compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/freebsd.inc:3:16: error: call to undeclared function 'elf_aux_info'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    3 |   int result = elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap);
      |                ^
```

Using `elf_aux_info()` requires including `<sys/auxv.h>` first. To
prevent redeclaration issues with `hwcap.inc` attempting to define
`HWCAP_xxx` macros before `<sys/auxv.h>` does so, include `<sys/auxv.h>`
before any of the `.inc` files on FreeBSD.
Copy link

github-actions bot commented Dec 28, 2023

✅ With the latest revision this PR passed the C/C++ code formatter.

@DimitryAndric DimitryAndric merged commit 953ae94 into main Dec 29, 2023
4 checks passed
@DimitryAndric DimitryAndric deleted the users/DimitryAndric/compiler-rt-cpumodel-fix-freebsd branch December 29, 2023 10:13
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