Skip to contentSkip to conversation

kselftest/arm64: Initialise current at build time in signal tests

PATCH New Mahmoud Adam 1 participant 1 message Nov 6, 2024 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kselftest/arm64: Initialise current at build time in signal tests

From: Mark Brown <[email protected]>

upstream 6e4b4f0eca88e47def703f90a403fef5b96730d5 commit.

When building with clang the toolchain refuses to link the signals testcases since the assembly code has a reference to current which has no initialiser so is placed in the BSS:

/tmp/signals-af2042.o: in function `fake_sigreturn':
<unknown>:51:(.text+0x40): relocation truncated to fit: R_AARCH64_LD_PREL_LO19 against symbol `current' defined in .bss section in /tmp/test_signals-ec1160.o

Since the first statement in main() initialises current we may as well fix this by moving the initialisation to build time so the variable doesn't end up in the BSS.

---
since 6.1.113 we see these compilations issues reported in the patch description, this upstream patch fixes the issue, and it's a clean backport.

 tools/testing/selftests/arm64/signal/test_signals.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
tools/testing/selftests/arm64/signal/test_signals.c +1 -3
index 416b1ff431998..00051b40d71ea 100644
@@ -12,12 +12,10 @@
 #include "test_signals.h"
 #include "test_signals_utils.h"
 
-struct tdescr *current;
+struct tdescr *current = &tde;
 
 int main(int argc, char *argv[])
 {
-	current = &tde;
-
 	ksft_print_msg("%s :: %s\n", current->name, current->descr);
 	if (test_setup(current) && test_init(current)) {
 		test_run(current);
Signature · 1 line
2.40.1