[PATCH] selftests/rseq: Mark variables only some builds read as unused

From: Sasha Levin

Date: Tue Dec 01 2026 - 13:09:10 EST


loop_cnt_1 to loop_cnt_6 are only read by the x86 delay injection
assembly, and verbose, opt_signal and signals_delivered only when
BENCHMARK is not defined. clang 23 warns about them in the other builds:

param_test.c:29:12: warning: variable 'loop_cnt_1' set but not used [-Wunused-but-set-global]
param_test.c:36:24: warning: variable 'verbose' set but not used [-Wunused-but-set-global]

It warns about loop_cnt_1 to loop_cnt_6 on x86 too, as it does not see
the assembly reading them.

Mark them unused, like yield_mod_cnt and nr_abort.

Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
tools/testing/selftests/rseq/param_test.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/tools/testing/selftests/rseq/param_test.c b/tools/testing/selftests/rseq/param_test.c
index e1e98dbabe4bc..d40f60f62c9e9 100644
--- a/tools/testing/selftests/rseq/param_test.c
+++ b/tools/testing/selftests/rseq/param_test.c
@@ -26,22 +26,22 @@ static inline pid_t rseq_gettid(void)
#define NR_INJECT 9
static int loop_cnt[NR_INJECT + 1];

-static int loop_cnt_1 asm("asm_loop_cnt_1") __attribute__((used));
-static int loop_cnt_2 asm("asm_loop_cnt_2") __attribute__((used));
-static int loop_cnt_3 asm("asm_loop_cnt_3") __attribute__((used));
-static int loop_cnt_4 asm("asm_loop_cnt_4") __attribute__((used));
-static int loop_cnt_5 asm("asm_loop_cnt_5") __attribute__((used));
-static int loop_cnt_6 asm("asm_loop_cnt_6") __attribute__((used));
+static int loop_cnt_1 asm("asm_loop_cnt_1") __attribute__((used, unused));
+static int loop_cnt_2 asm("asm_loop_cnt_2") __attribute__((used, unused));
+static int loop_cnt_3 asm("asm_loop_cnt_3") __attribute__((used, unused));
+static int loop_cnt_4 asm("asm_loop_cnt_4") __attribute__((used, unused));
+static int loop_cnt_5 asm("asm_loop_cnt_5") __attribute__((used, unused));
+static int loop_cnt_6 asm("asm_loop_cnt_6") __attribute__((used, unused));

-static int opt_modulo, verbose;
+static int opt_modulo, verbose __attribute__((unused));

-static int opt_yield, opt_signal, opt_sleep,
+static int opt_yield, opt_signal __attribute__((unused)), opt_sleep,
opt_disable_rseq, opt_threads = 200,
opt_disable_mod = 0, opt_test = 's';
static bool opt_rseq_legacy;
static long long opt_reps = 5000;

-static __thread __attribute__((tls_model("initial-exec")))
+static __thread __attribute__((tls_model("initial-exec"), unused))
unsigned int signals_delivered;

#ifndef BENCHMARK
--
2.53.0