[gcc(refs/users/meissner/heads/work004)] PowerPC test: Add prefixed stack protect test

Michael Meissner meissner@gcc.gnu.org
Mon Jun 22 22:10:13 GMT 2020


https://gcc.gnu.org/g:248fcfd5e965d0c5c940cf9da6f10c783bbe9338

commit 248fcfd5e965d0c5c940cf9da6f10c783bbe9338
Author: Michael Meissner <meissner@linux.ibm.com>
Date:   Mon Jun 22 17:51:51 2020 -0400

    PowerPC test: Add prefixed stack protect test
    
    Test that stack protection generates prefixed stack instructions if you are
    using large stack frame for -mcpu=future.
    
    2020-06-22  Michael Meissner  <meissner@linux.ibm.com>
    
            * gcc.target/powerpc/prefix-stack-protect.c: New test.

Diff:
---
 .../gcc.target/powerpc/prefix-stack-protect.c        | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

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 00000000000..d0d291b0722
--- /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} } } */


More information about the Gcc-cvs mailing list