[PATCH] arm: Add a couple of extra stack-protector tests

Richard Sandiford richard.sandiford@arm.com
Tue Oct 13 13:51:20 GMT 2020


Christophe Lyon <christophe.lyon@linaro.org> writes:
> On Wed, 23 Sep 2020 at 20:33, Richard Sandiford
> <richard.sandiford@arm.com> wrote:
>>
>> These tests were inspired by the corresponding aarch64 ones that I just
>> committed.  They already pass.
>>
>> Tested on arm-linux-gnueabi, arm-linux-gnueabihf and armeb-eabi.
>> OK for trunk?
>>
>> Richard
>>
>>
>> gcc/testsuite/
>>         * gcc.target/arm/stack-protector-5.c: New test.
>>         * gcc.target/arm/stack-protector-6.c: Likewise.
>> ---
>
> Hi Richard,
>
> These new tests fail when compiling for cortex-a15 and cortex-a57...
> There are 2 "str" instructions generated, the code is much longer than
> for cortex-a9 for instance.
>
> They pass with cortex-a9, cortex-a5 and arm10tdmi.

Gah, thanks for the heads-up.  I've applied the below as obvious
after testing on arm-linux-gnueabihf and armeb-eabi.

Richard

-------------- next part --------------
>From f694a0d2edc025cb54657cb804960f97a31fbda2 Mon Sep 17 00:00:00 2001
From: Richard Sandiford <richard.sandiford@arm.com>
Date: Tue, 13 Oct 2020 14:50:24 +0100
Subject: [PATCH] [arm] Use -Os for stack-protector-[56].c tests

Using -O2 made the tests subject to LDRD vs. LDM tuning.
The simplest fix seems to be to use -Os, so that LDM is
unequivocally a win.

gcc/testsuite/
	* gcc.target/arm/stack-protector-5.c: Use -Os rather than -O2.
	* gcc.target/arm/stack-protector-6.c: Likewise.
---
 gcc/testsuite/gcc.target/arm/stack-protector-5.c | 2 +-
 gcc/testsuite/gcc.target/arm/stack-protector-6.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/gcc.target/arm/stack-protector-5.c b/gcc/testsuite/gcc.target/arm/stack-protector-5.c
index b808b11aa3d..ae70b99efc4 100644
--- a/gcc/testsuite/gcc.target/arm/stack-protector-5.c
+++ b/gcc/testsuite/gcc.target/arm/stack-protector-5.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-fstack-protector-all -O2" } */
+/* { dg-options "-fstack-protector-all -Os" } */
 
 void __attribute__ ((noipa))
 f (void)
diff --git a/gcc/testsuite/gcc.target/arm/stack-protector-6.c b/gcc/testsuite/gcc.target/arm/stack-protector-6.c
index f8eec878bd6..2b7e6f72ea0 100644
--- a/gcc/testsuite/gcc.target/arm/stack-protector-6.c
+++ b/gcc/testsuite/gcc.target/arm/stack-protector-6.c
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target fpic } */
-/* { dg-options "-fstack-protector-all -O2 -fpic" } */
+/* { dg-options "-fstack-protector-all -Os -fpic" } */
 
 #include "stack-protector-5.c"
 
-- 
2.17.1



More information about the Gcc-patches mailing list