aboutsummaryrefslogtreecommitdiff
path: root/compiler-rt
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2021-11-20 17:36:30 +0000
committerDimitry Andric <dim@FreeBSD.org>2021-11-20 17:36:30 +0000
commit846a2208a8ab099f595fe7e8b2e6d54a7b5e67fb (patch)
tree73c1a7a230c8bb19317a3893d937c4d8a219e91c /compiler-rt
parentc0981da47d5696fe36474fcf86b4ce03ae3ff818 (diff)
Diffstat (limited to 'compiler-rt')
-rw-r--r--compiler-rt/lib/builtins/cpu_model.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler-rt/lib/builtins/cpu_model.c b/compiler-rt/lib/builtins/cpu_model.c
index b8d807ed651c..53e2d89708dc 100644
--- a/compiler-rt/lib/builtins/cpu_model.c
+++ b/compiler-rt/lib/builtins/cpu_model.c
@@ -799,8 +799,14 @@ _Bool __aarch64_have_lse_atomics
#define HWCAP_ATOMICS (1 << 8)
#endif
static void CONSTRUCTOR_ATTRIBUTE init_have_lse_atomics(void) {
+#if defined(__FreeBSD__)
+ unsigned long hwcap;
+ int result = elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap);
+ __aarch64_have_lse_atomics = result == 0 && (hwcap & HWCAP_ATOMICS) != 0;
+#else
unsigned long hwcap = getauxval(AT_HWCAP);
__aarch64_have_lse_atomics = (hwcap & HWCAP_ATOMICS) != 0;
+#endif
}
#endif // defined(__has_include)
#endif // __has_include(<sys/auxv.h>)