Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Sep 2021 13:53:16 GMT
From:      Mikael Urankar <mikael@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 74c66d50fd5f - main - lang/rust: Fix for missing getauxval function on FreeBSD
Message-ID:  <202109061353.186DrGeU006375@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by mikael:

URL: https://cgit.FreeBSD.org/ports/commit/?id=74c66d50fd5f3f12469881d4f9c5634f8722ccc5

commit 74c66d50fd5f3f12469881d4f9c5634f8722ccc5
Author:     Mikael Urankar <mikael@FreeBSD.org>
AuthorDate: 2021-09-06 13:14:54 +0000
Commit:     Mikael Urankar <mikael@FreeBSD.org>
CommitDate: 2021-09-06 13:53:04 +0000

    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>
---
 lang/rust/Makefile                                       |  2 +-
 ...rc_llvm-project_compiler-rt_lib_builtins_cpu__model.c | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109061353.186DrGeU006375>