This patch is the same as:
https://gcc.gnu.org/ml/gcc-patches/2019-12/msg01503.html

This patch adds a new test to test that -fstack-protect-strong generates the
correct code when a large stack is used and the compiler option -mcpu=future is
also used.  Can I check this into the trunk?

This is a bug that we discovered when we attempted to build glibc using the
-mcpu=future option.

2020-01-09  Michael Meissner  <meiss...@linux.ibm.com>

        * gcc.target/powerpc/prefix-stack-protect.c: New test to make sure
        -fstack-protect-strong works with prefixed addressing.

Index: gcc/testsuite/gcc.target/powerpc/prefix-stack-protect.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/prefix-stack-protect.c     (revision 
280088)
+++ gcc/testsuite/gcc.target/powerpc/prefix-stack-protect.c     (working copy)
@@ -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 in 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} } } */

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meiss...@linux.ibm.com, phone: +1 (978) 899-4797

Reply via email to