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

Alexandre Oliva aoliva@gcc.gnu.org
Thu Dec 7 00:04:05 GMT 2023


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

commit fd0be5938310462adf6e9e117c97ecc87c4a6e2e
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..f30f46df396 100644
--- a/gcc/testsuite/c-c++-common/strub-O0.c
+++ b/gcc/testsuite/c-c++-common/strub-O0.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..111c08a8eb2 100644
--- a/gcc/testsuite/c-c++-common/strub-O1.c
+++ b/gcc/testsuite/c-c++-common/strub-O1.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..220fdeb03a4 100644
--- a/gcc/testsuite/c-c++-common/strub-O2.c
+++ b/gcc/testsuite/c-c++-common/strub-O2.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..8a8cc2db75c 100644
--- a/gcc/testsuite/c-c++-common/strub-O2fni.c
+++ b/gcc/testsuite/c-c++-common/strub-O2fni.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..85e8aea5d97 100644
--- a/gcc/testsuite/c-c++-common/strub-O3.c
+++ b/gcc/testsuite/c-c++-common/strub-O3.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..07e846b5552 100644
--- a/gcc/testsuite/c-c++-common/strub-O3fni.c
+++ b/gcc/testsuite/c-c++-common/strub-O3fni.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..25f2b2f8db9 100644
--- a/gcc/testsuite/c-c++-common/strub-Og.c
+++ b/gcc/testsuite/c-c++-common/strub-Og.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..84c7600cb06 100644
--- a/gcc/testsuite/c-c++-common/strub-Os.c
+++ b/gcc/testsuite/c-c++-common/strub-Os.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..d83aab446a1 100644
--- a/gcc/testsuite/c-c++-common/strub-all1.c
+++ b/gcc/testsuite/c-c++-common/strub-all1.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..abc8d4946c8 100644
--- a/gcc/testsuite/c-c++-common/strub-all2.c
+++ b/gcc/testsuite/c-c++-common/strub-all2.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..0f467a8e8b2 100644
--- a/gcc/testsuite/c-c++-common/strub-apply1.c
+++ b/gcc/testsuite/c-c++-common/strub-apply1.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..ef14d59a598 100644
--- a/gcc/testsuite/c-c++-common/strub-apply2.c
+++ b/gcc/testsuite/c-c++-common/strub-apply2.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..26338f8a1ab 100644
--- a/gcc/testsuite/c-c++-common/strub-apply3.c
+++ b/gcc/testsuite/c-c++-common/strub-apply3.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..cdff9f060a2 100644
--- a/gcc/testsuite/c-c++-common/strub-apply4.c
+++ b/gcc/testsuite/c-c++-common/strub-apply4.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..74936b67e66 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-skip-if "strub unsupported" { ! 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..01c80866fba 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-skip-if "strub unsupported" { ! 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..84ea941e9ea 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-skip-if "strub unsupported" { ! 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..8dc8e47872b 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-skip-if "strub unsupported" { ! 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..79c9076cada 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-skip-if "strub unsupported" { ! 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..867a825e48d 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-skip-if "strub unsupported" { ! 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..89a64b3b248 100644
--- a/gcc/testsuite/c-c++-common/strub-internal1.c
+++ b/gcc/testsuite/c-c++-common/strub-internal1.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..4396dec3cc5 100644
--- a/gcc/testsuite/c-c++-common/strub-internal2.c
+++ b/gcc/testsuite/c-c++-common/strub-internal2.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..f5b648d3a70 100644
--- a/gcc/testsuite/c-c++-common/strub-parms1.c
+++ b/gcc/testsuite/c-c++-common/strub-parms1.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..25aa7e2cc22 100644
--- a/gcc/testsuite/c-c++-common/strub-parms2.c
+++ b/gcc/testsuite/c-c++-common/strub-parms2.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..c5fc2514089 100644
--- a/gcc/testsuite/c-c++-common/strub-parms3.c
+++ b/gcc/testsuite/c-c++-common/strub-parms3.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..0d7321eec95 100644
--- a/gcc/testsuite/c-c++-common/strub-relaxed1.c
+++ b/gcc/testsuite/c-c++-common/strub-relaxed1.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..b81277b9b64 100644
--- a/gcc/testsuite/c-c++-common/strub-relaxed2.c
+++ b/gcc/testsuite/c-c++-common/strub-relaxed2.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..9e14dc1e01c 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-skip-if "strub unsupported" { ! 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..e99d233c914 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-skip-if "strub unsupported" { ! 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..ea5e4a9846d 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-skip-if "strub unsupported" { ! 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..91357cb9928 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-skip-if "strub unsupported" { ! 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..d613944f802 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-skip-if "strub unsupported" { ! 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..7234c0a7584 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-skip-if "strub unsupported" { ! 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..5211fb39ad8 100644
--- a/gcc/testsuite/c-c++-common/strub-strict1.c
+++ b/gcc/testsuite/c-c++-common/strub-strict1.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..2c0c6d1496d 100644
--- a/gcc/testsuite/c-c++-common/strub-strict2.c
+++ b/gcc/testsuite/c-c++-common/strub-strict2.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..3056c7dc3bf 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-skip-if "strub unsupported" { ! 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..1188b5330a2 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-skip-if "strub unsupported" { ! 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..34983ed0b5a 100644
--- a/gcc/testsuite/c-c++-common/strub-var1.c
+++ b/gcc/testsuite/c-c++-common/strub-var1.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..4c2cb9740fd 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-skip-if "strub unsupported" { ! 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..2957e680a90 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-skip-if "strub unsupported" { ! 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..299bc43491d 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-skip-if "strub unsupported" { ! 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..fd82716442a 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-skip-if "strub unsupported" { ! 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..f9ef35b64fa 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-skip-if "strub unsupported" { ! 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..cf3b70e10ba 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-skip-if "strub unsupported" { ! 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..f163fcd70f4 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-skip-if "strub unsupported" { ! 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..03ddc16d46f 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-skip-if "strub unsupported" { ! 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..0194de88c31 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-skip-if "strub unsupported" { ! 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..3802153965c 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-skip-if "strub unsupported" { ! 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..bfcbbe0a202 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-skip-if "strub unsupported" { ! 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..dd4f3eb4f2f 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-skip-if "strub unsupported" { ! 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..f2bfb8283ec 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-skip-if "strub unsupported" { ! 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..12c13acb4e0 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-skip-if "strub unsupported" { ! 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..4344a37f046 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-skip-if "strub unsupported" { ! 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..fb6eb6ac712 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-skip-if "strub unsupported" { ! 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..66041524a85 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-skip-if "strub unsupported" { ! 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..bec39d07cba 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-skip-if "strub unsupported" { ! 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..10dcff9dbfc 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-skip-if "strub unsupported" { ! 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..d7f10c432a8 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-skip-if "strub unsupported" { ! 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..fdce58942cd 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-skip-if "strub unsupported" { ! 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..f5e2cf0de48 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-skip-if "strub unsupported" { ! 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..9ef92c9443e 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-skip-if "strub unsupported" { ! 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..6c62d15996f 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-skip-if "strub unsupported" { ! 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..ec3b5cee434 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-skip-if "strub unsupported" { ! 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..986ec5de959 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-skip-if "strub unsupported" { ! 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..86c8e3e6180 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-skip-if "strub unsupported" { ! 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..5003e26c764 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-skip-if "strub unsupported" { ! 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..bd0d2c907df 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-skip-if "strub unsupported" { ! 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..802ef621631 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-skip-if "strub unsupported" { ! 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..f5c59d6aec8 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-skip-if "strub unsupported" { ! 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..4217ea1a13a 100644
--- a/gcc/testsuite/g++.dg/strub-run1.C
+++ b/gcc/testsuite/g++.dg/strub-run1.C
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..0e127773783 100644
--- a/gcc/testsuite/g++.dg/torture/strub-init1.C
+++ b/gcc/testsuite/g++.dg/torture/strub-init1.C
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..8ba1ecd9fe8 100644
--- a/gcc/testsuite/g++.dg/torture/strub-init2.C
+++ b/gcc/testsuite/g++.dg/torture/strub-init2.C
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..a47869b12c4 100644
--- a/gcc/testsuite/g++.dg/torture/strub-init3.C
+++ b/gcc/testsuite/g++.dg/torture/strub-init3.C
@@ -1,3 +1,4 @@
+/* { dg-skip-if "strub unsupported" { ! 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..38bc138e654 100644
--- a/gcc/testsuite/gnat.dg/strub_access.adb
+++ b/gcc/testsuite/gnat.dg/strub_access.adb
@@ -1,3 +1,4 @@
+--  { dg-skip-if "strub unsupported" { ! 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..2e88b3b46a9 100644
--- a/gcc/testsuite/gnat.dg/strub_access1.adb
+++ b/gcc/testsuite/gnat.dg/strub_access1.adb
@@ -1,3 +1,4 @@
+--  { dg-skip-if "strub unsupported" { ! 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..3c73a39cb02 100644
--- a/gcc/testsuite/gnat.dg/strub_attr.adb
+++ b/gcc/testsuite/gnat.dg/strub_attr.adb
@@ -1,3 +1,4 @@
+--  { dg-skip-if "strub unsupported" { ! 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..c4b86a66302 100644
--- a/gcc/testsuite/gnat.dg/strub_disp.adb
+++ b/gcc/testsuite/gnat.dg/strub_disp.adb
@@ -1,3 +1,4 @@
+--  { dg-skip-if "strub unsupported" { ! 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..9fc3f9c5661 100644
--- a/gcc/testsuite/gnat.dg/strub_disp1.adb
+++ b/gcc/testsuite/gnat.dg/strub_disp1.adb
@@ -1,3 +1,4 @@
+--  { dg-skip-if "strub unsupported" { ! 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..d72c44a945a 100644
--- a/gcc/testsuite/gnat.dg/strub_ind.adb
+++ b/gcc/testsuite/gnat.dg/strub_ind.adb
@@ -1,3 +1,4 @@
+--  { dg-skip-if "strub unsupported" { ! 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..09540d79942 100644
--- a/gcc/testsuite/gnat.dg/strub_ind1.adb
+++ b/gcc/testsuite/gnat.dg/strub_ind1.adb
@@ -1,3 +1,4 @@
+--  { dg-skip-if "strub unsupported" { ! 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..e1952b69652 100644
--- a/gcc/testsuite/gnat.dg/strub_ind2.adb
+++ b/gcc/testsuite/gnat.dg/strub_ind2.adb
@@ -1,3 +1,4 @@
+--  { dg-skip-if "strub unsupported" { ! 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..6b1bc11bcf7 100644
--- a/gcc/testsuite/gnat.dg/strub_intf.adb
+++ b/gcc/testsuite/gnat.dg/strub_intf.adb
@@ -1,3 +1,4 @@
+--  { dg-skip-if "strub unsupported" { ! 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..014f7960421 100644
--- a/gcc/testsuite/gnat.dg/strub_intf1.adb
+++ b/gcc/testsuite/gnat.dg/strub_intf1.adb
@@ -1,3 +1,4 @@
+--  { dg-skip-if "strub unsupported" { ! 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..d90fd715073 100644
--- a/gcc/testsuite/gnat.dg/strub_intf2.adb
+++ b/gcc/testsuite/gnat.dg/strub_intf2.adb
@@ -1,3 +1,4 @@
+--  { dg-skip-if "strub unsupported" { ! 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..7f9295c5652 100644
--- a/gcc/testsuite/gnat.dg/strub_renm.adb
+++ b/gcc/testsuite/gnat.dg/strub_renm.adb
@@ -1,3 +1,4 @@
+--  { dg-skip-if "strub unsupported" { ! 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..f6e7dc76185 100644
--- a/gcc/testsuite/gnat.dg/strub_renm1.adb
+++ b/gcc/testsuite/gnat.dg/strub_renm1.adb
@@ -1,3 +1,4 @@
+--  { dg-skip-if "strub unsupported" { ! 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..c74c1644615 100644
--- a/gcc/testsuite/gnat.dg/strub_renm2.adb
+++ b/gcc/testsuite/gnat.dg/strub_renm2.adb
@@ -1,3 +1,4 @@
+--  { dg-skip-if "strub unsupported" { ! 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..d4255064eb9 100644
--- a/gcc/testsuite/gnat.dg/strub_var.adb
+++ b/gcc/testsuite/gnat.dg/strub_var.adb
@@ -1,3 +1,4 @@
+--  { dg-skip-if "strub unsupported" { ! 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..fd5b6ed802b 100644
--- a/gcc/testsuite/gnat.dg/strub_var1.adb
+++ b/gcc/testsuite/gnat.dg/strub_var1.adb
@@ -1,3 +1,4 @@
+--  { dg-skip-if "strub unsupported" { ! 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