[PATCH 6/6] Backport power10 prefix stack protect test.

Michael Meissner meissner@linux.ibm.com
Tue Aug 4 06:04:14 GMT 2020


Backport power10 prefix stack protect test.

This test makes sure whether large stack frames can be handled if the
-fstack-protector-stron option was used.  This bug was noticed when we tried to
build GLIBC for the power10.  This test has been on the master branch since
June, and not changes were needed to backport it to GCC 10.  Can I check this
into the GCC 10 branch?

gcc/testsuite/
2020-08-03  Michael Meissner  <meissner@linux.ibm.com>

	Backport from the master branch:
	2020-06-27  Michael Meissner  <meissner@linux.ibm.com>

	* gcc.target/powerpc/prefix-stack-protect.c: New test.

---
 .../gcc.target/powerpc/prefix-stack-protect.c       | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/powerpc/prefix-stack-protect.c

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..ca3b3df
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/prefix-stack-protect.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_prefixed_addr } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10 -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=power10, and vfwprintf.c failed because it used
+   -fstack-protector-strong.  It needs 64-bit due to the size of the stack.  */
+
+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} } } */
-- 
1.8.3.1


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


More information about the Gcc-patches mailing list