From 1a46a0a8b30405ea353a758971634dabeee89eaf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Torbj=C3=B6rn=20SVENSSON?= Date: Mon, 19 Sep 2022 18:18:58 +0200 Subject: [PATCH] testsuite: 'b' instruction can't do long enough jumps MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit After moving the testglue in commit 9d503515cee, the jump to exit and abort is too far for the 'b' instruction on Cortex-M0. As most of the C code would generate a 'bl' instruction instead of a 'b' instruction, lets do the same for the inline assembler. The error seen without this patch: /tmp/cccCRiCl.o: in function `main': stack-protector-1.c:(.text+0x4e): relocation truncated to fit: R_ARM_THM_JUMP11 against symbol `__wrap_exit' defined in .text section in gcc_tg.o stack-protector-1.c:(.text+0x50): relocation truncated to fit: R_ARM_THM_JUMP11 against symbol `__wrap_abort' defined in .text section in gcc_tg.o collect2: error: ld returned 1 exit status gcc/testsuite/ChangeLog: * gcc.target/arm/stack-protector-1.c: Use 'bl' instead of 'b' instruction. * gcc.target/arm/stack-protector-3.c: Likewise. Co-Authored-By: Yvan ROUX Signed-off-by: Torbjörn SVENSSON --- gcc/testsuite/gcc.target/arm/stack-protector-1.c | 4 ++-- gcc/testsuite/gcc.target/arm/stack-protector-3.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/testsuite/gcc.target/arm/stack-protector-1.c b/gcc/testsuite/gcc.target/arm/stack-protector-1.c index 8d28b0a847c2..3f0ffc9c3f31 100644 --- a/gcc/testsuite/gcc.target/arm/stack-protector-1.c +++ b/gcc/testsuite/gcc.target/arm/stack-protector-1.c @@ -56,8 +56,8 @@ asm ( " ldr r1, [sp, #4]\n" CHECK (r1) " mov r0, #0\n" -" b exit\n" +" bl exit\n" "1:\n" -" b abort\n" +" bl abort\n" " .size main, .-main" ); diff --git a/gcc/testsuite/gcc.target/arm/stack-protector-3.c b/gcc/testsuite/gcc.target/arm/stack-protector-3.c index b8f77fa23090..2f710529b8ff 100644 --- a/gcc/testsuite/gcc.target/arm/stack-protector-3.c +++ b/gcc/testsuite/gcc.target/arm/stack-protector-3.c @@ -26,7 +26,7 @@ asm ( " .type __stack_chk_fail, %function\n" "__stack_chk_fail:\n" " movs r0, #0\n" -" b exit\n" +" bl exit\n" " .size __stack_chk_fail, .-__stack_chk_fail" ); -- 2.47.2