20100104_0.c: New.
authorRafael Avila de Espindola <espindola@google.com>
Mon, 4 Jan 2010 15:25:11 +0000 (15:25 +0000)
committerRafael Espindola <espindola@gcc.gnu.org>
Mon, 4 Jan 2010 15:25:11 +0000 (15:25 +0000)
2010-01-04  Rafael Avila de Espindola  <espindola@google.com>

* gcc.dg/lto/20100104_0.c: New.

2010-01-04  Rafael Avila de Espindola  <espindola@google.com>

* lto-streamer-out.c (output_unreferenced_globals): Output the full
tree of an unreferenced global var.

From-SVN: r155619

gcc/ChangeLog
gcc/lto-streamer-out.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/lto/20100104_0.c [new file with mode: 0644]

index 11adcd0..39c9b61 100644 (file)
@@ -1,3 +1,8 @@
+2010-01-04  Rafael Avila de Espindola  <espindola@google.com>
+
+       * lto-streamer-out.c (output_unreferenced_globals): Output the full
+       tree of an unreferenced global var.
+
 2010-01-04  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/42542
index 6d13373..b27bbdd 100644 (file)
@@ -1974,7 +1974,12 @@ output_unreferenced_globals (cgraph_node_set set)
       tree var = vnode->decl;
 
       if (TREE_CODE (var) == VAR_DECL && TREE_PUBLIC (var))
-       lto_output_tree_ref (ob, var);
+        {
+          /* Outputting just the reference will not output the object itself
+             or references it might have.*/
+          lto_output_tree (ob, var, true);
+          lto_output_tree_ref (ob, var);
+        }
     }
 
   output_zero (ob);
index 44f692c..30b80af 100644 (file)
@@ -1,3 +1,7 @@
+2010-01-04  Rafael Avila de Espindola  <espindola@google.com>
+
+       * gcc.dg/lto/20100104_0.c: New.
+
 2010-01-04  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/42542
diff --git a/gcc/testsuite/gcc.dg/lto/20100104_0.c b/gcc/testsuite/gcc.dg/lto/20100104_0.c
new file mode 100644 (file)
index 0000000..c17e768
--- /dev/null
@@ -0,0 +1,8 @@
+/* { dg-lto-do assemble } */
+/* The problem with this testcase is that we were missing an undefined
+   reference to c_common_attribute_table. This can be tested with
+   GNUTARGET=plugin nm --plugin liblto_plugin.so 20100104_0.o
+   but we don't have support in the testsuite for doing it. */
+
+extern int c_common_attribute_table[];
+void *foobar = c_common_attribute_table;