Differential D31872 Diff 95218 lang/rust/files/patch-src_llvm-project_compiler-rt_lib_builtins_cpu__model.c
Changeset View
Changeset View
Standalone View
Standalone View
lang/rust/files/patch-src_llvm-project_compiler-rt_lib_builtins_cpu__model.c
--- src/llvm-project/compiler-rt/lib/builtins/cpu_model.c.orig 2021-05-22 10:27:43 UTC | https://reviews.llvm.org/D109330 | ||||
--- src/llvm-project/compiler-rt/lib/builtins/cpu_model.c.orig 2021-07-12 08:53:30 UTC | |||||
+++ src/llvm-project/compiler-rt/lib/builtins/cpu_model.c | +++ src/llvm-project/compiler-rt/lib/builtins/cpu_model.c | ||||
@@ -775,7 +775,12 @@ _Bool __aarch64_have_lse_atomics | @@ -775,8 +775,14 @@ _Bool __aarch64_have_lse_atomics | ||||
#define HWCAP_ATOMICS (1 << 8) | #define HWCAP_ATOMICS (1 << 8) | ||||
#endif | #endif | ||||
static void CONSTRUCTOR_ATTRIBUTE init_have_lse_atomics(void) { | static void CONSTRUCTOR_ATTRIBUTE init_have_lse_atomics(void) { | ||||
- unsigned long hwcap = getauxval(AT_HWCAP); | +#if defined(__FreeBSD__) | ||||
+ unsigned long hwcap = 0; | + unsigned long hwcap; | ||||
+#if defined(__linux__) | + int result = elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap); | ||||
+ hwcap = getauxval(AT_HWCAP); | + __aarch64_have_lse_atomics = result == 0 && (hwcap & HWCAP_ATOMICS) != 0; | ||||
+#elif defined(__FreeBSD__) | +#else | ||||
+ elf_aux_info(AT_HWCAP, &hwcap, sizeof(unsigned long)); | unsigned long hwcap = getauxval(AT_HWCAP); | ||||
+#endif | |||||
__aarch64_have_lse_atomics = (hwcap & HWCAP_ATOMICS) != 0; | __aarch64_have_lse_atomics = (hwcap & HWCAP_ATOMICS) != 0; | ||||
+#endif | |||||
} | } | ||||
#endif // defined(__has_include) | #endif // defined(__has_include) | ||||
#endif // __has_include(<sys/auxv.h>) |