https://github.com/hsnaveen2u updated 
https://github.com/llvm/llvm-project/pull/236660

>From 6c1610661c3437768fb1485e909b11a731b8554b Mon Sep 17 00:00:00 2001
From: Naveen <[email protected]>
Date: Wed, 28 Oct 2026 21:50:38 -0700
Subject: [PATCH] [libunwind] Fix -Wunused-function for hasPAuthLR in
 ra_sign_state_lr test

hasPAuthLR() is a static function defined unconditionally in
ra_sign_state_lr.pass.cpp but it is only called from checkHasPAuthLR()
when _LIBUNWIND_HAVE_GETAUXVAL, LIBUNWIND_HAVE_ELF_AUX_INFO or
LIBUNWIND_IS_BAREMETAL is defined. On targets where none of these
macros are set (e.g. embedded AArch64 variants built against picolibc),
the #else branch is taken and hasPAuthLR() is unused causing a
-Werror,-Wunused-function build failure.

Guard hasPAuthLR() with the same preprocessor conditions as its
call-sites so it is only compiled when reachable.

Signed-off-by: Naveen <[email protected]>
---
 libunwind/test/ra_sign_state_lr.pass.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libunwind/test/ra_sign_state_lr.pass.cpp 
b/libunwind/test/ra_sign_state_lr.pass.cpp
index efcdbbbaf820c6..7ba46bc1e1f19f 100644
--- a/libunwind/test/ra_sign_state_lr.pass.cpp
+++ b/libunwind/test/ra_sign_state_lr.pass.cpp
@@ -37,6 +37,8 @@
 // Note: This test requires FEAT_PAuth_LR (and is setup to pass on other
 // targets).
 
+#if defined(_LIBUNWIND_HAVE_GETAUXVAL) ||                                      
\
+    defined(_LIBUNWIND_HAVE_ELF_AUX_INFO) || defined(_LIBUNWIND_IS_BAREMETAL)
 static bool hasPAuthLR() {
   uint64_t isa_r1, isa_r2;
   asm("mrs %0, ID_AA64ISAR1_EL1" : "=r"(isa_r1));
@@ -48,6 +50,7 @@ static bool hasPAuthLR() {
 
   return api == 6 || apa == 6 || apa3 == 6;
 }
+#endif
 
 #if defined(_LIBUNWIND_HAVE_GETAUXVAL)
 static bool checkHasPAuthLR() {

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to