mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-13 03:09:51 +03:00
my attempt at unblocking the Chromium security upgrade, while waiting for !82919 to make it buildable with Clang 20
58 lines
2.2 KiB
Diff
58 lines
2.2 KiB
Diff
Cherry-pick from main: https://github.com/llvm/llvm-project/commit/cd634f57c10dedbe4f908889dece2c4460b702c9
|
|
|
|
In musl, __getauxval is a hidden symbol, which makes linking to compiler-rt fail:
|
|
ld.lld: error: undefined symbol: __getauxval
|
|
>>> referenced by sme-abi-init.c:26 (/home/buildozer/aports/main/llvm-runtimes/src/llvm-project-19.1.2.src/compiler-rt/lib/builtins/aarch64/sme-abi-init.c:26)
|
|
>>> sme-abi-init.c.o:(init_aarch64_has_sme) in archive /usr/lib/llvm19/lib/clang/19/lib/linux/libclang_rt.builtins-aarch64.a
|
|
|
|
From cd634f57c10dedbe4f908889dece2c4460b702c9 Mon Sep 17 00:00:00 2001
|
|
From: Daniel Kiss <daniel.kiss@arm.com>
|
|
Date: Fri, 30 Aug 2024 08:51:08 +0200
|
|
Subject: [PATCH] [compiler-rt][AArch64][Android] Use getauxval on Android.
|
|
(#102979)
|
|
|
|
__getauxval is a libgcc function that doesn't exist on Android.
|
|
Also on Linux let's use getauxval as it is anyway used other places in compiler-rt.
|
|
---
|
|
.../lib/builtins/aarch64/sme-abi-init.c | 22 +++++++++----------
|
|
1 file changed, 10 insertions(+), 12 deletions(-)
|
|
|
|
diff --git a/compiler-rt/lib/builtins/aarch64/sme-abi-init.c b/compiler-rt/lib/builtins/aarch64/sme-abi-init.c
|
|
index b6ee12170d56db..d3cd8278a5d214 100644
|
|
--- a/compiler-rt-19.1.7.src/lib/builtins/aarch64/sme-abi-init.c
|
|
+++ b/compiler-rt-19.1.7.src/lib/builtins/aarch64/sme-abi-init.c
|
|
@@ -7,24 +7,22 @@ _Bool __aarch64_has_sme_and_tpidr2_el0;
|
|
|
|
// We have multiple ways to check that the function has SME, depending on our
|
|
// target.
|
|
-// * For Linux we can use __getauxval().
|
|
+// * For Linux/Glibc we can use getauxval().
|
|
+// * For Android we can use getauxval().
|
|
// * For newlib we can use __aarch64_sme_accessible().
|
|
|
|
#if defined(__linux__)
|
|
|
|
-#ifndef AT_HWCAP2
|
|
-#define AT_HWCAP2 26
|
|
+#if defined(__ANDROID__)
|
|
+#include <sys/auxv.h>
|
|
+#elif __has_include(<sys/auxv.h>)
|
|
+#include <sys/auxv.h>
|
|
+#else
|
|
+#define getauxval(x) 0
|
|
#endif
|
|
+#include "../cpu_model/aarch64/hwcap.inc"
|
|
|
|
-#ifndef HWCAP2_SME
|
|
-#define HWCAP2_SME (1 << 23)
|
|
-#endif
|
|
-
|
|
-extern unsigned long int __getauxval (unsigned long int);
|
|
-
|
|
-static _Bool has_sme(void) {
|
|
- return __getauxval(AT_HWCAP2) & HWCAP2_SME;
|
|
-}
|
|
+static _Bool has_sme(void) { return getauxval(AT_HWCAP2) & HWCAP2_SME; }
|
|
|
|
#else // defined(__linux__)
|
|
|