aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorAlexandre Oliva <oliva@adacore.com>2023-12-07 12:58:20 -0300
committerAlexandre Oliva <oliva@gnu.org>2023-12-07 12:58:20 -0300
commitf908368d2cb50b26c4557df6b37bc13a3723ef49 (patch)
tree55e731d0ec6fbd367e892aedc035f4847bf00674 /gcc/testsuite
parentd36cac18724a63b1dbcbe722015232c72214ce93 (diff)
downloadgcc-f908368d2cb50b26c4557df6b37bc13a3723ef49.zip
gcc-f908368d2cb50b26c4557df6b37bc13a3723ef49.tar.gz
gcc-f908368d2cb50b26c4557df6b37bc13a3723ef49.tar.bz2
strub: enable conditional support
Targets that don't expose callee stacks to callers, such as nvptx, as well as -fsplit-stack compilations, violate fundamental assumptions of the current strub implementation. This patch enables targets to disable strub, and disables it when -fsplit-stack is enabled. When strub support is disabled, the testsuite will now skip strub tests, and libgcc will not build the strub runtime components. for gcc/ChangeLog * target.def (have_strub_support_for): New hook. * doc/tm.texi.in: Document it. * doc/tm.texi: Rebuild. * ipa-strub.cc: Include target.h. (strub_target_support_p): New. (can_strub_p): Call it. Test for no flag_split_stack. (pass_ipa_strub::adjust_at_calls_call): Check for target support. * config/nvptx/nvptx.cc (TARGET_HAVE_STRUB_SUPPORT_FOR): Disable. * doc/sourcebuild.texi (strub): Document new effective target. for gcc/testsuite/ChangeLog * c-c++-common/strub-split-stack.c: New. * c-c++-common/strub-unsupported.c: New. * c-c++-common/strub-unsupported-2.c: New. * c-c++-common/strub-unsupported-3.c: New. * lib/target-supports.exp (check_effective_target_strub): New. * c-c++-common/strub-O0.c: Require effective target strub. * c-c++-common/strub-O1.c: Likewise. * c-c++-common/strub-O2.c: Likewise. * c-c++-common/strub-O2fni.c: Likewise. * c-c++-common/strub-O3.c: Likewise. * c-c++-common/strub-O3fni.c: Likewise. * c-c++-common/strub-Og.c: Likewise. * c-c++-common/strub-Os.c: Likewise. * c-c++-common/strub-all1.c: Likewise. * c-c++-common/strub-all2.c: Likewise. * c-c++-common/strub-apply1.c: Likewise. * c-c++-common/strub-apply2.c: Likewise. * c-c++-common/strub-apply3.c: Likewise. * c-c++-common/strub-apply4.c: Likewise. * c-c++-common/strub-at-calls1.c: Likewise. * c-c++-common/strub-at-calls2.c: Likewise. * c-c++-common/strub-defer-O1.c: Likewise. * c-c++-common/strub-defer-O2.c: Likewise. * c-c++-common/strub-defer-O3.c: Likewise. * c-c++-common/strub-defer-Os.c: Likewise. * c-c++-common/strub-internal1.c: Likewise. * c-c++-common/strub-internal2.c: Likewise. * c-c++-common/strub-parms1.c: Likewise. * c-c++-common/strub-parms2.c: Likewise. * c-c++-common/strub-parms3.c: Likewise. * c-c++-common/strub-relaxed1.c: Likewise. * c-c++-common/strub-relaxed2.c: Likewise. * c-c++-common/strub-short-O0-exc.c: Likewise. * c-c++-common/strub-short-O0.c: Likewise. * c-c++-common/strub-short-O1.c: Likewise. * c-c++-common/strub-short-O2.c: Likewise. * c-c++-common/strub-short-O3.c: Likewise. * c-c++-common/strub-short-Os.c: Likewise. * c-c++-common/strub-strict1.c: Likewise. * c-c++-common/strub-strict2.c: Likewise. * c-c++-common/strub-tail-O1.c: Likewise. * c-c++-common/strub-tail-O2.c: Likewise. * c-c++-common/strub-var1.c: Likewise. * c-c++-common/torture/strub-callable1.c: Likewise. * c-c++-common/torture/strub-callable2.c: Likewise. * c-c++-common/torture/strub-const1.c: Likewise. * c-c++-common/torture/strub-const2.c: Likewise. * c-c++-common/torture/strub-const3.c: Likewise. * c-c++-common/torture/strub-const4.c: Likewise. * c-c++-common/torture/strub-data1.c: Likewise. * c-c++-common/torture/strub-data2.c: Likewise. * c-c++-common/torture/strub-data3.c: Likewise. * c-c++-common/torture/strub-data4.c: Likewise. * c-c++-common/torture/strub-data5.c: Likewise. * c-c++-common/torture/strub-indcall1.c: Likewise. * c-c++-common/torture/strub-indcall2.c: Likewise. * c-c++-common/torture/strub-indcall3.c: Likewise. * c-c++-common/torture/strub-inlinable1.c: Likewise. * c-c++-common/torture/strub-inlinable2.c: Likewise. * c-c++-common/torture/strub-ptrfn1.c: Likewise. * c-c++-common/torture/strub-ptrfn2.c: Likewise. * c-c++-common/torture/strub-ptrfn3.c: Likewise. * c-c++-common/torture/strub-ptrfn4.c: Likewise. * c-c++-common/torture/strub-pure1.c: Likewise. * c-c++-common/torture/strub-pure2.c: Likewise. * c-c++-common/torture/strub-pure3.c: Likewise. * c-c++-common/torture/strub-pure4.c: Likewise. * c-c++-common/torture/strub-run1.c: Likewise. * c-c++-common/torture/strub-run2.c: Likewise. * c-c++-common/torture/strub-run3.c: Likewise. * c-c++-common/torture/strub-run4.c: Likewise. * c-c++-common/torture/strub-run4c.c: Likewise. * c-c++-common/torture/strub-run4d.c: Likewise. * c-c++-common/torture/strub-run4i.c: Likewise. * g++.dg/strub-run1.C: Likewise. * g++.dg/torture/strub-init1.C: Likewise. * g++.dg/torture/strub-init2.C: Likewise. * g++.dg/torture/strub-init3.C: Likewise. * gnat.dg/strub_attr.adb: Likewise. * gnat.dg/strub_ind.adb: Likewise. * gnat.dg/strub_access.adb: Likewise. * gnat.dg/strub_access1.adb: Likewise. * gnat.dg/strub_disp.adb: Likewise. * gnat.dg/strub_disp1.adb: Likewise. * gnat.dg/strub_ind1.adb: Likewise. * gnat.dg/strub_ind2.adb: Likewise. * gnat.dg/strub_intf.adb: Likewise. * gnat.dg/strub_intf1.adb: Likewise. * gnat.dg/strub_intf2.adb: Likewise. * gnat.dg/strub_renm.adb: Likewise. * gnat.dg/strub_renm1.adb: Likewise. * gnat.dg/strub_renm2.adb: Likewise. * gnat.dg/strub_var.adb: Likewise. * gnat.dg/strub_var1.adb: Likewise. for libgcc/ChangeLog * configure.ac: Check for strub support. * configure: Rebuilt. * Makefile.in: Compile strub.c conditionally.
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/c-c++-common/strub-O0.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-O1.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-O2.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-O2fni.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-O3.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-O3fni.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-Og.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-Os.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-all1.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-all2.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-apply1.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-apply2.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-apply3.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-apply4.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-at-calls1.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-at-calls2.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-defer-O1.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-defer-O2.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-defer-O3.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-defer-Os.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-internal1.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-internal2.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-parms1.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-parms2.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-parms3.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-relaxed1.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-relaxed2.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-short-O0-exc.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-short-O0.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-short-O1.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-short-O2.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-short-O3.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-short-Os.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-split-stack.c10
-rw-r--r--gcc/testsuite/c-c++-common/strub-strict1.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-strict2.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-tail-O1.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-tail-O2.c1
-rw-r--r--gcc/testsuite/c-c++-common/strub-unsupported-2.c13
-rw-r--r--gcc/testsuite/c-c++-common/strub-unsupported-3.c18
-rw-r--r--gcc/testsuite/c-c++-common/strub-unsupported.c21
-rw-r--r--gcc/testsuite/c-c++-common/strub-var1.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-callable1.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-callable2.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-const1.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-const2.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-const3.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-const4.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-data1.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-data2.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-data3.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-data4.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-data5.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-indcall1.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-indcall2.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-indcall3.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-inlinable1.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-inlinable2.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-ptrfn1.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-ptrfn2.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-ptrfn3.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-ptrfn4.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-pure1.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-pure2.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-pure3.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-pure4.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-run1.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-run2.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-run3.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-run4.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-run4c.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-run4d.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/strub-run4i.c1
-rw-r--r--gcc/testsuite/g++.dg/strub-run1.C1
-rw-r--r--gcc/testsuite/g++.dg/torture/strub-init1.C1
-rw-r--r--gcc/testsuite/g++.dg/torture/strub-init2.C1
-rw-r--r--gcc/testsuite/g++.dg/torture/strub-init3.C1
-rw-r--r--gcc/testsuite/gnat.dg/strub_access.adb1
-rw-r--r--gcc/testsuite/gnat.dg/strub_access1.adb1
-rw-r--r--gcc/testsuite/gnat.dg/strub_attr.adb1
-rw-r--r--gcc/testsuite/gnat.dg/strub_disp.adb1
-rw-r--r--gcc/testsuite/gnat.dg/strub_disp1.adb1
-rw-r--r--gcc/testsuite/gnat.dg/strub_ind.adb1
-rw-r--r--gcc/testsuite/gnat.dg/strub_ind1.adb1
-rw-r--r--gcc/testsuite/gnat.dg/strub_ind2.adb1
-rw-r--r--gcc/testsuite/gnat.dg/strub_intf.adb1
-rw-r--r--gcc/testsuite/gnat.dg/strub_intf1.adb1
-rw-r--r--gcc/testsuite/gnat.dg/strub_intf2.adb1
-rw-r--r--gcc/testsuite/gnat.dg/strub_renm.adb1
-rw-r--r--gcc/testsuite/gnat.dg/strub_renm1.adb1
-rw-r--r--gcc/testsuite/gnat.dg/strub_renm2.adb1
-rw-r--r--gcc/testsuite/gnat.dg/strub_var.adb1
-rw-r--r--gcc/testsuite/gnat.dg/strub_var1.adb1
-rw-r--r--gcc/testsuite/lib/target-supports.exp7
94 files changed, 158 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/strub-O0.c b/gcc/testsuite/c-c++-common/strub-O0.c
index c7a79a6..f0a3f7b 100644
--- a/gcc/testsuite/c-c++-common/strub-O0.c
+++ b/gcc/testsuite/c-c++-common/strub-O0.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O0 -fstrub=strict -fdump-rtl-expand" } */
+/* { dg-require-effective-target strub } */
/* At -O0, none of the strub builtins are expanded inline. */
diff --git a/gcc/testsuite/c-c++-common/strub-O1.c b/gcc/testsuite/c-c++-common/strub-O1.c
index 96285c9..50403426 100644
--- a/gcc/testsuite/c-c++-common/strub-O1.c
+++ b/gcc/testsuite/c-c++-common/strub-O1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O1 -fstrub=strict -fdump-rtl-expand" } */
+/* { dg-require-effective-target strub } */
/* At -O1, without -fno-inline, we fully expand enter, but neither update nor
leave. */
diff --git a/gcc/testsuite/c-c++-common/strub-O2.c b/gcc/testsuite/c-c++-common/strub-O2.c
index 8edc0d8..37e0299 100644
--- a/gcc/testsuite/c-c++-common/strub-O2.c
+++ b/gcc/testsuite/c-c++-common/strub-O2.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fstrub=strict -fdump-rtl-expand" } */
+/* { dg-require-effective-target strub } */
/* At -O2, without -fno-inline, we fully expand enter and update, and add a test
around the leave call. */
diff --git a/gcc/testsuite/c-c++-common/strub-O2fni.c b/gcc/testsuite/c-c++-common/strub-O2fni.c
index c6d900c..905e2c6 100644
--- a/gcc/testsuite/c-c++-common/strub-O2fni.c
+++ b/gcc/testsuite/c-c++-common/strub-O2fni.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fstrub=strict -fdump-rtl-expand -fno-inline" } */
+/* { dg-require-effective-target strub } */
/* With -fno-inline, none of the strub builtins are inlined. */
diff --git a/gcc/testsuite/c-c++-common/strub-O3.c b/gcc/testsuite/c-c++-common/strub-O3.c
index 33ee465..3bbf132 100644
--- a/gcc/testsuite/c-c++-common/strub-O3.c
+++ b/gcc/testsuite/c-c++-common/strub-O3.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O3 -fstrub=strict -fdump-rtl-expand" } */
+/* { dg-require-effective-target strub } */
int __attribute__ ((__strub__)) var;
diff --git a/gcc/testsuite/c-c++-common/strub-O3fni.c b/gcc/testsuite/c-c++-common/strub-O3fni.c
index 2936f82..c46fce3 100644
--- a/gcc/testsuite/c-c++-common/strub-O3fni.c
+++ b/gcc/testsuite/c-c++-common/strub-O3fni.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O3 -fstrub=strict -fdump-rtl-expand -fno-inline" } */
+/* { dg-require-effective-target strub } */
/* With -fno-inline, none of the strub builtins are inlined. */
diff --git a/gcc/testsuite/c-c++-common/strub-Og.c b/gcc/testsuite/c-c++-common/strub-Og.c
index 479746e..3b8eb19 100644
--- a/gcc/testsuite/c-c++-common/strub-Og.c
+++ b/gcc/testsuite/c-c++-common/strub-Og.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-Og -fstrub=strict -fdump-rtl-expand" } */
+/* { dg-require-effective-target strub } */
/* At -Og, without -fno-inline, we fully expand enter, but neither update nor
leave. */
diff --git a/gcc/testsuite/c-c++-common/strub-Os.c b/gcc/testsuite/c-c++-common/strub-Os.c
index 2241d4e..8cfb253 100644
--- a/gcc/testsuite/c-c++-common/strub-Os.c
+++ b/gcc/testsuite/c-c++-common/strub-Os.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-Os -fstrub=strict -fdump-rtl-expand" } */
+/* { dg-require-effective-target strub } */
/* At -Os, without -fno-inline, we fully expand enter, and also update. The
expanded update might be larger than a call proper, but argument saving and
diff --git a/gcc/testsuite/c-c++-common/strub-all1.c b/gcc/testsuite/c-c++-common/strub-all1.c
index a322bcc..2037f68 100644
--- a/gcc/testsuite/c-c++-common/strub-all1.c
+++ b/gcc/testsuite/c-c++-common/strub-all1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=all -fdump-ipa-strubm -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* h becomes STRUB_CALLABLE, rather than STRUB_INLINABLE, because of the
strub-enabling -fstrub flag, and gets inlined before pass_ipa_strub. */
diff --git a/gcc/testsuite/c-c++-common/strub-all2.c b/gcc/testsuite/c-c++-common/strub-all2.c
index db60026..c026e7d 100644
--- a/gcc/testsuite/c-c++-common/strub-all2.c
+++ b/gcc/testsuite/c-c++-common/strub-all2.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=all -fdump-ipa-strubm -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* g becomes STRUB_INTERNAL, because of the flag. Without inline, force_output
is set for static non-inline functions when not optimizing, and that keeps
diff --git a/gcc/testsuite/c-c++-common/strub-apply1.c b/gcc/testsuite/c-c++-common/strub-apply1.c
index 2f462ad..3edc89c 100644
--- a/gcc/testsuite/c-c++-common/strub-apply1.c
+++ b/gcc/testsuite/c-c++-common/strub-apply1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict" } */
+/* { dg-require-effective-target strub } */
void __attribute__ ((__strub__ ("callable")))
apply_function (void *args)
diff --git a/gcc/testsuite/c-c++-common/strub-apply2.c b/gcc/testsuite/c-c++-common/strub-apply2.c
index a5d7551..838fc75 100644
--- a/gcc/testsuite/c-c++-common/strub-apply2.c
+++ b/gcc/testsuite/c-c++-common/strub-apply2.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict" } */
+/* { dg-require-effective-target strub } */
extern void __attribute__ ((__strub__))
apply_function (void *args);
diff --git a/gcc/testsuite/c-c++-common/strub-apply3.c b/gcc/testsuite/c-c++-common/strub-apply3.c
index 64422a0..0206e4d 100644
--- a/gcc/testsuite/c-c++-common/strub-apply3.c
+++ b/gcc/testsuite/c-c++-common/strub-apply3.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict" } */
+/* { dg-require-effective-target strub } */
void __attribute__ ((__strub__))
apply_function (void *args)
diff --git a/gcc/testsuite/c-c++-common/strub-apply4.c b/gcc/testsuite/c-c++-common/strub-apply4.c
index 15ffaa0..e825047 100644
--- a/gcc/testsuite/c-c++-common/strub-apply4.c
+++ b/gcc/testsuite/c-c++-common/strub-apply4.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fstrub=strict -fdump-ipa-strubm" } */
+/* { dg-require-effective-target strub } */
/* Check that implicit enabling of strub mode selects internal strub when the
function uses __builtin_apply_args, that prevents the optimization to
diff --git a/gcc/testsuite/c-c++-common/strub-at-calls1.c b/gcc/testsuite/c-c++-common/strub-at-calls1.c
index b70843b..a20acc0 100644
--- a/gcc/testsuite/c-c++-common/strub-at-calls1.c
+++ b/gcc/testsuite/c-c++-common/strub-at-calls1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=at-calls -fdump-ipa-strubm -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* h becomes STRUB_CALLABLE, rather than STRUB_INLINABLE, because of the
strub-enabling -fstrub flag, and gets inlined before pass_ipa_strub. */
diff --git a/gcc/testsuite/c-c++-common/strub-at-calls2.c b/gcc/testsuite/c-c++-common/strub-at-calls2.c
index 97a3988..7915b33 100644
--- a/gcc/testsuite/c-c++-common/strub-at-calls2.c
+++ b/gcc/testsuite/c-c++-common/strub-at-calls2.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=at-calls -fdump-ipa-strubm -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* g does NOT become STRUB_AT_CALLS because it's not viable. Without inline,
force_output is set for static non-inline functions when not optimizing, and
diff --git a/gcc/testsuite/c-c++-common/strub-defer-O1.c b/gcc/testsuite/c-c++-common/strub-defer-O1.c
index 3d73431..3689998 100644
--- a/gcc/testsuite/c-c++-common/strub-defer-O1.c
+++ b/gcc/testsuite/c-c++-common/strub-defer-O1.c
@@ -1,5 +1,6 @@
/* { dg-do run } */
/* { dg-options "-fstrub=strict -O1" } */
+/* { dg-require-effective-target strub } */
/* Check that a strub function called by another strub function does NOT defer
the strubbing to its caller at -O1. */
diff --git a/gcc/testsuite/c-c++-common/strub-defer-O2.c b/gcc/testsuite/c-c++-common/strub-defer-O2.c
index fddf3c7..9e01949 100644
--- a/gcc/testsuite/c-c++-common/strub-defer-O2.c
+++ b/gcc/testsuite/c-c++-common/strub-defer-O2.c
@@ -1,5 +1,6 @@
/* { dg-do run } */
/* { dg-options "-fstrub=strict -O2" } */
+/* { dg-require-effective-target strub } */
/* Check that a strub function called by another strub function does NOT defer
the strubbing to its caller at -O2. */
diff --git a/gcc/testsuite/c-c++-common/strub-defer-O3.c b/gcc/testsuite/c-c++-common/strub-defer-O3.c
index 7ebc65b..40ee8ed 100644
--- a/gcc/testsuite/c-c++-common/strub-defer-O3.c
+++ b/gcc/testsuite/c-c++-common/strub-defer-O3.c
@@ -1,5 +1,6 @@
/* { dg-do run } */
/* { dg-options "-fstrub=strict -O3" } */
+/* { dg-require-effective-target strub } */
/* Check that a strub function called by another strub function defers the
strubbing to its caller at -O3. */
diff --git a/gcc/testsuite/c-c++-common/strub-defer-Os.c b/gcc/testsuite/c-c++-common/strub-defer-Os.c
index fbaf85f..67ea9f0 100644
--- a/gcc/testsuite/c-c++-common/strub-defer-Os.c
+++ b/gcc/testsuite/c-c++-common/strub-defer-Os.c
@@ -1,5 +1,6 @@
/* { dg-do run } */
/* { dg-options "-fstrub=strict -Os" } */
+/* { dg-require-effective-target strub } */
/* Check that a strub function called by another strub function defers the
strubbing to its caller at -Os. */
diff --git a/gcc/testsuite/c-c++-common/strub-internal1.c b/gcc/testsuite/c-c++-common/strub-internal1.c
index e9d7b7b..d172549 100644
--- a/gcc/testsuite/c-c++-common/strub-internal1.c
+++ b/gcc/testsuite/c-c++-common/strub-internal1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=internal -fdump-ipa-strubm -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* h becomes STRUB_CALLABLE, rather than STRUB_INLINABLE, because of the
strub-enabling -fstrub flag, and gets inlined before pass_ipa_strub. */
diff --git a/gcc/testsuite/c-c++-common/strub-internal2.c b/gcc/testsuite/c-c++-common/strub-internal2.c
index 8b8e15a..afc9189 100644
--- a/gcc/testsuite/c-c++-common/strub-internal2.c
+++ b/gcc/testsuite/c-c++-common/strub-internal2.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=internal -fdump-ipa-strubm -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* g becomes STRUB_INTERNAL, because of the flag. */
static void
diff --git a/gcc/testsuite/c-c++-common/strub-parms1.c b/gcc/testsuite/c-c++-common/strub-parms1.c
index 0a4a753..f410b26 100644
--- a/gcc/testsuite/c-c++-common/strub-parms1.c
+++ b/gcc/testsuite/c-c++-common/strub-parms1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
#include <stdarg.h>
diff --git a/gcc/testsuite/c-c++-common/strub-parms2.c b/gcc/testsuite/c-c++-common/strub-parms2.c
index 147171d..6f57211 100644
--- a/gcc/testsuite/c-c++-common/strub-parms2.c
+++ b/gcc/testsuite/c-c++-common/strub-parms2.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
#include <stdarg.h>
diff --git a/gcc/testsuite/c-c++-common/strub-parms3.c b/gcc/testsuite/c-c++-common/strub-parms3.c
index 4e92682..7383fea 100644
--- a/gcc/testsuite/c-c++-common/strub-parms3.c
+++ b/gcc/testsuite/c-c++-common/strub-parms3.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* Check that uses of a strub variable implicitly enables internal strub for
publicly-visible functions, and causes the same transformations to their
diff --git a/gcc/testsuite/c-c++-common/strub-relaxed1.c b/gcc/testsuite/c-c++-common/strub-relaxed1.c
index e2f9d8a..d2b4b52 100644
--- a/gcc/testsuite/c-c++-common/strub-relaxed1.c
+++ b/gcc/testsuite/c-c++-common/strub-relaxed1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=relaxed -fdump-ipa-strubm -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* The difference between relaxed and strict in this case is that we accept the
call from one internal-strub function to another. Without the error,
diff --git a/gcc/testsuite/c-c++-common/strub-relaxed2.c b/gcc/testsuite/c-c++-common/strub-relaxed2.c
index 9847443..9e5a8e7 100644
--- a/gcc/testsuite/c-c++-common/strub-relaxed2.c
+++ b/gcc/testsuite/c-c++-common/strub-relaxed2.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=relaxed -fdump-ipa-strubm -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* The difference between relaxed and strict in this case is that we accept the
call from one internal-strub function to another. */
diff --git a/gcc/testsuite/c-c++-common/strub-short-O0-exc.c b/gcc/testsuite/c-c++-common/strub-short-O0-exc.c
index 1de1534..aaeba2a 100644
--- a/gcc/testsuite/c-c++-common/strub-short-O0-exc.c
+++ b/gcc/testsuite/c-c++-common/strub-short-O0-exc.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O0 -fstrub=strict -fexceptions -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* Check that the expected strub calls are issued. */
diff --git a/gcc/testsuite/c-c++-common/strub-short-O0.c b/gcc/testsuite/c-c++-common/strub-short-O0.c
index f9209c8..30cbdd8 100644
--- a/gcc/testsuite/c-c++-common/strub-short-O0.c
+++ b/gcc/testsuite/c-c++-common/strub-short-O0.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O0 -fstrub=strict -fno-exceptions -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* Check that the expected strub calls are issued. */
diff --git a/gcc/testsuite/c-c++-common/strub-short-O1.c b/gcc/testsuite/c-c++-common/strub-short-O1.c
index bed1dcf..911fdfb 100644
--- a/gcc/testsuite/c-c++-common/strub-short-O1.c
+++ b/gcc/testsuite/c-c++-common/strub-short-O1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O1 -fstrub=strict -fno-exceptions -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* Check that the expected strub calls are issued. */
diff --git a/gcc/testsuite/c-c++-common/strub-short-O2.c b/gcc/testsuite/c-c++-common/strub-short-O2.c
index 6bf0071..9b23ee3 100644
--- a/gcc/testsuite/c-c++-common/strub-short-O2.c
+++ b/gcc/testsuite/c-c++-common/strub-short-O2.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fstrub=strict -fno-exceptions -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* Check that the expected strub calls are issued. */
diff --git a/gcc/testsuite/c-c++-common/strub-short-O3.c b/gcc/testsuite/c-c++-common/strub-short-O3.c
index 4732f51..4b3a8f8 100644
--- a/gcc/testsuite/c-c++-common/strub-short-O3.c
+++ b/gcc/testsuite/c-c++-common/strub-short-O3.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O3 -fstrub=strict -fno-exceptions -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* Check that the expected strub calls are issued. At -O3 and -Os, we omit
enter and leave calls within strub contexts, passing on the enclosing
diff --git a/gcc/testsuite/c-c++-common/strub-short-Os.c b/gcc/testsuite/c-c++-common/strub-short-Os.c
index 8d6424c..3627a24 100644
--- a/gcc/testsuite/c-c++-common/strub-short-Os.c
+++ b/gcc/testsuite/c-c++-common/strub-short-Os.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-Os -fstrub=strict -fno-exceptions -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* Check that the expected strub calls are issued. At -O3 and -Os, we omit
enter and leave calls within strub contexts, passing on the enclosing
diff --git a/gcc/testsuite/c-c++-common/strub-split-stack.c b/gcc/testsuite/c-c++-common/strub-split-stack.c
new file mode 100644
index 0000000..7a030cd
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/strub-split-stack.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-fsplit-stack" } */
+/* { dg-require-effective-target strub } */
+/* { dg-require-effective-target split_stack } */
+
+void __attribute__ ((__strub__))
+f () {} /* { dg-message "not eligible|requested" } */
+
+void __attribute__ ((__strub__ ("internal")))
+g () {} /* { dg-message "not eligible|requested" } */
diff --git a/gcc/testsuite/c-c++-common/strub-strict1.c b/gcc/testsuite/c-c++-common/strub-strict1.c
index 3685224..503eb17 100644
--- a/gcc/testsuite/c-c++-common/strub-strict1.c
+++ b/gcc/testsuite/c-c++-common/strub-strict1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict -fdump-ipa-strubm" } */
+/* { dg-require-effective-target strub } */
static int __attribute__ ((__strub__)) var;
diff --git a/gcc/testsuite/c-c++-common/strub-strict2.c b/gcc/testsuite/c-c++-common/strub-strict2.c
index b4f2888..3bf1aa3 100644
--- a/gcc/testsuite/c-c++-common/strub-strict2.c
+++ b/gcc/testsuite/c-c++-common/strub-strict2.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict -fdump-ipa-strubm" } */
+/* { dg-require-effective-target strub } */
static int __attribute__ ((__strub__)) var;
diff --git a/gcc/testsuite/c-c++-common/strub-tail-O1.c b/gcc/testsuite/c-c++-common/strub-tail-O1.c
index e48e061..ba4b162 100644
--- a/gcc/testsuite/c-c++-common/strub-tail-O1.c
+++ b/gcc/testsuite/c-c++-common/strub-tail-O1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O1 -fstrub=strict -fno-exceptions -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
#include "strub-tail-O2.c"
diff --git a/gcc/testsuite/c-c++-common/strub-tail-O2.c b/gcc/testsuite/c-c++-common/strub-tail-O2.c
index 87cda7a..043813b 100644
--- a/gcc/testsuite/c-c++-common/strub-tail-O2.c
+++ b/gcc/testsuite/c-c++-common/strub-tail-O2.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fstrub=strict -fno-exceptions -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* Check that the expected strub calls are issued.
Tail calls are short-circuited at -O2+. */
diff --git a/gcc/testsuite/c-c++-common/strub-unsupported-2.c b/gcc/testsuite/c-c++-common/strub-unsupported-2.c
new file mode 100644
index 0000000..3586f4f
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/strub-unsupported-2.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+/* Check that, when strub is not supported (so no dg-required-effective-target
+ strub above), we report when pointers to strub functions are called. This
+ cannot be part of strub-unsupported.c because errors in the strub-mode pass
+ prevent the main strub pass, where errors at calls are detected, from
+ running. */
+
+void __attribute__ ((__strub__ ("at-calls"))) (*p) (void);
+
+void m () {
+ p (); /* { dg-message "unsupported" "" { target { ! strub } } } */
+}
diff --git a/gcc/testsuite/c-c++-common/strub-unsupported-3.c b/gcc/testsuite/c-c++-common/strub-unsupported-3.c
new file mode 100644
index 0000000..d6fb4c5
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/strub-unsupported-3.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+
+/* Check that, when strub is not supported (so no dg-required-effective-target
+ strub above), we report when strub functions that are not defined are
+ called. This cannot be part of strub-unsupported-2.c because errors in the
+ strub-mode pass prevent the main strub pass, where errors at calls are
+ detected, from running. */
+
+extern void __attribute__ ((__strub__))
+s (void); /* { dg-message "not eligible|requested" "" { target { ! strub } } } */
+
+extern void __attribute__ ((__strub__ ("internal")))
+t (void); /* { dg-message "not eligible|requested" "" { target { ! strub } } } */
+
+void m () {
+ s ();
+ t ();
+}
diff --git a/gcc/testsuite/c-c++-common/strub-unsupported.c b/gcc/testsuite/c-c++-common/strub-unsupported.c
new file mode 100644
index 0000000..cb5c404
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/strub-unsupported.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+
+/* Check that, when strub is not supported (so no dg-required-effective-target
+ strub above), we report when strub functions are defined, and when they're
+ called in ways that would require changes. */
+
+void __attribute__ ((__strub__))
+f (void) {} /* { dg-message "not eligible|requested" "" { target { ! strub } } } */
+
+void __attribute__ ((__strub__ ("internal")))
+g (void) {} /* { dg-message "not eligible|requested" "" { target { ! strub } } } */
+
+/* This only gets an error when called, see strub-unsupported-2.c. */
+void __attribute__ ((__strub__ ("at-calls"))) (*p) (void);
+
+/* These too, see strub-unsupported-3.c. */
+extern void __attribute__ ((__strub__))
+s (void);
+
+extern void __attribute__ ((__strub__ ("internal")))
+t (void);
diff --git a/gcc/testsuite/c-c++-common/strub-var1.c b/gcc/testsuite/c-c++-common/strub-var1.c
index eb6250f..67014aa 100644
--- a/gcc/testsuite/c-c++-common/strub-var1.c
+++ b/gcc/testsuite/c-c++-common/strub-var1.c
@@ -1,4 +1,5 @@
/* { dg-do compile } */
+/* { dg-require-effective-target strub } */
int __attribute__ ((strub)) x;
float __attribute__ ((strub)) f;
diff --git a/gcc/testsuite/c-c++-common/torture/strub-callable1.c b/gcc/testsuite/c-c++-common/torture/strub-callable1.c
index b5e45ab..86dbee6 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-callable1.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-callable1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict" } */
+/* { dg-require-effective-target strub } */
/* Check that strub and non-strub functions can be called from non-strub
contexts, and that strub and callable functions can be called from strub
diff --git a/gcc/testsuite/c-c++-common/torture/strub-callable2.c b/gcc/testsuite/c-c++-common/torture/strub-callable2.c
index 96aa7fe..9da120f 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-callable2.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-callable2.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict" } */
+/* { dg-require-effective-target strub } */
/* Check that impermissible (cross-strub-context) calls are reported. */
diff --git a/gcc/testsuite/c-c++-common/torture/strub-const1.c b/gcc/testsuite/c-c++-common/torture/strub-const1.c
index 5e956cb..22056713 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-const1.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-const1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* Check that, along with a strub const function call, we issue an asm
statement to make sure the watermark passed to it is held in memory before
diff --git a/gcc/testsuite/c-c++-common/torture/strub-const2.c b/gcc/testsuite/c-c++-common/torture/strub-const2.c
index 73d6502..a105c66 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-const2.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-const2.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* Check that, along with a strub implicitly-const function call, we issue an
asm statement to make sure the watermark passed to it is held in memory
diff --git a/gcc/testsuite/c-c++-common/torture/strub-const3.c b/gcc/testsuite/c-c++-common/torture/strub-const3.c
index 2584f1f..386200c 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-const3.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-const3.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* Check that, along with a strub const wrapping call, we issue an asm statement
to make sure the watermark passed to it is held in memory before the call,
diff --git a/gcc/testsuite/c-c++-common/torture/strub-const4.c b/gcc/testsuite/c-c++-common/torture/strub-const4.c
index d819f54..817e9fa 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-const4.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-const4.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* Check that, along with a strub implicitly-const wrapping call, we issue an
asm statement to make sure the watermark passed to it is held in memory
diff --git a/gcc/testsuite/c-c++-common/torture/strub-data1.c b/gcc/testsuite/c-c++-common/torture/strub-data1.c
index 7c27a2a..132ab63 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-data1.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-data1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* The pointed-to data enables strubbing if accessed. */
int __attribute__ ((__strub__)) var;
diff --git a/gcc/testsuite/c-c++-common/torture/strub-data2.c b/gcc/testsuite/c-c++-common/torture/strub-data2.c
index e66d903..b660702 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-data2.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-data2.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* The pointer itself is a strub variable, enabling internal strubbing when
its value is used. */
diff --git a/gcc/testsuite/c-c++-common/torture/strub-data3.c b/gcc/testsuite/c-c++-common/torture/strub-data3.c
index 5e08e0e..fc44eef 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-data3.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-data3.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* The pointer itself is a strub variable, that would enable internal strubbing
if its value was used. Here, it's only overwritten, so no strub. */
diff --git a/gcc/testsuite/c-c++-common/torture/strub-data4.c b/gcc/testsuite/c-c++-common/torture/strub-data4.c
index a818e7a..85e2f59 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-data4.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-data4.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* The pointer itself is a strub variable, that would enable internal strubbing
if its value was used. Here, it's only overwritten, so no strub. */
diff --git a/gcc/testsuite/c-c++-common/torture/strub-data5.c b/gcc/testsuite/c-c++-common/torture/strub-data5.c
index ddb0b5c..0a5edac 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-data5.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-data5.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict" } */
+/* { dg-require-effective-target strub } */
/* It would be desirable to issue at least warnings for these. */
diff --git a/gcc/testsuite/c-c++-common/torture/strub-indcall1.c b/gcc/testsuite/c-c++-common/torture/strub-indcall1.c
index c165f31..988954e 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-indcall1.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-indcall1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
typedef void __attribute__ ((__strub__)) fntype ();
fntype (*ptr);
diff --git a/gcc/testsuite/c-c++-common/torture/strub-indcall2.c b/gcc/testsuite/c-c++-common/torture/strub-indcall2.c
index 69fcff8..d3ca913 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-indcall2.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-indcall2.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
typedef void __attribute__ ((__strub__)) fntype (int, int);
fntype (*ptr);
diff --git a/gcc/testsuite/c-c++-common/torture/strub-indcall3.c b/gcc/testsuite/c-c++-common/torture/strub-indcall3.c
index ff00622..89b5979 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-indcall3.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-indcall3.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
typedef void __attribute__ ((__strub__)) fntype (int, int, ...);
fntype (*ptr);
diff --git a/gcc/testsuite/c-c++-common/torture/strub-inlinable1.c b/gcc/testsuite/c-c++-common/torture/strub-inlinable1.c
index 614b022..4917dda 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-inlinable1.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-inlinable1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=relaxed" } */
+/* { dg-require-effective-target strub } */
inline void __attribute__ ((strub ("internal"), always_inline))
inl_int_ali (void)
diff --git a/gcc/testsuite/c-c++-common/torture/strub-inlinable2.c b/gcc/testsuite/c-c++-common/torture/strub-inlinable2.c
index f9a6b4a..c459038 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-inlinable2.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-inlinable2.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=all" } */
+/* { dg-require-effective-target strub } */
#include "strub-inlinable1.c"
diff --git a/gcc/testsuite/c-c++-common/torture/strub-ptrfn1.c b/gcc/testsuite/c-c++-common/torture/strub-ptrfn1.c
index b4a7f39..b0d6139 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-ptrfn1.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-ptrfn1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict" } */
+/* { dg-require-effective-target strub } */
typedef void ft (void);
typedef void ft2 (int, int);
diff --git a/gcc/testsuite/c-c++-common/torture/strub-ptrfn2.c b/gcc/testsuite/c-c++-common/torture/strub-ptrfn2.c
index ef634d3..1148c24 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-ptrfn2.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-ptrfn2.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=relaxed -Wpedantic" } */
+/* { dg-require-effective-target strub } */
/* C++ does not warn about the partial incompatibilities.
diff --git a/gcc/testsuite/c-c++-common/torture/strub-ptrfn3.c b/gcc/testsuite/c-c++-common/torture/strub-ptrfn3.c
index e1f179e..06a72d8 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-ptrfn3.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-ptrfn3.c
@@ -1,6 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=relaxed -Wpedantic -fpermissive" } */
/* { dg-prune-output "command-line option .-fpermissive." } */
+/* { dg-require-effective-target strub } */
/* See strub-ptrfn2.c. */
diff --git a/gcc/testsuite/c-c++-common/torture/strub-ptrfn4.c b/gcc/testsuite/c-c++-common/torture/strub-ptrfn4.c
index 70b558a..83ea1af 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-ptrfn4.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-ptrfn4.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=relaxed" } */
+/* { dg-require-effective-target strub } */
/* This is strub-ptrfn2.c without -Wpedantic.
diff --git a/gcc/testsuite/c-c++-common/torture/strub-pure1.c b/gcc/testsuite/c-c++-common/torture/strub-pure1.c
index a262a08..2643136 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-pure1.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-pure1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* Check that, along with a strub pure function call, we issue an asm statement
to make sure the watermark passed to it is not assumed to be unchanged. */
diff --git a/gcc/testsuite/c-c++-common/torture/strub-pure2.c b/gcc/testsuite/c-c++-common/torture/strub-pure2.c
index 4c4bd50..8bda129 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-pure2.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-pure2.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* Check that, along with a strub implicitly-pure function call, we issue an asm
statement to make sure the watermark passed to it is not assumed to be
diff --git a/gcc/testsuite/c-c++-common/torture/strub-pure3.c b/gcc/testsuite/c-c++-common/torture/strub-pure3.c
index ce195c6..00bcbdd 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-pure3.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-pure3.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* Check that, along with a strub pure wrapping call, we issue an asm statement
to make sure the watermark passed to it is not assumed to be unchanged. */
diff --git a/gcc/testsuite/c-c++-common/torture/strub-pure4.c b/gcc/testsuite/c-c++-common/torture/strub-pure4.c
index 75cd54c..ea7c40e 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-pure4.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-pure4.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
+/* { dg-require-effective-target strub } */
/* Check that, along with a strub implicitly-pure wrapping call, we issue an asm
statement to make sure the watermark passed to it is not assumed to be
diff --git a/gcc/testsuite/c-c++-common/torture/strub-run1.c b/gcc/testsuite/c-c++-common/torture/strub-run1.c
index 7458b3f..fdf1004 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-run1.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-run1.c
@@ -1,5 +1,6 @@
/* { dg-do run } */
/* { dg-options "-fstrub=strict" } */
+/* { dg-require-effective-target strub } */
/* Check that a non-strub function leaves a string behind in the stack, and that
equivalent strub functions don't. Avoid the use of red zones by avoiding
diff --git a/gcc/testsuite/c-c++-common/torture/strub-run2.c b/gcc/testsuite/c-c++-common/torture/strub-run2.c
index 5d60a777..1228a66 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-run2.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-run2.c
@@ -1,5 +1,6 @@
/* { dg-do run } */
/* { dg-options "-fstrub=strict" } */
+/* { dg-require-effective-target strub } */
/* Check that a non-strub function leaves a string behind in the stack, and that
equivalent strub functions don't. Allow red zones to be used. */
diff --git a/gcc/testsuite/c-c++-common/torture/strub-run3.c b/gcc/testsuite/c-c++-common/torture/strub-run3.c
index c2ad710..e5047a9 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-run3.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-run3.c
@@ -1,6 +1,7 @@
/* { dg-do run } */
/* { dg-options "-fstrub=strict" } */
/* { dg-require-effective-target alloca } */
+/* { dg-require-effective-target strub } */
/* Check that a non-strub function leaves a string behind in the stack, and that
equivalent strub functions don't. */
diff --git a/gcc/testsuite/c-c++-common/torture/strub-run4.c b/gcc/testsuite/c-c++-common/torture/strub-run4.c
index 3b36b8e..0e84a4b 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-run4.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-run4.c
@@ -1,6 +1,7 @@
/* { dg-do run } */
/* { dg-options "-fstrub=all" } */
/* { dg-require-effective-target alloca } */
+/* { dg-require-effective-target strub } */
/* Check that multi-level, multi-inlined functions still get cleaned up as
expected, without overwriting temporary stack allocations while they should
diff --git a/gcc/testsuite/c-c++-common/torture/strub-run4c.c b/gcc/testsuite/c-c++-common/torture/strub-run4c.c
index 57f9baf..edc9848 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-run4c.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-run4c.c
@@ -1,5 +1,6 @@
/* { dg-do run } */
/* { dg-options "-fstrub=at-calls" } */
/* { dg-require-effective-target alloca } */
+/* { dg-require-effective-target strub } */
#include "strub-run4.c"
diff --git a/gcc/testsuite/c-c++-common/torture/strub-run4d.c b/gcc/testsuite/c-c++-common/torture/strub-run4d.c
index 08de3f1..487ed08 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-run4d.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-run4d.c
@@ -1,6 +1,7 @@
/* { dg-do run } */
/* { dg-options "-fstrub=strict" } */
/* { dg-require-effective-target alloca } */
+/* { dg-require-effective-target strub } */
#define ATTR_STRUB_AT_CALLS __attribute__ ((__strub__ ("at-calls")))
diff --git a/gcc/testsuite/c-c++-common/torture/strub-run4i.c b/gcc/testsuite/c-c++-common/torture/strub-run4i.c
index 459f688..a85447f 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-run4i.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-run4i.c
@@ -1,5 +1,6 @@
/* { dg-do run } */
/* { dg-options "-fstrub=internal" } */
/* { dg-require-effective-target alloca } */
+/* { dg-require-effective-target strub } */
#include "strub-run4.c"
diff --git a/gcc/testsuite/g++.dg/strub-run1.C b/gcc/testsuite/g++.dg/strub-run1.C
index 0d367fb..beb8b81 100644
--- a/gcc/testsuite/g++.dg/strub-run1.C
+++ b/gcc/testsuite/g++.dg/strub-run1.C
@@ -1,5 +1,6 @@
// { dg-do run }
// { dg-options "-fstrub=internal" }
+// { dg-require-effective-target strub }
// Check that we don't get extra copies.
diff --git a/gcc/testsuite/g++.dg/torture/strub-init1.C b/gcc/testsuite/g++.dg/torture/strub-init1.C
index c226ab1..6ae45fa 100644
--- a/gcc/testsuite/g++.dg/torture/strub-init1.C
+++ b/gcc/testsuite/g++.dg/torture/strub-init1.C
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
+// { dg-require-effective-target strub }
extern int __attribute__((__strub__)) initializer ();
diff --git a/gcc/testsuite/g++.dg/torture/strub-init2.C b/gcc/testsuite/g++.dg/torture/strub-init2.C
index a7911f1..8f4849c 100644
--- a/gcc/testsuite/g++.dg/torture/strub-init2.C
+++ b/gcc/testsuite/g++.dg/torture/strub-init2.C
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
+// { dg-require-effective-target strub }
extern int __attribute__((__strub__)) initializer ();
diff --git a/gcc/testsuite/g++.dg/torture/strub-init3.C b/gcc/testsuite/g++.dg/torture/strub-init3.C
index 6ebebcd..14f28e3 100644
--- a/gcc/testsuite/g++.dg/torture/strub-init3.C
+++ b/gcc/testsuite/g++.dg/torture/strub-init3.C
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
+// { dg-require-effective-target strub }
extern int __attribute__((__strub__)) initializer ();
diff --git a/gcc/testsuite/gnat.dg/strub_access.adb b/gcc/testsuite/gnat.dg/strub_access.adb
index 29e6996..488a2d6 100644
--- a/gcc/testsuite/gnat.dg/strub_access.adb
+++ b/gcc/testsuite/gnat.dg/strub_access.adb
@@ -1,5 +1,6 @@
-- { dg-do compile }
-- { dg-options "-fstrub=relaxed -fdump-ipa-strubm" }
+-- { dg-require-effective-target strub }
-- The main subprogram doesn't read from the automatic variable, but
-- being an automatic variable, its presence should be enough for the
diff --git a/gcc/testsuite/gnat.dg/strub_access1.adb b/gcc/testsuite/gnat.dg/strub_access1.adb
index dae4706..4a8653c 100644
--- a/gcc/testsuite/gnat.dg/strub_access1.adb
+++ b/gcc/testsuite/gnat.dg/strub_access1.adb
@@ -1,5 +1,6 @@
-- { dg-do compile }
-- { dg-options "-fstrub=relaxed" }
+-- { dg-require-effective-target strub }
-- Check that we reject 'Access of a strub variable whose type does
-- not carry a strub modifier.
diff --git a/gcc/testsuite/gnat.dg/strub_attr.adb b/gcc/testsuite/gnat.dg/strub_attr.adb
index 10445d7..eb7826d 100644
--- a/gcc/testsuite/gnat.dg/strub_attr.adb
+++ b/gcc/testsuite/gnat.dg/strub_attr.adb
@@ -1,5 +1,6 @@
-- { dg-do compile }
-- { dg-options "-fstrub=strict -fdump-ipa-strubm -fdump-ipa-strub" }
+-- { dg-require-effective-target strub }
package body Strub_Attr is
E : exception;
diff --git a/gcc/testsuite/gnat.dg/strub_disp.adb b/gcc/testsuite/gnat.dg/strub_disp.adb
index 3dbcc4a..f23d467 100644
--- a/gcc/testsuite/gnat.dg/strub_disp.adb
+++ b/gcc/testsuite/gnat.dg/strub_disp.adb
@@ -1,4 +1,5 @@
-- { dg-do compile }
+-- { dg-require-effective-target strub }
procedure Strub_Disp is
package Foo is
diff --git a/gcc/testsuite/gnat.dg/strub_disp1.adb b/gcc/testsuite/gnat.dg/strub_disp1.adb
index 09756a7..9c4c7f6 100644
--- a/gcc/testsuite/gnat.dg/strub_disp1.adb
+++ b/gcc/testsuite/gnat.dg/strub_disp1.adb
@@ -1,5 +1,6 @@
-- { dg-do compile }
-- { dg-options "-fdump-ipa-strub" }
+-- { dg-require-effective-target strub }
-- Check that at-calls dispatching calls are transformed.
diff --git a/gcc/testsuite/gnat.dg/strub_ind.adb b/gcc/testsuite/gnat.dg/strub_ind.adb
index da56aca..613db693 100644
--- a/gcc/testsuite/gnat.dg/strub_ind.adb
+++ b/gcc/testsuite/gnat.dg/strub_ind.adb
@@ -1,5 +1,6 @@
-- { dg-do compile }
-- { dg-options "-fstrub=strict" }
+-- { dg-require-effective-target strub }
-- This is essentially the same test as strub_attr.adb,
-- but applying attributes to access types as well.
diff --git a/gcc/testsuite/gnat.dg/strub_ind1.adb b/gcc/testsuite/gnat.dg/strub_ind1.adb
index 825e395..245b0a8 100644
--- a/gcc/testsuite/gnat.dg/strub_ind1.adb
+++ b/gcc/testsuite/gnat.dg/strub_ind1.adb
@@ -1,5 +1,6 @@
-- { dg-do compile }
-- { dg-options "-fstrub=strict -fdump-ipa-strubm" }
+-- { dg-require-effective-target strub }
-- This is essentially the same test as strub_attr.adb,
-- but with an explicit conversion.
diff --git a/gcc/testsuite/gnat.dg/strub_ind2.adb b/gcc/testsuite/gnat.dg/strub_ind2.adb
index e918b39..b9bfe50 100644
--- a/gcc/testsuite/gnat.dg/strub_ind2.adb
+++ b/gcc/testsuite/gnat.dg/strub_ind2.adb
@@ -1,5 +1,6 @@
-- { dg-do compile }
-- { dg-options "-fstrub=strict" }
+-- { dg-require-effective-target strub }
-- This is essentially the same test as strub_attr.adb,
-- but with an explicit conversion.
diff --git a/gcc/testsuite/gnat.dg/strub_intf.adb b/gcc/testsuite/gnat.dg/strub_intf.adb
index 8f0212a..f438547 100644
--- a/gcc/testsuite/gnat.dg/strub_intf.adb
+++ b/gcc/testsuite/gnat.dg/strub_intf.adb
@@ -1,4 +1,5 @@
-- { dg-do compile }
+-- { dg-require-effective-target strub }
-- Check that strub mode mismatches between overrider and overridden
-- subprograms are reported.
diff --git a/gcc/testsuite/gnat.dg/strub_intf1.adb b/gcc/testsuite/gnat.dg/strub_intf1.adb
index bf77321..7a38a4c 100644
--- a/gcc/testsuite/gnat.dg/strub_intf1.adb
+++ b/gcc/testsuite/gnat.dg/strub_intf1.adb
@@ -1,5 +1,6 @@
-- { dg-do compile }
-- { dg-options "-fdump-ipa-strub" }
+-- { dg-require-effective-target strub }
-- Check that at-calls dispatching calls to interfaces are transformed.
diff --git a/gcc/testsuite/gnat.dg/strub_intf2.adb b/gcc/testsuite/gnat.dg/strub_intf2.adb
index e8880db..7992b73 100644
--- a/gcc/testsuite/gnat.dg/strub_intf2.adb
+++ b/gcc/testsuite/gnat.dg/strub_intf2.adb
@@ -1,4 +1,5 @@
-- { dg-do compile }
+-- { dg-require-effective-target strub }
-- Check that strub mode mismatches between overrider and overridden
-- subprograms are reported even when the overriders for an
diff --git a/gcc/testsuite/gnat.dg/strub_renm.adb b/gcc/testsuite/gnat.dg/strub_renm.adb
index 217367e..abfb120 100644
--- a/gcc/testsuite/gnat.dg/strub_renm.adb
+++ b/gcc/testsuite/gnat.dg/strub_renm.adb
@@ -1,4 +1,5 @@
-- { dg-do compile }
+-- { dg-require-effective-target strub }
procedure Strub_Renm is
procedure P (X : Integer);
diff --git a/gcc/testsuite/gnat.dg/strub_renm1.adb b/gcc/testsuite/gnat.dg/strub_renm1.adb
index a11adbf..68d3230 100644
--- a/gcc/testsuite/gnat.dg/strub_renm1.adb
+++ b/gcc/testsuite/gnat.dg/strub_renm1.adb
@@ -1,5 +1,6 @@
-- { dg-do compile }
-- { dg-options "-fstrub=relaxed -fdump-ipa-strub" }
+-- { dg-require-effective-target strub }
procedure Strub_Renm1 is
V : Integer := 0;
diff --git a/gcc/testsuite/gnat.dg/strub_renm2.adb b/gcc/testsuite/gnat.dg/strub_renm2.adb
index c488c20..3cb81ea 100644
--- a/gcc/testsuite/gnat.dg/strub_renm2.adb
+++ b/gcc/testsuite/gnat.dg/strub_renm2.adb
@@ -1,5 +1,6 @@
-- { dg-do compile }
-- { dg-options "-fstrub=strict -fdump-ipa-strub" }
+-- { dg-require-effective-target strub }
procedure Strub_Renm2 is
V : Integer := 0;
diff --git a/gcc/testsuite/gnat.dg/strub_var.adb b/gcc/testsuite/gnat.dg/strub_var.adb
index 3d158de..7c6affa 100644
--- a/gcc/testsuite/gnat.dg/strub_var.adb
+++ b/gcc/testsuite/gnat.dg/strub_var.adb
@@ -1,5 +1,6 @@
-- { dg-do compile }
-- { dg-options "-fstrub=strict -fdump-ipa-strubm" }
+-- { dg-require-effective-target strub }
-- We don't read from the automatic variable, but being an automatic
-- variable, its presence should be enough for the procedure to get
diff --git a/gcc/testsuite/gnat.dg/strub_var1.adb b/gcc/testsuite/gnat.dg/strub_var1.adb
index 6a504e0..64b7e65 100644
--- a/gcc/testsuite/gnat.dg/strub_var1.adb
+++ b/gcc/testsuite/gnat.dg/strub_var1.adb
@@ -1,4 +1,5 @@
-- { dg-do compile }
+-- { dg-require-effective-target strub }
with Strub_Attr;
procedure Strub_Var1 is
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 3fcce6b..40a60c1 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -1302,6 +1302,13 @@ proc check_stack_check_available { stack_kind } {
} "$stack_opt"]
}
+# Return 1 if the target supports stack scrubbing.
+proc check_effective_target_strub {} {
+ return [check_no_compiler_messages strub assembly {
+ void __attribute__ ((__strub__)) fn (void) {}
+ } ""]
+}
+
# Return 1 if compilation with -freorder-blocks-and-partition is error-free
# for trivial code, 0 otherwise. As some targets (ARM for example) only
# warn when -fprofile-use is also supplied we test that combination too.