[gcc(refs/users/aoliva/heads/testme)] strub: enable conditional support

Alexandre Oliva aoliva@gcc.gnu.org
Wed Dec 6 23:58:58 GMT 2023


https://gcc.gnu.org/g:ec132a765ab9cc51209e92233684990913da8d18

commit ec132a765ab9cc51209e92233684990913da8d18
Author: Alexandre Oliva <oliva@gnu.org>
Date:   Wed Dec 6 19:36:02 2023 -0300

    strub: enable conditional support

Diff:
---
 gcc/config/nvptx/nvptx.cc                          |  3 ++
 gcc/doc/tm.texi                                    |  6 +++
 gcc/doc/tm.texi.in                                 |  2 +
 gcc/ipa-strub.cc                                   | 54 +++++++++++++++++++++-
 gcc/target.def                                     |  8 ++++
 gcc/testsuite/c-c++-common/strub-O0.c              |  1 +
 gcc/testsuite/c-c++-common/strub-O1.c              |  1 +
 gcc/testsuite/c-c++-common/strub-O2.c              |  1 +
 gcc/testsuite/c-c++-common/strub-O2fni.c           |  1 +
 gcc/testsuite/c-c++-common/strub-O3.c              |  1 +
 gcc/testsuite/c-c++-common/strub-O3fni.c           |  1 +
 gcc/testsuite/c-c++-common/strub-Og.c              |  1 +
 gcc/testsuite/c-c++-common/strub-Os.c              |  1 +
 gcc/testsuite/c-c++-common/strub-all1.c            |  1 +
 gcc/testsuite/c-c++-common/strub-all2.c            |  1 +
 gcc/testsuite/c-c++-common/strub-apply1.c          |  1 +
 gcc/testsuite/c-c++-common/strub-apply2.c          |  1 +
 gcc/testsuite/c-c++-common/strub-apply3.c          |  1 +
 gcc/testsuite/c-c++-common/strub-apply4.c          |  1 +
 gcc/testsuite/c-c++-common/strub-at-calls1.c       |  1 +
 gcc/testsuite/c-c++-common/strub-at-calls2.c       |  1 +
 gcc/testsuite/c-c++-common/strub-defer-O1.c        |  1 +
 gcc/testsuite/c-c++-common/strub-defer-O2.c        |  1 +
 gcc/testsuite/c-c++-common/strub-defer-O3.c        |  1 +
 gcc/testsuite/c-c++-common/strub-defer-Os.c        |  1 +
 gcc/testsuite/c-c++-common/strub-internal1.c       |  1 +
 gcc/testsuite/c-c++-common/strub-internal2.c       |  1 +
 gcc/testsuite/c-c++-common/strub-parms1.c          |  1 +
 gcc/testsuite/c-c++-common/strub-parms2.c          |  1 +
 gcc/testsuite/c-c++-common/strub-parms3.c          |  1 +
 gcc/testsuite/c-c++-common/strub-relaxed1.c        |  1 +
 gcc/testsuite/c-c++-common/strub-relaxed2.c        |  1 +
 gcc/testsuite/c-c++-common/strub-short-O0-exc.c    |  1 +
 gcc/testsuite/c-c++-common/strub-short-O0.c        |  1 +
 gcc/testsuite/c-c++-common/strub-short-O1.c        |  1 +
 gcc/testsuite/c-c++-common/strub-short-O2.c        |  1 +
 gcc/testsuite/c-c++-common/strub-short-O3.c        |  1 +
 gcc/testsuite/c-c++-common/strub-short-Os.c        |  1 +
 gcc/testsuite/c-c++-common/strub-strict1.c         |  1 +
 gcc/testsuite/c-c++-common/strub-strict2.c         |  1 +
 gcc/testsuite/c-c++-common/strub-tail-O1.c         |  1 +
 gcc/testsuite/c-c++-common/strub-tail-O2.c         |  1 +
 gcc/testsuite/c-c++-common/strub-var1.c            |  1 +
 .../c-c++-common/torture/strub-callable1.c         |  1 +
 .../c-c++-common/torture/strub-callable2.c         |  1 +
 gcc/testsuite/c-c++-common/torture/strub-const1.c  |  1 +
 gcc/testsuite/c-c++-common/torture/strub-const2.c  |  1 +
 gcc/testsuite/c-c++-common/torture/strub-const3.c  |  1 +
 gcc/testsuite/c-c++-common/torture/strub-const4.c  |  1 +
 gcc/testsuite/c-c++-common/torture/strub-data1.c   |  1 +
 gcc/testsuite/c-c++-common/torture/strub-data2.c   |  1 +
 gcc/testsuite/c-c++-common/torture/strub-data3.c   |  1 +
 gcc/testsuite/c-c++-common/torture/strub-data4.c   |  1 +
 gcc/testsuite/c-c++-common/torture/strub-data5.c   |  1 +
 .../c-c++-common/torture/strub-indcall1.c          |  1 +
 .../c-c++-common/torture/strub-indcall2.c          |  1 +
 .../c-c++-common/torture/strub-indcall3.c          |  1 +
 .../c-c++-common/torture/strub-inlinable1.c        |  1 +
 .../c-c++-common/torture/strub-inlinable2.c        |  1 +
 gcc/testsuite/c-c++-common/torture/strub-ptrfn1.c  |  1 +
 gcc/testsuite/c-c++-common/torture/strub-ptrfn2.c  |  1 +
 gcc/testsuite/c-c++-common/torture/strub-ptrfn3.c  |  1 +
 gcc/testsuite/c-c++-common/torture/strub-ptrfn4.c  |  1 +
 gcc/testsuite/c-c++-common/torture/strub-pure1.c   |  1 +
 gcc/testsuite/c-c++-common/torture/strub-pure2.c   |  1 +
 gcc/testsuite/c-c++-common/torture/strub-pure3.c   |  1 +
 gcc/testsuite/c-c++-common/torture/strub-pure4.c   |  1 +
 gcc/testsuite/c-c++-common/torture/strub-run1.c    |  1 +
 gcc/testsuite/c-c++-common/torture/strub-run2.c    |  1 +
 gcc/testsuite/c-c++-common/torture/strub-run3.c    |  1 +
 gcc/testsuite/c-c++-common/torture/strub-run4.c    |  1 +
 gcc/testsuite/c-c++-common/torture/strub-run4c.c   |  1 +
 gcc/testsuite/c-c++-common/torture/strub-run4d.c   |  1 +
 gcc/testsuite/c-c++-common/torture/strub-run4i.c   |  1 +
 gcc/testsuite/g++.dg/strub-run1.C                  |  1 +
 gcc/testsuite/g++.dg/torture/strub-init1.C         |  1 +
 gcc/testsuite/g++.dg/torture/strub-init2.C         |  1 +
 gcc/testsuite/g++.dg/torture/strub-init3.C         |  1 +
 gcc/testsuite/gnat.dg/strub_access.adb             |  1 +
 gcc/testsuite/gnat.dg/strub_access1.adb            |  1 +
 gcc/testsuite/gnat.dg/strub_attr.adb               |  1 +
 gcc/testsuite/gnat.dg/strub_disp.adb               |  1 +
 gcc/testsuite/gnat.dg/strub_disp1.adb              |  1 +
 gcc/testsuite/gnat.dg/strub_ind.adb                |  1 +
 gcc/testsuite/gnat.dg/strub_ind1.adb               |  1 +
 gcc/testsuite/gnat.dg/strub_ind2.adb               |  1 +
 gcc/testsuite/gnat.dg/strub_intf.adb               |  1 +
 gcc/testsuite/gnat.dg/strub_intf1.adb              |  1 +
 gcc/testsuite/gnat.dg/strub_intf2.adb              |  1 +
 gcc/testsuite/gnat.dg/strub_renm.adb               |  1 +
 gcc/testsuite/gnat.dg/strub_renm1.adb              |  1 +
 gcc/testsuite/gnat.dg/strub_renm2.adb              |  1 +
 gcc/testsuite/gnat.dg/strub_var.adb                |  1 +
 gcc/testsuite/gnat.dg/strub_var1.adb               |  1 +
 gcc/testsuite/lib/target-supports.exp              |  7 +++
 libgcc/Makefile.in                                 |  2 +-
 libgcc/configure                                   | 26 +++++++++++
 libgcc/configure.ac                                | 13 ++++++
 98 files changed, 207 insertions(+), 3 deletions(-)

diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc
index ae20802c879..3fb1deb70fd 100644
--- a/gcc/config/nvptx/nvptx.cc
+++ b/gcc/config/nvptx/nvptx.cc
@@ -7789,6 +7789,9 @@ nvptx_asm_output_def_from_decls (FILE *stream, tree name, tree value)
 #undef TARGET_LIBC_HAS_FUNCTION
 #define TARGET_LIBC_HAS_FUNCTION nvptx_libc_has_function
 
+#undef TARGET_HAVE_STRUB_SUPPORT_FOR
+#define TARGET_HAVE_STRUB_SUPPORT_FOR hook_bool_tree_false
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 #include "gt-nvptx.h"
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 89a1735dd79..768ada0af52 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -3450,6 +3450,12 @@ in DWARF 2 debug information.  The default is zero.  A different value
 may reduce the size of debug information on some ports.
 @end defmac
 
+@deftypefn {Target Hook} bool TARGET_HAVE_STRUB_SUPPORT_FOR (tree)
+Returns true if the target supports stack scrubbing for the given function
+or type, otherwise return false.  The default implementation always returns
+true.
+@end deftypefn
+
 @defmac TARGET_STRUB_USE_DYNAMIC_ARRAY
 If defined to nonzero, @code{__strub_leave} will allocate a dynamic
 array covering the stack range that needs scrubbing before clearing it.
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index ebc1d3de5ca..4fe0805394e 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -2686,6 +2686,8 @@ in DWARF 2 debug information.  The default is zero.  A different value
 may reduce the size of debug information on some ports.
 @end defmac
 
+@hook TARGET_HAVE_STRUB_SUPPORT_FOR
+
 @defmac TARGET_STRUB_USE_DYNAMIC_ARRAY
 If defined to nonzero, @code{__strub_leave} will allocate a dynamic
 array covering the stack range that needs scrubbing before clearing it.
diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc
index 293bec132b8..f3100bb1d44 100644
--- a/gcc/ipa-strub.cc
+++ b/gcc/ipa-strub.cc
@@ -60,6 +60,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "ipa-strub.h"
 #include "symtab-thunks.h"
 #include "attr-fnspec.h"
+#include "target.h"
 
 /* This file introduces two passes that, together, implement
    machine-independent stack scrubbing, strub for short.  It arranges
@@ -631,17 +632,60 @@ strub_always_inline_p (cgraph_node *node)
   return lookup_attribute ("always_inline", DECL_ATTRIBUTES (node->decl));
 }
 
+/* Return TRUE iff the target has strub support for T, a function decl
+   or a type, and optionally REPORT thereasons for ineligibility.  If
+   T is a type and error REPORTing is enabled, the LOCation (e.g. of
+   the indirect call) should be given in LOC.  */
+static inline bool
+strub_target_support_p (tree t, bool report = false,
+			location_t loc = UNKNOWN_LOCATION)
+{
+  bool result = true;
+
+  if (!targetm.have_strub_support_for (t))
+    {
+      result = false;
+
+      if (!report)
+	return result;
+
+      if (DECL_P (t))
+	sorry_at (DECL_SOURCE_LOCATION (t),
+		  "%qD is not eligible for %<strub%>"
+		  " on the target system", t);
+      else
+	sorry_at (loc,
+		  "%qT is not an eligible type for %<strub%>"
+		  " on the target system", t);
+    }
+
+  return result;
+}
+
 /* Return TRUE iff NODE is potentially eligible for any strub-enabled mode, and
    optionally REPORT the reasons for ineligibility.  */
 
 static inline bool
 can_strub_p (cgraph_node *node, bool report = false)
 {
-  bool result = true;
+  bool result = strub_target_support_p (node->decl, report);
 
-  if (!report && strub_always_inline_p (node))
+  if (!report && (!result || strub_always_inline_p (node)))
     return result;
 
+  if (flag_split_stack)
+    {
+      result = false;
+
+      if (!report)
+	return result;
+
+      sorry_at (DECL_SOURCE_LOCATION (node->decl),
+		"%qD is not eligible for %<strub%>"
+		" because %<-fsplit-stack%> is enabled",
+		node->decl);
+    }
+
   if (lookup_attribute ("noipa", DECL_ATTRIBUTES (node->decl)))
     {
       result = false;
@@ -2417,6 +2461,12 @@ pass_ipa_strub::adjust_at_calls_call (cgraph_edge *e, int named_args,
 			 && (TREE_TYPE (gimple_call_arg (ocall, named_args))
 			     == get_pwmt ())));
 
+  tree tsup;
+  if (!(tsup = gimple_call_fndecl (ocall)))
+    tsup = TREE_TYPE (TREE_TYPE (gimple_call_fn (ocall)));
+  if (!strub_target_support_p (tsup, true, gimple_location (ocall)))
+    return;
+
   /* If we're already within a strub context, pass on the incoming watermark
      pointer, and omit the enter and leave calls around the modified call, as an
      optimization, or as a means to satisfy a tail-call requirement.  */
diff --git a/gcc/target.def b/gcc/target.def
index 52b83e091b9..08218f3a42a 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -4457,6 +4457,14 @@ otherwise return false.  The default implementation always returns true.",
  bool, (void),
  hook_bool_void_true)
 
+DEFHOOK
+(have_strub_support_for,
+ "Returns true if the target supports stack scrubbing for the given function\n\
+or type, otherwise return false.  The default implementation always returns\n\
+true.",
+ bool, (tree),
+ hook_bool_tree_true)
+
 DEFHOOK
 (have_speculation_safe_value,
 "This hook is used to determine the level of target support for\n\
diff --git a/gcc/testsuite/c-c++-common/strub-O0.c b/gcc/testsuite/c-c++-common/strub-O0.c
index c7a79a6ea0d..a4af42aaf98 100644
--- a/gcc/testsuite/c-c++-common/strub-O0.c
+++ b/gcc/testsuite/c-c++-common/strub-O0.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-O0 -fstrub=strict -fdump-rtl-expand" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-O1.c b/gcc/testsuite/c-c++-common/strub-O1.c
index 96285c975d9..e5443c2a420 100644
--- a/gcc/testsuite/c-c++-common/strub-O1.c
+++ b/gcc/testsuite/c-c++-common/strub-O1.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-O1 -fstrub=strict -fdump-rtl-expand" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-O2.c b/gcc/testsuite/c-c++-common/strub-O2.c
index 8edc0d8aa13..3ab3b8cad28 100644
--- a/gcc/testsuite/c-c++-common/strub-O2.c
+++ b/gcc/testsuite/c-c++-common/strub-O2.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-O2 -fstrub=strict -fdump-rtl-expand" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-O2fni.c b/gcc/testsuite/c-c++-common/strub-O2fni.c
index c6d900cf3c4..a00d37b44bc 100644
--- a/gcc/testsuite/c-c++-common/strub-O2fni.c
+++ b/gcc/testsuite/c-c++-common/strub-O2fni.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-O2 -fstrub=strict -fdump-rtl-expand -fno-inline" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-O3.c b/gcc/testsuite/c-c++-common/strub-O3.c
index 33ee465e51c..3ae3d36c732 100644
--- a/gcc/testsuite/c-c++-common/strub-O3.c
+++ b/gcc/testsuite/c-c++-common/strub-O3.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-O3 -fstrub=strict -fdump-rtl-expand" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-O3fni.c b/gcc/testsuite/c-c++-common/strub-O3fni.c
index 2936f82079e..35353d9eea6 100644
--- a/gcc/testsuite/c-c++-common/strub-O3fni.c
+++ b/gcc/testsuite/c-c++-common/strub-O3fni.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-O3 -fstrub=strict -fdump-rtl-expand -fno-inline" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-Og.c b/gcc/testsuite/c-c++-common/strub-Og.c
index 479746e57d8..6cf7ff09596 100644
--- a/gcc/testsuite/c-c++-common/strub-Og.c
+++ b/gcc/testsuite/c-c++-common/strub-Og.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-Og -fstrub=strict -fdump-rtl-expand" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-Os.c b/gcc/testsuite/c-c++-common/strub-Os.c
index 2241d4ea07f..e209a2c7914 100644
--- a/gcc/testsuite/c-c++-common/strub-Os.c
+++ b/gcc/testsuite/c-c++-common/strub-Os.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-Os -fstrub=strict -fdump-rtl-expand" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-all1.c b/gcc/testsuite/c-c++-common/strub-all1.c
index a322bcc5da6..8341f80af16 100644
--- a/gcc/testsuite/c-c++-common/strub-all1.c
+++ b/gcc/testsuite/c-c++-common/strub-all1.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=all -fdump-ipa-strubm -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-all2.c b/gcc/testsuite/c-c++-common/strub-all2.c
index db60026d0e0..0a1b59b1671 100644
--- a/gcc/testsuite/c-c++-common/strub-all2.c
+++ b/gcc/testsuite/c-c++-common/strub-all2.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=all -fdump-ipa-strubm -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-apply1.c b/gcc/testsuite/c-c++-common/strub-apply1.c
index 2f462adc1ef..725a082955b 100644
--- a/gcc/testsuite/c-c++-common/strub-apply1.c
+++ b/gcc/testsuite/c-c++-common/strub-apply1.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-apply2.c b/gcc/testsuite/c-c++-common/strub-apply2.c
index a5d7551f5da..67ed41bd63b 100644
--- a/gcc/testsuite/c-c++-common/strub-apply2.c
+++ b/gcc/testsuite/c-c++-common/strub-apply2.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-apply3.c b/gcc/testsuite/c-c++-common/strub-apply3.c
index 64422a0d1e8..44893940435 100644
--- a/gcc/testsuite/c-c++-common/strub-apply3.c
+++ b/gcc/testsuite/c-c++-common/strub-apply3.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-apply4.c b/gcc/testsuite/c-c++-common/strub-apply4.c
index 15ffaa031b8..a0ddc4f0382 100644
--- a/gcc/testsuite/c-c++-common/strub-apply4.c
+++ b/gcc/testsuite/c-c++-common/strub-apply4.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-O2 -fstrub=strict -fdump-ipa-strubm" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-at-calls1.c b/gcc/testsuite/c-c++-common/strub-at-calls1.c
index b70843b4215..1ea6fa261eb 100644
--- a/gcc/testsuite/c-c++-common/strub-at-calls1.c
+++ b/gcc/testsuite/c-c++-common/strub-at-calls1.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=at-calls -fdump-ipa-strubm -fdump-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 97a3988a6b9..a14d6b8394f 100644
--- a/gcc/testsuite/c-c++-common/strub-at-calls2.c
+++ b/gcc/testsuite/c-c++-common/strub-at-calls2.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=at-calls -fdump-ipa-strubm -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-defer-O1.c b/gcc/testsuite/c-c++-common/strub-defer-O1.c
index 3d73431b3dc..9e51bd04104 100644
--- a/gcc/testsuite/c-c++-common/strub-defer-O1.c
+++ b/gcc/testsuite/c-c++-common/strub-defer-O1.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do run } */
 /* { dg-options "-fstrub=strict -O1" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-defer-O2.c b/gcc/testsuite/c-c++-common/strub-defer-O2.c
index fddf3c745e7..40112180cfd 100644
--- a/gcc/testsuite/c-c++-common/strub-defer-O2.c
+++ b/gcc/testsuite/c-c++-common/strub-defer-O2.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do run } */
 /* { dg-options "-fstrub=strict -O2" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-defer-O3.c b/gcc/testsuite/c-c++-common/strub-defer-O3.c
index 7ebc65b58dd..4f901c19fa9 100644
--- a/gcc/testsuite/c-c++-common/strub-defer-O3.c
+++ b/gcc/testsuite/c-c++-common/strub-defer-O3.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do run } */
 /* { dg-options "-fstrub=strict -O3" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-defer-Os.c b/gcc/testsuite/c-c++-common/strub-defer-Os.c
index fbaf85fe0fa..d69a5fa8246 100644
--- a/gcc/testsuite/c-c++-common/strub-defer-Os.c
+++ b/gcc/testsuite/c-c++-common/strub-defer-Os.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do run } */
 /* { dg-options "-fstrub=strict -Os" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-internal1.c b/gcc/testsuite/c-c++-common/strub-internal1.c
index e9d7b7b9ee0..e7a0af164ad 100644
--- a/gcc/testsuite/c-c++-common/strub-internal1.c
+++ b/gcc/testsuite/c-c++-common/strub-internal1.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=internal -fdump-ipa-strubm -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-internal2.c b/gcc/testsuite/c-c++-common/strub-internal2.c
index 8b8e15a51c7..09ff0daabd2 100644
--- a/gcc/testsuite/c-c++-common/strub-internal2.c
+++ b/gcc/testsuite/c-c++-common/strub-internal2.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=internal -fdump-ipa-strubm -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-parms1.c b/gcc/testsuite/c-c++-common/strub-parms1.c
index 0a4a7539d34..2cd60d5e660 100644
--- a/gcc/testsuite/c-c++-common/strub-parms1.c
+++ b/gcc/testsuite/c-c++-common/strub-parms1.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-parms2.c b/gcc/testsuite/c-c++-common/strub-parms2.c
index 147171d96d5..96205e4c386 100644
--- a/gcc/testsuite/c-c++-common/strub-parms2.c
+++ b/gcc/testsuite/c-c++-common/strub-parms2.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-parms3.c b/gcc/testsuite/c-c++-common/strub-parms3.c
index 4e92682895a..6f36272574b 100644
--- a/gcc/testsuite/c-c++-common/strub-parms3.c
+++ b/gcc/testsuite/c-c++-common/strub-parms3.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-relaxed1.c b/gcc/testsuite/c-c++-common/strub-relaxed1.c
index e2f9d8aebca..9131423cb35 100644
--- a/gcc/testsuite/c-c++-common/strub-relaxed1.c
+++ b/gcc/testsuite/c-c++-common/strub-relaxed1.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=relaxed -fdump-ipa-strubm -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-relaxed2.c b/gcc/testsuite/c-c++-common/strub-relaxed2.c
index 98474435d2e..17c1b162f2a 100644
--- a/gcc/testsuite/c-c++-common/strub-relaxed2.c
+++ b/gcc/testsuite/c-c++-common/strub-relaxed2.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=relaxed -fdump-ipa-strubm -fdump-ipa-strub" } */
 
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 1de15342595..9a1085661f7 100644
--- a/gcc/testsuite/c-c++-common/strub-short-O0-exc.c
+++ b/gcc/testsuite/c-c++-common/strub-short-O0-exc.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-O0 -fstrub=strict -fexceptions -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-short-O0.c b/gcc/testsuite/c-c++-common/strub-short-O0.c
index f9209c81900..8f941554e80 100644
--- a/gcc/testsuite/c-c++-common/strub-short-O0.c
+++ b/gcc/testsuite/c-c++-common/strub-short-O0.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-O0 -fstrub=strict -fno-exceptions -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-short-O1.c b/gcc/testsuite/c-c++-common/strub-short-O1.c
index bed1dcfb54a..bd92eb02a25 100644
--- a/gcc/testsuite/c-c++-common/strub-short-O1.c
+++ b/gcc/testsuite/c-c++-common/strub-short-O1.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-O1 -fstrub=strict -fno-exceptions -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-short-O2.c b/gcc/testsuite/c-c++-common/strub-short-O2.c
index 6bf0071f52b..8d45b22d946 100644
--- a/gcc/testsuite/c-c++-common/strub-short-O2.c
+++ b/gcc/testsuite/c-c++-common/strub-short-O2.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-O2 -fstrub=strict -fno-exceptions -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-short-O3.c b/gcc/testsuite/c-c++-common/strub-short-O3.c
index 4732f515bf7..8f3cd12e08d 100644
--- a/gcc/testsuite/c-c++-common/strub-short-O3.c
+++ b/gcc/testsuite/c-c++-common/strub-short-O3.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-O3 -fstrub=strict -fno-exceptions -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-short-Os.c b/gcc/testsuite/c-c++-common/strub-short-Os.c
index 8d6424c479a..992209ef457 100644
--- a/gcc/testsuite/c-c++-common/strub-short-Os.c
+++ b/gcc/testsuite/c-c++-common/strub-short-Os.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-Os -fstrub=strict -fno-exceptions -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-strict1.c b/gcc/testsuite/c-c++-common/strub-strict1.c
index 36852244206..1448aa47cdb 100644
--- a/gcc/testsuite/c-c++-common/strub-strict1.c
+++ b/gcc/testsuite/c-c++-common/strub-strict1.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict -fdump-ipa-strubm" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-strict2.c b/gcc/testsuite/c-c++-common/strub-strict2.c
index b4f28883218..2391a8f5c3e 100644
--- a/gcc/testsuite/c-c++-common/strub-strict2.c
+++ b/gcc/testsuite/c-c++-common/strub-strict2.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict -fdump-ipa-strubm" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-tail-O1.c b/gcc/testsuite/c-c++-common/strub-tail-O1.c
index e48e0610e07..43efb167794 100644
--- a/gcc/testsuite/c-c++-common/strub-tail-O1.c
+++ b/gcc/testsuite/c-c++-common/strub-tail-O1.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-O1 -fstrub=strict -fno-exceptions -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-tail-O2.c b/gcc/testsuite/c-c++-common/strub-tail-O2.c
index 87cda7ab21b..e5c3d8858e1 100644
--- a/gcc/testsuite/c-c++-common/strub-tail-O2.c
+++ b/gcc/testsuite/c-c++-common/strub-tail-O2.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-O2 -fstrub=strict -fno-exceptions -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/strub-var1.c b/gcc/testsuite/c-c++-common/strub-var1.c
index eb6250fd39c..68906296022 100644
--- a/gcc/testsuite/c-c++-common/strub-var1.c
+++ b/gcc/testsuite/c-c++-common/strub-var1.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 
 int __attribute__ ((strub)) x;
diff --git a/gcc/testsuite/c-c++-common/torture/strub-callable1.c b/gcc/testsuite/c-c++-common/torture/strub-callable1.c
index b5e45ab0525..43d165e44c5 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-callable1.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-callable1.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict" } */
 
diff --git a/gcc/testsuite/c-c++-common/torture/strub-callable2.c b/gcc/testsuite/c-c++-common/torture/strub-callable2.c
index 96aa7fe4b07..c5e5ec321ce 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-callable2.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-callable2.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict" } */
 
diff --git a/gcc/testsuite/c-c++-common/torture/strub-const1.c b/gcc/testsuite/c-c++-common/torture/strub-const1.c
index 5e956cb1a9b..690915b3782 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-const1.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-const1.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/torture/strub-const2.c b/gcc/testsuite/c-c++-common/torture/strub-const2.c
index 73d650292df..5719bfed135 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-const2.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-const2.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/torture/strub-const3.c b/gcc/testsuite/c-c++-common/torture/strub-const3.c
index 2584f1f974a..2f4e32b47f7 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-const3.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-const3.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/torture/strub-const4.c b/gcc/testsuite/c-c++-common/torture/strub-const4.c
index d819f54ec02..9f69c790318 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-const4.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-const4.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/torture/strub-data1.c b/gcc/testsuite/c-c++-common/torture/strub-data1.c
index 7c27a2a1a6d..3f87659d64d 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-data1.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-data1.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/torture/strub-data2.c b/gcc/testsuite/c-c++-common/torture/strub-data2.c
index e66d903780a..6366eae7345 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-data2.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-data2.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/torture/strub-data3.c b/gcc/testsuite/c-c++-common/torture/strub-data3.c
index 5e08e0e58c6..42f42c2b2d7 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-data3.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-data3.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/torture/strub-data4.c b/gcc/testsuite/c-c++-common/torture/strub-data4.c
index a818e7a38bb..a7395c40664 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-data4.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-data4.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/torture/strub-data5.c b/gcc/testsuite/c-c++-common/torture/strub-data5.c
index ddb0b5c0543..67e65b99a0d 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-data5.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-data5.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict" } */
 
diff --git a/gcc/testsuite/c-c++-common/torture/strub-indcall1.c b/gcc/testsuite/c-c++-common/torture/strub-indcall1.c
index c165f312f16..8bad34d7176 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-indcall1.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-indcall1.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/torture/strub-indcall2.c b/gcc/testsuite/c-c++-common/torture/strub-indcall2.c
index 69fcff8d376..96837834e84 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-indcall2.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-indcall2.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/torture/strub-indcall3.c b/gcc/testsuite/c-c++-common/torture/strub-indcall3.c
index ff006224909..1871566fe15 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-indcall3.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-indcall3.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/torture/strub-inlinable1.c b/gcc/testsuite/c-c++-common/torture/strub-inlinable1.c
index 614b02228ba..c96218656d5 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-inlinable1.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-inlinable1.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=relaxed" } */
 
diff --git a/gcc/testsuite/c-c++-common/torture/strub-inlinable2.c b/gcc/testsuite/c-c++-common/torture/strub-inlinable2.c
index f9a6b4a16fa..3a1a77c1b5e 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-inlinable2.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-inlinable2.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=all" } */
 
diff --git a/gcc/testsuite/c-c++-common/torture/strub-ptrfn1.c b/gcc/testsuite/c-c++-common/torture/strub-ptrfn1.c
index b4a7f3992bb..699af8deb8e 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-ptrfn1.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-ptrfn1.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict" } */
 
diff --git a/gcc/testsuite/c-c++-common/torture/strub-ptrfn2.c b/gcc/testsuite/c-c++-common/torture/strub-ptrfn2.c
index ef634d35126..7cc9612ce8a 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-ptrfn2.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-ptrfn2.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=relaxed -Wpedantic" } */
 
diff --git a/gcc/testsuite/c-c++-common/torture/strub-ptrfn3.c b/gcc/testsuite/c-c++-common/torture/strub-ptrfn3.c
index e1f179e160e..fb070384355 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-ptrfn3.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-ptrfn3.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=relaxed -Wpedantic -fpermissive" } */
 /* { dg-prune-output "command-line option .-fpermissive." } */
diff --git a/gcc/testsuite/c-c++-common/torture/strub-ptrfn4.c b/gcc/testsuite/c-c++-common/torture/strub-ptrfn4.c
index 70b558afad0..6ff5baad179 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-ptrfn4.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-ptrfn4.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=relaxed" } */
 
diff --git a/gcc/testsuite/c-c++-common/torture/strub-pure1.c b/gcc/testsuite/c-c++-common/torture/strub-pure1.c
index a262a086837..186c35e1aaa 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-pure1.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-pure1.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/torture/strub-pure2.c b/gcc/testsuite/c-c++-common/torture/strub-pure2.c
index 4c4bd50c209..0e381df42fb 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-pure2.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-pure2.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/torture/strub-pure3.c b/gcc/testsuite/c-c++-common/torture/strub-pure3.c
index ce195c6b1f1..f9f0f8f3beb 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-pure3.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-pure3.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/torture/strub-pure4.c b/gcc/testsuite/c-c++-common/torture/strub-pure4.c
index 75cd54ccb5b..3eb6286ca52 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-pure4.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-pure4.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/c-c++-common/torture/strub-run1.c b/gcc/testsuite/c-c++-common/torture/strub-run1.c
index 7458b3fb54d..d5e0e2ece8d 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-run1.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-run1.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do run } */
 /* { dg-options "-fstrub=strict" } */
 
diff --git a/gcc/testsuite/c-c++-common/torture/strub-run2.c b/gcc/testsuite/c-c++-common/torture/strub-run2.c
index 5d60a7775f4..268371d7bf1 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-run2.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-run2.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do run } */
 /* { dg-options "-fstrub=strict" } */
 
diff --git a/gcc/testsuite/c-c++-common/torture/strub-run3.c b/gcc/testsuite/c-c++-common/torture/strub-run3.c
index c2ad710858e..8a6b7b5fc97 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-run3.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-run3.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do run } */
 /* { dg-options "-fstrub=strict" } */
 /* { dg-require-effective-target alloca } */
diff --git a/gcc/testsuite/c-c++-common/torture/strub-run4.c b/gcc/testsuite/c-c++-common/torture/strub-run4.c
index 3b36b8e5d68..f424f8357fa 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-run4.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-run4.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do run } */
 /* { dg-options "-fstrub=all" } */
 /* { dg-require-effective-target alloca } */
diff --git a/gcc/testsuite/c-c++-common/torture/strub-run4c.c b/gcc/testsuite/c-c++-common/torture/strub-run4c.c
index 57f9baf758d..a780d858c22 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-run4c.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-run4c.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do run } */
 /* { dg-options "-fstrub=at-calls" } */
 /* { dg-require-effective-target alloca } */
diff --git a/gcc/testsuite/c-c++-common/torture/strub-run4d.c b/gcc/testsuite/c-c++-common/torture/strub-run4d.c
index 08de3f1c3b1..82a65ce1a48 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-run4d.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-run4d.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do run } */
 /* { dg-options "-fstrub=strict" } */
 /* { dg-require-effective-target alloca } */
diff --git a/gcc/testsuite/c-c++-common/torture/strub-run4i.c b/gcc/testsuite/c-c++-common/torture/strub-run4i.c
index 459f6886c54..0ed243086f6 100644
--- a/gcc/testsuite/c-c++-common/torture/strub-run4i.c
+++ b/gcc/testsuite/c-c++-common/torture/strub-run4i.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do run } */
 /* { dg-options "-fstrub=internal" } */
 /* { dg-require-effective-target alloca } */
diff --git a/gcc/testsuite/g++.dg/strub-run1.C b/gcc/testsuite/g++.dg/strub-run1.C
index 0d367fb83d0..0d8e9bc23e9 100644
--- a/gcc/testsuite/g++.dg/strub-run1.C
+++ b/gcc/testsuite/g++.dg/strub-run1.C
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 // { dg-do run }
 // { dg-options "-fstrub=internal" }
 
diff --git a/gcc/testsuite/g++.dg/torture/strub-init1.C b/gcc/testsuite/g++.dg/torture/strub-init1.C
index c226ab10ff6..5d347ad353d 100644
--- a/gcc/testsuite/g++.dg/torture/strub-init1.C
+++ b/gcc/testsuite/g++.dg/torture/strub-init1.C
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/g++.dg/torture/strub-init2.C b/gcc/testsuite/g++.dg/torture/strub-init2.C
index a7911f1fa72..17bffe7b142 100644
--- a/gcc/testsuite/g++.dg/torture/strub-init2.C
+++ b/gcc/testsuite/g++.dg/torture/strub-init2.C
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/g++.dg/torture/strub-init3.C b/gcc/testsuite/g++.dg/torture/strub-init3.C
index 6ebebcd01e8..4f9a57f2345 100644
--- a/gcc/testsuite/g++.dg/torture/strub-init3.C
+++ b/gcc/testsuite/g++.dg/torture/strub-init3.C
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target strub } */
 /* { dg-do compile } */
 /* { dg-options "-fstrub=strict -fdump-ipa-strub" } */
 
diff --git a/gcc/testsuite/gnat.dg/strub_access.adb b/gcc/testsuite/gnat.dg/strub_access.adb
index 29e6996ecf6..a5cf761f651 100644
--- a/gcc/testsuite/gnat.dg/strub_access.adb
+++ b/gcc/testsuite/gnat.dg/strub_access.adb
@@ -1,3 +1,4 @@
+--  { dg-require-effective-target strub }
 --  { dg-do compile }
 --  { dg-options "-fstrub=relaxed -fdump-ipa-strubm" }
 
diff --git a/gcc/testsuite/gnat.dg/strub_access1.adb b/gcc/testsuite/gnat.dg/strub_access1.adb
index dae47060164..323ab69aa55 100644
--- a/gcc/testsuite/gnat.dg/strub_access1.adb
+++ b/gcc/testsuite/gnat.dg/strub_access1.adb
@@ -1,3 +1,4 @@
+--  { dg-require-effective-target strub }
 --  { dg-do compile }
 --  { dg-options "-fstrub=relaxed" }
 
diff --git a/gcc/testsuite/gnat.dg/strub_attr.adb b/gcc/testsuite/gnat.dg/strub_attr.adb
index 10445d7cf84..69b629f3e38 100644
--- a/gcc/testsuite/gnat.dg/strub_attr.adb
+++ b/gcc/testsuite/gnat.dg/strub_attr.adb
@@ -1,3 +1,4 @@
+--  { dg-require-effective-target strub }
 --  { dg-do compile }
 --  { dg-options "-fstrub=strict -fdump-ipa-strubm -fdump-ipa-strub" }
 
diff --git a/gcc/testsuite/gnat.dg/strub_disp.adb b/gcc/testsuite/gnat.dg/strub_disp.adb
index 3dbcc4a357c..67625dfef77 100644
--- a/gcc/testsuite/gnat.dg/strub_disp.adb
+++ b/gcc/testsuite/gnat.dg/strub_disp.adb
@@ -1,3 +1,4 @@
+--  { dg-require-effective-target strub }
 --  { dg-do compile }
 
 procedure Strub_Disp is
diff --git a/gcc/testsuite/gnat.dg/strub_disp1.adb b/gcc/testsuite/gnat.dg/strub_disp1.adb
index 09756a74b7d..7de82216730 100644
--- a/gcc/testsuite/gnat.dg/strub_disp1.adb
+++ b/gcc/testsuite/gnat.dg/strub_disp1.adb
@@ -1,3 +1,4 @@
+--  { dg-require-effective-target strub }
 --  { dg-do compile }
 --  { dg-options "-fdump-ipa-strub" }
 
diff --git a/gcc/testsuite/gnat.dg/strub_ind.adb b/gcc/testsuite/gnat.dg/strub_ind.adb
index da56acaa957..b2d86b0cbce 100644
--- a/gcc/testsuite/gnat.dg/strub_ind.adb
+++ b/gcc/testsuite/gnat.dg/strub_ind.adb
@@ -1,3 +1,4 @@
+--  { dg-require-effective-target strub }
 --  { dg-do compile }
 --  { dg-options "-fstrub=strict" }
 
diff --git a/gcc/testsuite/gnat.dg/strub_ind1.adb b/gcc/testsuite/gnat.dg/strub_ind1.adb
index 825e395e681..4471e6efb9f 100644
--- a/gcc/testsuite/gnat.dg/strub_ind1.adb
+++ b/gcc/testsuite/gnat.dg/strub_ind1.adb
@@ -1,3 +1,4 @@
+--  { dg-require-effective-target strub }
 --  { dg-do compile }
 --  { dg-options "-fstrub=strict -fdump-ipa-strubm" }
 
diff --git a/gcc/testsuite/gnat.dg/strub_ind2.adb b/gcc/testsuite/gnat.dg/strub_ind2.adb
index e918b392631..d0e3add3ca1 100644
--- a/gcc/testsuite/gnat.dg/strub_ind2.adb
+++ b/gcc/testsuite/gnat.dg/strub_ind2.adb
@@ -1,3 +1,4 @@
+--  { dg-require-effective-target strub }
 --  { dg-do compile }
 --  { dg-options "-fstrub=strict" }
 
diff --git a/gcc/testsuite/gnat.dg/strub_intf.adb b/gcc/testsuite/gnat.dg/strub_intf.adb
index 8f0212a7586..7b553cda63b 100644
--- a/gcc/testsuite/gnat.dg/strub_intf.adb
+++ b/gcc/testsuite/gnat.dg/strub_intf.adb
@@ -1,3 +1,4 @@
+--  { dg-require-effective-target strub }
 --  { dg-do compile }
 
 --  Check that strub mode mismatches between overrider and overridden
diff --git a/gcc/testsuite/gnat.dg/strub_intf1.adb b/gcc/testsuite/gnat.dg/strub_intf1.adb
index bf77321cef7..3b8092bdc35 100644
--- a/gcc/testsuite/gnat.dg/strub_intf1.adb
+++ b/gcc/testsuite/gnat.dg/strub_intf1.adb
@@ -1,3 +1,4 @@
+--  { dg-require-effective-target strub }
 --  { dg-do compile }
 --  { dg-options "-fdump-ipa-strub" }
 
diff --git a/gcc/testsuite/gnat.dg/strub_intf2.adb b/gcc/testsuite/gnat.dg/strub_intf2.adb
index e8880dbc437..feafea3e0a7 100644
--- a/gcc/testsuite/gnat.dg/strub_intf2.adb
+++ b/gcc/testsuite/gnat.dg/strub_intf2.adb
@@ -1,3 +1,4 @@
+--  { dg-require-effective-target strub }
 --  { dg-do compile }
 
 --  Check that strub mode mismatches between overrider and overridden
diff --git a/gcc/testsuite/gnat.dg/strub_renm.adb b/gcc/testsuite/gnat.dg/strub_renm.adb
index 217367e712d..6c7ec56ece8 100644
--- a/gcc/testsuite/gnat.dg/strub_renm.adb
+++ b/gcc/testsuite/gnat.dg/strub_renm.adb
@@ -1,3 +1,4 @@
+--  { dg-require-effective-target strub }
 --  { dg-do compile }
 
 procedure Strub_Renm is
diff --git a/gcc/testsuite/gnat.dg/strub_renm1.adb b/gcc/testsuite/gnat.dg/strub_renm1.adb
index a11adbfb5a9..b22db5d5b96 100644
--- a/gcc/testsuite/gnat.dg/strub_renm1.adb
+++ b/gcc/testsuite/gnat.dg/strub_renm1.adb
@@ -1,3 +1,4 @@
+--  { dg-require-effective-target strub }
 --  { dg-do compile }
 --  { dg-options "-fstrub=relaxed -fdump-ipa-strub" }
 
diff --git a/gcc/testsuite/gnat.dg/strub_renm2.adb b/gcc/testsuite/gnat.dg/strub_renm2.adb
index c488c20826f..a8da13ae167 100644
--- a/gcc/testsuite/gnat.dg/strub_renm2.adb
+++ b/gcc/testsuite/gnat.dg/strub_renm2.adb
@@ -1,3 +1,4 @@
+--  { dg-require-effective-target strub }
 --  { dg-do compile }
 --  { dg-options "-fstrub=strict -fdump-ipa-strub" }
 
diff --git a/gcc/testsuite/gnat.dg/strub_var.adb b/gcc/testsuite/gnat.dg/strub_var.adb
index 3d158de2803..9087198a2cd 100644
--- a/gcc/testsuite/gnat.dg/strub_var.adb
+++ b/gcc/testsuite/gnat.dg/strub_var.adb
@@ -1,3 +1,4 @@
+--  { dg-require-effective-target strub }
 --  { dg-do compile }
 --  { dg-options "-fstrub=strict -fdump-ipa-strubm" }
 
diff --git a/gcc/testsuite/gnat.dg/strub_var1.adb b/gcc/testsuite/gnat.dg/strub_var1.adb
index 6a504e09198..ac62f81a7d7 100644
--- a/gcc/testsuite/gnat.dg/strub_var1.adb
+++ b/gcc/testsuite/gnat.dg/strub_var1.adb
@@ -1,3 +1,4 @@
+--  { dg-require-effective-target strub }
 --  { dg-do compile }
 
 with Strub_Attr;
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 3fcce6be49d..daf1d259aae 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 {
+	int __attribute__ ((__strub__)) fn () {}
+    } ""]
+}
+
 # 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.
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index d8163c5af99..3f77283490e 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -434,7 +434,7 @@ LIB2ADD += enable-execute-stack.c
 LIB2ADD += $(srcdir)/hardcfr.c
 
 # Stack scrubbing infrastructure.
-LIB2ADD += $(srcdir)/strub.c
+@HAVE_STRUB_SUPPORT@LIB2ADD += $(srcdir)/strub.c
 
 # While emutls.c has nothing to do with EH, it is in LIB2ADDEH*
 # instead of LIB2ADD because that's the way to be sure on some targets
diff --git a/libgcc/configure b/libgcc/configure
index cf149209652..f77d39df625 100755
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -593,6 +593,7 @@ asm_hidden_op
 extra_parts
 cpu_type
 get_gcc_base_ver
+HAVE_STRUB_SUPPORT
 thread_header
 tm_defines
 tm_file
@@ -5702,6 +5703,31 @@ esac
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for strub support" >&5
+$as_echo_n "checking for strub support... " >&6; }
+if ${libgcc_cv_strub_support+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int __attribute__ ((__strub__)) fn () {}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libgcc_cv_strub_support=yes
+else
+  libgcc_cv_strub_support=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcc_cv_strub_support" >&5
+$as_echo "$libgcc_cv_strub_support" >&6; }
+if test "x$libgcc_cv_strub_support" != xno; then
+  HAVE_STRUB_SUPPORT=
+else
+  HAVE_STRUB_SUPPORT='# '
+fi
+
+
 # Determine what GCC version number to use in filesystem paths.
 
   get_gcc_base_ver="cat"
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
index 2fc9d5d7c93..a8def244998 100644
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -694,6 +694,19 @@ AC_SUBST(tm_defines)
 # Map from thread model to thread header.
 GCC_AC_THREAD_HEADER([$target_thread_file])
 
+AC_CACHE_CHECK([for strub support],
+  [libgcc_cv_strub_support],
+  [AC_COMPILE_IFELSE(
+    [AC_LANG_SOURCE([int __attribute__ ((__strub__)) fn () {}])],
+    [libgcc_cv_strub_support=yes],
+    [libgcc_cv_strub_support=no])])
+if test "x$libgcc_cv_strub_support" != xno; then
+  HAVE_STRUB_SUPPORT=
+else
+  HAVE_STRUB_SUPPORT='# '
+fi
+AC_SUBST(HAVE_STRUB_SUPPORT)
+
 # Determine what GCC version number to use in filesystem paths.
 GCC_BASE_VER


More information about the Gcc-cvs mailing list