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
This commit is contained in:
Tamar Christina 2018-10-01 13:05:30 +00:00 committed by Tamar Christina
parent fbe9af5042
commit c98f502f0a
10 changed files with 30 additions and 10 deletions

View File

@ -1,3 +1,19 @@
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

View File

@ -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;

View File

@ -1,3 +1,4 @@
/* { dg-skip-if "AArch64 does not support these bounds." { aarch64*-*-* } { "--param stack-clash-protection-*" } } */
/*-------------------------------------------------------------*/
/*--- Block sorting machinery ---*/

View File

@ -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;}

View File

@ -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*-*-* } } } } */

View File

@ -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.

View File

@ -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"

View File

@ -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);
}

View File

@ -1,4 +1,4 @@
/* { dg-options "-O" } */
/* { dg-options "-O -fno-stack-clash-protection" } */
int foo (void *);

View File

@ -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