Skip to content

Commit ef7cd10

Browse files
committed
[builtins] Fix CPU feature detection for FreeBSD on AArch64
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.
1 parent 9e439a3 commit ef7cd10

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

compiler-rt/lib/builtins/cpu_model/aarch64.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ _Bool __aarch64_have_lse_atomics
3434
__attribute__((visibility("hidden"), nocommon)) = false;
3535

3636
#if defined(__FreeBSD__)
37+
#include <sys/auxv.h>
3738
#include "aarch64/hwcap.inc"
3839
#include "aarch64/lse_atomics/freebsd.inc"
3940
#elif defined(__Fuchsia__)

0 commit comments

Comments
 (0)