Skip to content

Commit 10a3323

Browse files
author
Christophe Lyon
committed
testsuite: Fix gcc.target/arm/stack-protector-1.c for Cortex-M
The stack-protector-1.c test fails when compiled for Cortex-M: - for Cortex-M0/M1, str r0, [sp #-8]! is not supported - for Cortex-M3/M4..., the assembler complains that "use of r13 is deprecated" This patch replaces the str instruction with sub sp, sp, gcc-mirror#8 str r0, [sp] and removes the check for r13, which is unlikely to leak the canary value. 2020-08-11 Christophe Lyon <[email protected]> gcc/testsuite/ * gcc.target/arm/stack-protector-1.c: Adapt code to Cortex-M restrictions. (cherry picked from commit 6606fdc)
1 parent 3466b22 commit 10a3323

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gcc/testsuite/gcc.target/arm/stack-protector-1.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ asm (
3434
" .type main, %function\n"
3535
"main:\n"
3636
" bl get_ptr\n"
37-
" str r0, [sp, #-8]!\n"
37+
" sub sp, sp, #8\n"
38+
" str r0, [sp]\n"
3839
" bl f\n"
3940
" str r0, [sp, #4]\n"
4041
" ldr r0, [sp]\n"
@@ -51,7 +52,6 @@ asm (
5152
CHECK (r10)
5253
CHECK (r11)
5354
CHECK (r12)
54-
CHECK (r13)
5555
CHECK (r14)
5656
" ldr r1, [sp, #4]\n"
5757
CHECK (r1)

0 commit comments

Comments
 (0)