diff options
author | Tamar Christina <tamar.christina@arm.com> | 2018-10-01 13:05:30 +0000 |
---|---|---|
committer | Tamar Christina <tnfchris@gcc.gnu.org> | 2018-10-01 13:05:30 +0000 |
commit | c98f502f0ab9e51357665d7afcad724feee6088b (patch) | |
tree | 7e55159b79a8eb4575fbf7cc125f0282901f696e | |
parent | fbe9af5042f7c09bc00c105ef1a30ac7149171e4 (diff) | |
download | gcc-c98f502f0ab9e51357665d7afcad724feee6088b.zip gcc-c98f502f0ab9e51357665d7afcad724feee6088b.tar.gz gcc-c98f502f0ab9e51357665d7afcad724feee6088b.tar.bz2 |
Cleanup the AArch64 testsuite when stack-clash is on.
This patch cleans up the testsuite when a run is done with stack clash
protection turned on.
Concretely this switches off -fstack-clash-protection for a couple of tests:
* assembler scan: some tests are quite fragile in that they check for exact
assembly output, e.g. check for exact amount of sub etc. These won't
match now.
* vla: Some of the ubsan tests negative array indices. Because the arrays weren't
used before the incorrect $sp wouldn't have been used. The correct value is
restored on ret. Now however we probe the $sp which causes a segfault.
* params: When testing the parameters we have to skip these on AArch64 because of our
custom constraints on them. We already test them separately so this isn't a
loss.
Note that the testsuite is not entire clean due to gdb failure caused by alloca with
stack clash. On AArch64 we output an incorrect .loc directive, but this is already the
case with the current implementation in GCC and is a bug unrelated to this patch series.
gcc/testsuite/
PR target/86486
* gcc.dg/pr82788.c: Skip for AArch64.
* gcc.dg/guality/vla-1.c: Turn off stack-clash.
* gcc.target/aarch64/subsp.c: Likewise.
* gcc.dg/params/blocksort-part.c: Skip stack-clash checks
on AArch64.
* gcc.dg/stack-check-10.c: Add AArch64 specific checks.
* gcc.dg/stack-check-12.c: ILP32 fixup.
* gcc.dg/stack-check-5.c: Add AArch64 specific checks.
* gcc.dg/stack-check-6a.c: Skip on AArch64, we don't support this.
* testsuite/lib/target-supports.exp
(check_effective_target_frame_pointer_for_non_leaf): AArch64 does not
require frame pointer for non-leaf functions.
From-SVN: r264754
-rw-r--r-- | gcc/testsuite/ChangeLog | 16 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/ubsan/vla-1.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/params/blocksort-part.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr82788.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/stack-check-10.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/stack-check-5.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/stack-check-6a.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/aarch64/stack-check-12.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/aarch64/subsp.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/lib/target-supports.exp | 4 |
10 files changed, 30 insertions, 10 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0252a1d..e8ba7fc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,22 @@ 2018-10-01 Tamar Christina <tamar.christina@arm.com> PR target/86486 + * gcc.dg/pr82788.c: Skip for AArch64. + * gcc.dg/guality/vla-1.c: Turn off stack-clash. + * gcc.target/aarch64/subsp.c: Likewise. + * gcc.dg/params/blocksort-part.c: Skip stack-clash checks + on AArch64. + * gcc.dg/stack-check-10.c: Add AArch64 specific checks. + * gcc.dg/stack-check-12.c: ILP32 fixup. + * gcc.dg/stack-check-5.c: Add AArch64 specific checks. + * gcc.dg/stack-check-6a.c: Skip on AArch64, we don't support this. + * testsuite/lib/target-supports.exp + (check_effective_target_frame_pointer_for_non_leaf): AArch64 does not + require frame pointer for non-leaf functions. + +2018-10-01 Tamar Christina <tamar.christina@arm.com> + + PR target/86486 * gcc.target/aarch64/stack-check-alloca-1.c: New. * gcc.target/aarch64/stack-check-alloca-10.c: New. * gcc.target/aarch64/stack-check-alloca-2.c: New. diff --git a/gcc/testsuite/c-c++-common/ubsan/vla-1.c b/gcc/testsuite/c-c++-common/ubsan/vla-1.c index 52ade3a..c97465e 100644 --- a/gcc/testsuite/c-c++-common/ubsan/vla-1.c +++ b/gcc/testsuite/c-c++-common/ubsan/vla-1.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-fsanitize=vla-bound -Wall -Wno-unused-variable" } */ +/* { dg-options "-fsanitize=vla-bound -Wall -Wno-unused-variable -fno-stack-clash-protection" } */ typedef long int V; int x = -1; diff --git a/gcc/testsuite/gcc.dg/params/blocksort-part.c b/gcc/testsuite/gcc.dg/params/blocksort-part.c index a9154f2..1e67787 100644 --- a/gcc/testsuite/gcc.dg/params/blocksort-part.c +++ b/gcc/testsuite/gcc.dg/params/blocksort-part.c @@ -1,3 +1,4 @@ +/* { dg-skip-if "AArch64 does not support these bounds." { aarch64*-*-* } { "--param stack-clash-protection-*" } } */ /*-------------------------------------------------------------*/ /*--- Block sorting machinery ---*/ diff --git a/gcc/testsuite/gcc.dg/pr82788.c b/gcc/testsuite/gcc.dg/pr82788.c index a8f628f..41c442f 100644 --- a/gcc/testsuite/gcc.dg/pr82788.c +++ b/gcc/testsuite/gcc.dg/pr82788.c @@ -1,4 +1,5 @@ /* { dg-do run } */ /* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-probe-interval=10 --param stack-clash-protection-guard-size=12" } */ /* { dg-require-effective-target supports_stack_clash_protection } */ +/* { dg-skip-if "AArch64 does not support this interval." { aarch64*-*-* } } */ int main() { int a[1442]; return 0;} diff --git a/gcc/testsuite/gcc.dg/stack-check-10.c b/gcc/testsuite/gcc.dg/stack-check-10.c index a86956a..2f5a090 100644 --- a/gcc/testsuite/gcc.dg/stack-check-10.c +++ b/gcc/testsuite/gcc.dg/stack-check-10.c @@ -39,3 +39,4 @@ f3 (void) need a frame pointer. Otherwise neither should. */ /* { dg-final { scan-rtl-dump-times "Stack clash no frame pointer needed" 2 "pro_and_epilogue" { target { ! frame_pointer_for_non_leaf } } } } */ /* { dg-final { scan-rtl-dump-times "Stack clash frame pointer needed" 2 "pro_and_epilogue" { target { frame_pointer_for_non_leaf } } } } */ +/* { dg-final { scan-rtl-dump-times "Stack clash no probe small stack adjustment in prologue" 2 "pro_and_epilogue" { target { aarch64*-*-* } } } } */ diff --git a/gcc/testsuite/gcc.dg/stack-check-5.c b/gcc/testsuite/gcc.dg/stack-check-5.c index 604fa3c..0243147 100644 --- a/gcc/testsuite/gcc.dg/stack-check-5.c +++ b/gcc/testsuite/gcc.dg/stack-check-5.c @@ -66,7 +66,9 @@ f3 (void) /* { dg-final { scan-rtl-dump-times "Stack clash no frame pointer needed" 4 "pro_and_epilogue" { target { ! frame_pointer_for_non_leaf } } } } */ /* { dg-final { scan-rtl-dump-times "Stack clash no frame pointer needed" 2 "pro_and_epilogue" { target { frame_pointer_for_non_leaf } } } } */ /* { dg-final { scan-rtl-dump-times "Stack clash frame pointer needed" 2 "pro_and_epilogue" { target { frame_pointer_for_non_leaf } } } } */ - +/* AArch64 won't require a probe here due to the allocation amount being less than 1KB. */ +/* { dg-final { scan-rtl-dump-times "Stack clash no probe small stack adjustment in prologue" 3 "pro_and_epilogue" { target { aarch64*-*-* } } } } */ +/* { dg-final { scan-rtl-dump-times "Stack clash no probe no stack adjustment in prologue" 1 "pro_and_epilogue" { target { aarch64*-*-* } } } } */ /* We have selected the size of the array in f2/f3 to be large enough to not live in the red zone on targets that support it. diff --git a/gcc/testsuite/gcc.dg/stack-check-6a.c b/gcc/testsuite/gcc.dg/stack-check-6a.c index 8fb9c62..68dd9bc 100644 --- a/gcc/testsuite/gcc.dg/stack-check-6a.c +++ b/gcc/testsuite/gcc.dg/stack-check-6a.c @@ -5,6 +5,7 @@ /* { dg-options "-O2 -fstack-clash-protection -fdump-rtl-pro_and_epilogue -fno-optimize-sibling-calls --param stack-clash-protection-probe-interval=12 --param stack-clash-protection-guard-size=16" } */ /* { dg-require-effective-target supports_stack_clash_protection } */ /* { dg-skip-if "" { *-*-* } { "-fstack-protector*" } { "" } } */ +/* { dg-skip-if "" { aarch64*-*-* } } */ #include "stack-check-6.c" diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-12.c b/gcc/testsuite/gcc.target/aarch64/stack-check-12.c index 4e3abcb..be5a57a 100644 --- a/gcc/testsuite/gcc.target/aarch64/stack-check-12.c +++ b/gcc/testsuite/gcc.target/aarch64/stack-check-12.c @@ -2,12 +2,14 @@ /* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16 -fno-asynchronous-unwind-tables -fno-unwind-tables" } */ /* { dg-require-effective-target supports_stack_clash_protection } */ -extern void arf (unsigned long int *, unsigned long int *); +typedef unsigned __attribute__((mode(DI))) uint64_t; + +extern void arf (uint64_t *, uint64_t *); void frob () { - unsigned long int num[10000]; - unsigned long int den[10000]; + uint64_t num[10000]; + uint64_t den[10000]; arf (den, num); } diff --git a/gcc/testsuite/gcc.target/aarch64/subsp.c b/gcc/testsuite/gcc.target/aarch64/subsp.c index 70d848c..6ef6b2c 100644 --- a/gcc/testsuite/gcc.target/aarch64/subsp.c +++ b/gcc/testsuite/gcc.target/aarch64/subsp.c @@ -1,4 +1,4 @@ -/* { dg-options "-O" } */ +/* { dg-options "-O -fno-stack-clash-protection" } */ int foo (void *); diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index d741583..b82c332 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -8396,10 +8396,6 @@ proc check_effective_target_supports_stack_clash_protection { } { # Return 1 if the target creates a frame pointer for non-leaf functions # Note we ignore cases where we apply tail call optimization here. proc check_effective_target_frame_pointer_for_non_leaf { } { - if { [istarget aarch*-*-*] } { - return 1 - } - # Solaris/x86 defaults to -fno-omit-frame-pointer. if { [istarget i?86-*-solaris*] || [istarget x86_64-*-solaris*] } { return 1 |