Message ID | 1591041222-24243-8-git-send-email-meissner@linux.ibm.com |
---|---|
State | New |
Headers | show |
Series | [1/7] PowerPC tests: Add prefixed/pcrel tests. | expand |
Hi! On Mon, Jun 01, 2020 at 03:53:42PM -0400, Michael Meissner wrote: > Test that stack protection generates prefixed stack instructions if you are > using large stack frame for -mcpu=future. > > 2020-06-01 Michael Meissner <meissner@linux.ibm.com> > > * gcc.target/powerpc/prefix-stack-protect.c: New test. > +/* { dg-do compile } */ > +/* { dg-require-effective-target powerpc_prefixed_addr } */ Is this test necessary anymore, does -mcpu=power10 not guarantee that? Okay for trunk with that looked at. Thanks! Segher
On Thu, Jun 25, 2020 at 12:18:42PM -0500, Segher Boessenkool wrote: > Hi! > > On Mon, Jun 01, 2020 at 03:53:42PM -0400, Michael Meissner wrote: > > Test that stack protection generates prefixed stack instructions if you are > > using large stack frame for -mcpu=future. > > > > 2020-06-01 Michael Meissner <meissner@linux.ibm.com> > > > > * gcc.target/powerpc/prefix-stack-protect.c: New test. > > > +/* { dg-do compile } */ > > +/* { dg-require-effective-target powerpc_prefixed_addr } */ > > Is this test necessary anymore, does -mcpu=power10 not guarantee that? I believe the test is necessary to prevent regressions. As I said in the test, we stumbled on this problem when building GLIBC with -mcpu=future/power10. > Okay for trunk with that looked at. Thanks!
On Sat, Jun 27, 2020 at 01:50:48AM -0400, Michael Meissner wrote: > On Thu, Jun 25, 2020 at 12:18:42PM -0500, Segher Boessenkool wrote: > > > +/* { dg-do compile } */ > > > +/* { dg-require-effective-target powerpc_prefixed_addr } */ > > > > Is this test necessary anymore, does -mcpu=power10 not guarantee that? > > I believe the test is necessary to prevent regressions. As I said in the test, > we stumbled on this problem when building GLIBC with -mcpu=future/power10. We now have /* Enable -mprefixed by default on power10 systems. */ if (TARGET_POWER10 && (rs6000_isa_flags_explicit & OPTION_MASK_PREFIXED) == 0) rs6000_isa_flags |= OPTION_MASK_PREFIXED; so the testsuite can just assume it is enabled on all targets it is supported for at all. (The selector doesn't directly *hurt* of course, but it leads to cargo- culting, future tests using this unneeded selector as well). Segher
diff --git a/gcc/testsuite/gcc.target/powerpc/prefix-stack-protect.c b/gcc/testsuite/gcc.target/powerpc/prefix-stack-protect.c new file mode 100644 index 0000000..d0d291b --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/prefix-stack-protect.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_prefixed_addr } */ +/* { dg-options "-O2 -mdejagnu-cpu=future -fstack-protector-strong" } */ + +/* Test that we can handle large stack frames with -fstack-protector-strong and + prefixed addressing. This was originally discovered when trying to build + glibc with -mcpu=future, and vfwprintf.c failed because it used + -fstack-protector-strong. */ + +extern long foo (char *); + +long +bar (void) +{ + char buffer[0x20000]; + return foo (buffer) + 1; +} + +/* { dg-final { scan-assembler {\mpld\M} } } */ +/* { dg-final { scan-assembler {\mpstd\M} } } */