diff mbox series

V12 patch #12 of 14, Add test for -fstack-protect-strong with large stack sizes and -mcpu=future

Message ID 20200110010610.GL30103@ibm-toto.the-meissners.org
State New
Headers show
Series V12 patch #12 of 14, Add test for -fstack-protect-strong with large stack sizes and -mcpu=future | expand

Commit Message

Michael Meissner Jan. 10, 2020, 1:06 a.m. UTC
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  <meissner@linux.ibm.com>

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

Patch

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