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 a06ed80e5afb64fd7181ae88bc7a56b5525a3917..08d4342e4284744727a3516328a27d00ed9f24a6 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 e24359cff19a19217206cd7f2c682f6a79ee331e..3e6fc1d030ea0659dd4b6e83f4a4fb7e5254f807 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 c926f3d32ea57f7b7f39de0cb6307325db0329d8..f3b61e560403fed6306bc4851ed0467abf903334 100644 (file)
@@ -1,3 +1,7 @@
+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.
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 ();
+}
+