aboutsummaryrefslogtreecommitdiff
path: root/lang/rust/files/patch-src_llvm-project_compiler-rt_lib_builtins_cpu__model.c
diff options
context:
space:
mode:
Diffstat (limited to 'lang/rust/files/patch-src_llvm-project_compiler-rt_lib_builtins_cpu__model.c')
-rw-r--r--lang/rust/files/patch-src_llvm-project_compiler-rt_lib_builtins_cpu__model.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/lang/rust/files/patch-src_llvm-project_compiler-rt_lib_builtins_cpu__model.c b/lang/rust/files/patch-src_llvm-project_compiler-rt_lib_builtins_cpu__model.c
index b58648815199..714cb844ceb4 100644
--- a/lang/rust/files/patch-src_llvm-project_compiler-rt_lib_builtins_cpu__model.c
+++ b/lang/rust/files/patch-src_llvm-project_compiler-rt_lib_builtins_cpu__model.c
@@ -1,16 +1,19 @@
---- 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
-@@ -775,7 +775,12 @@ _Bool __aarch64_have_lse_atomics
+@@ -775,8 +775,14 @@ _Bool __aarch64_have_lse_atomics
#define HWCAP_ATOMICS (1 << 8)
#endif
static void CONSTRUCTOR_ATTRIBUTE init_have_lse_atomics(void) {
-- unsigned long hwcap = getauxval(AT_HWCAP);
-+ unsigned long hwcap = 0;
-+#if defined(__linux__)
-+ hwcap = getauxval(AT_HWCAP);
-+#elif defined(__FreeBSD__)
-+ elf_aux_info(AT_HWCAP, &hwcap, sizeof(unsigned long));
-+#endif
++#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>)