diff options
author | Mikael Urankar <mikael@FreeBSD.org> | 2021-09-06 13:14:54 +0000 |
---|---|---|
committer | Mikael Urankar <mikael@FreeBSD.org> | 2021-09-06 13:53:04 +0000 |
commit | 74c66d50fd5f3f12469881d4f9c5634f8722ccc5 (patch) | |
tree | 1120909048248f7d229d965856a5ef3616710b93 | |
parent | 8a1cbabfc3a0348d80a20e5ee4a57c6bc84c7c38 (diff) | |
download | ports-74c66d50fd5f3f12469881d4f9c5634f8722ccc5.tar.gz ports-74c66d50fd5f3f12469881d4f9c5634f8722ccc5.zip |
lang/rust: Fix for missing getauxval function on FreeBSD
Use FreeBSD's elf_aux_info for detecting ARM HW features
PR: 258198
Tested by: Bob Prohaska <fbsd@www.zefox.net>
-rw-r--r-- | lang/rust/Makefile | 2 | ||||
-rw-r--r-- | lang/rust/files/patch-src_llvm-project_compiler-rt_lib_builtins_cpu__model.c | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/lang/rust/Makefile b/lang/rust/Makefile index 77476313a0dc..26185e9697df 100644 --- a/lang/rust/Makefile +++ b/lang/rust/Makefile @@ -2,7 +2,7 @@ PORTNAME= rust PORTVERSION?= 1.54.0 -PORTREVISION?= 0 +PORTREVISION?= 1 CATEGORIES= lang MASTER_SITES= https://static.rust-lang.org/dist/:src \ https://dev-static.rust-lang.org/dist/:src \ 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 new file mode 100644 index 000000000000..ee00760e61c6 --- /dev/null +++ b/lang/rust/files/patch-src_llvm-project_compiler-rt_lib_builtins_cpu__model.c @@ -0,0 +1,16 @@ +--- src/llvm-project/compiler-rt/lib/builtins/cpu_model.c.orig 2021-05-22 10:27:43 UTC ++++ src/llvm-project/compiler-rt/lib/builtins/cpu_model.c +@@ -775,7 +775,12 @@ _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__) ++ hwcap = elf_aux_info(AT_HWCAP, &hwcap, sizeof(unsigned long)); ++#endif + __aarch64_have_lse_atomics = (hwcap & HWCAP_ATOMICS) != 0; + } + #endif // defined(__has_include) |