]> gcc.gnu.org Git - gcc.git/commitdiff
testsuite: 'b' instruction can't do long enough jumps
authorTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Mon, 19 Sep 2022 16:18:58 +0000 (18:18 +0200)
committerTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Wed, 5 Oct 2022 09:57:49 +0000 (11:57 +0200)
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 <yvan.roux@foss.st.com>
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
gcc/testsuite/gcc.target/arm/stack-protector-1.c
gcc/testsuite/gcc.target/arm/stack-protector-3.c

index 8d28b0a847c20ed2edb0317f23963abcfe23668b..3f0ffc9c3f319d566b1a51d635bbd799e2784e58 100644 (file)
@@ -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"
 );
index b8f77fa2309086f1ed91563775ed358f47189952..2f710529b8ff178b514d4d1f5fdcfa1f9dad5036 100644 (file)
@@ -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"
 );
 
This page took 0.070349 seconds and 5 git commands to generate.