ipa-comdats.c (propagate_comdat_group): Walk through thunks.
authorIlya Enkovich <ilya.enkovich@intel.com>
Wed, 8 Apr 2015 13:45:20 +0000 (13:45 +0000)
committerIlya Enkovich <ienkovich@gcc.gnu.org>
Wed, 8 Apr 2015 13:45:20 +0000 (13:45 +0000)
gcc/

* ipa-comdats.c (propagate_comdat_group): Walk through thunks.

gcc/testsuite/

* gcc.target/i386/mpx/chkp-thunk-comdat-3.c: New.

From-SVN: r221919

gcc/ChangeLog
gcc/ipa-comdats.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/mpx/chkp-thunk-comdat-3.c [new file with mode: 0644]

index a06ed80..08d4342 100644 (file)
@@ -1,3 +1,7 @@
+2015-04-08  Ilya Enkovich  <ilya.enkovich@intel.com>
+
+       * ipa-comdats.c (propagate_comdat_group): Walk through thunks.
+
 2015-04-08  Gerald Pfeifer  <gerald@pfeifer.com>
 
        * doc/install.texi (bootstrap-lto-noplugin): Rewrite. 
index e24359c..3e6fc1d 100644 (file)
@@ -142,12 +142,14 @@ propagate_comdat_group (struct symtab_node *symbol,
       {
        struct symtab_node *symbol2 = edge->caller;
 
-       /* If we see inline clone, its comdat group actually
-          corresponds to the comdat group of the function it is inlined
-          to.  */
-
        if (cgraph_node * cn = dyn_cast <cgraph_node *> (symbol2))
          {
+           /* Thunks can not call across section boundary.  */
+           if (cn->thunk.thunk_p)
+             newgroup = propagate_comdat_group (symbol2, newgroup, map);
+           /* If we see inline clone, its comdat group actually
+              corresponds to the comdat group of the function it
+              is inlined to.  */
            if (cn->global.inlined_to)
              symbol2 = cn->global.inlined_to;
          }
index c926f3d..f3b61e5 100644 (file)
@@ -1,5 +1,9 @@
 2015-04-08  Ilya Enkovich  <ilya.enkovich@intel.com>
 
+       * gcc.target/i386/mpx/chkp-thunk-comdat-3.c: New.
+
+2015-04-08  Ilya Enkovich  <ilya.enkovich@intel.com>
+
        * gcc/testsuite/gcc.target/i386/thunk-retbnd.c: New.
 
 2015-04-08  Eric Botcazou  <ebotcazou@adacore.com>
diff --git a/gcc/testsuite/gcc.target/i386/mpx/chkp-thunk-comdat-3.c b/gcc/testsuite/gcc.target/i386/mpx/chkp-thunk-comdat-3.c
new file mode 100644 (file)
index 0000000..dd0057e
--- /dev/null
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx -O -fvisibility=hidden" } */
+
+int val;
+
+static int __attribute__((noinline))
+test1 ()
+{
+  return val;
+}
+
+static int __attribute__((bnd_legacy,noinline))
+test2 ()
+{
+  return test1 ();
+}
+
+int
+test3 (void)
+{
+  return test2 ();
+}
+