https://github.com/kraj updated https://github.com/llvm/llvm-project/pull/138077
>From 399e475a17022e6806803ddb7e83599403ffb53d Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.k...@gmail.com> Date: Wed, 30 Apr 2025 19:51:19 -0700 Subject: [PATCH] libunwind: Do not use __attribute__((target("gcs"))) with non-clang compilers This attribute is unsupported in GCC, so far it worked because before GCC15 did not define this macros in _CHKFEAT_GCS in arm_acle.h [1] With gcc15 compiler libunwind's check for this macros is succeeding and it ends up enabling 'gcs' by using function attribute, this works with clang but not with gcc. We can see this in rust compiler bootstrap for aarch64/musl when system uses gcc15, it ends up with these errors Building libunwind.a for aarch64-poky-linux-musl cargo:warning=/mnt/b/yoe/master/sources/poky/build/tmp/work/cortexa57-poky-linux-musl/rust/1.85.1/rustc-1.85.1-src/src/llvm-project/libunwind/src/UnwindLevel1.c:191:1: error: arch extension 'gcs' should be prefixed by '+' cargo:warning= 191 | unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *exception_object) { cargo:warning= | ^~~~~~~~~~~~~ cargo:warning=/mnt/b/yoe/master/sources/poky/build/tmp/work/cortexa57-poky-linux-musl/rust/1.85.1/rustc-1.85.1-src/src/llvm-project/libunwind/src/UnwindLevel1.c:337:22: error: arch extension 'gcs' should be prefixed by '+' cargo:warning= 337 | _Unwind_Stop_Fn stop, void *stop_parameter) { cargo:warning= | ^~~~~~~~~~~~~~~ [1] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=5a6af707f0af Signed-off-by: Khem Raj <raj.k...@gmail.com> --- libunwind/src/shadow_stack_unwind.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libunwind/src/shadow_stack_unwind.h b/libunwind/src/shadow_stack_unwind.h index 1f229d8317116..72939fea86eaf 100644 --- a/libunwind/src/shadow_stack_unwind.h +++ b/libunwind/src/shadow_stack_unwind.h @@ -42,7 +42,8 @@ #include <arm_acle.h> // We can only use GCS if arm_acle.h defines the GCS intrinsics. -#ifdef _CHKFEAT_GCS +// it uses attribute 'gcs' in source which does not work with gcc +#if defined(_CHKFEAT_GCS) && defined(__clang__) #define _LIBUNWIND_USE_GCS 1 #endif _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits