2010-01-10 Rafael Avila de Espindola <espindola@google.com>
authorespindola <espindola@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 11 Jan 2010 02:28:49 +0000 (02:28 +0000)
committerespindola <espindola@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 11 Jan 2010 02:28:49 +0000 (02:28 +0000)
* gcc.dg/lto/20100108_0.c: New.

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

* lto-streamer-out.c (output_unreferenced_globals): Output static
variables.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155800 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 9761902..a5ef0cf 100644 (file)
@@ -1,3 +1,8 @@
+2010-01-10  Rafael Avila de Espindola  <espindola@google.com>
+
+       * lto-streamer-out.c (output_unreferenced_globals): Output static
+       variables.
+
 2010-01-10  Steven Bosscher  <steven@gcc.gnu.org>
 
        PR rtl-optimization/42621
index b27bbdd..fe43dce 100644 (file)
@@ -1973,12 +1973,15 @@ output_unreferenced_globals (cgraph_node_set set)
     {
       tree var = vnode->decl;
 
-      if (TREE_CODE (var) == VAR_DECL && TREE_PUBLIC (var))
+      if (TREE_CODE (var) == VAR_DECL)
         {
-          /* Outputting just the reference will not output the object itself
-             or references it might have.*/
+          /* Output the object in order to output references used in the
+             initialization. */
           lto_output_tree (ob, var, true);
-          lto_output_tree_ref (ob, var);
+
+          /* If it is public we also need a reference to the object itself. */
+          if (TREE_PUBLIC (var))
+            lto_output_tree_ref (ob, var);
         }
     }
 
index c0811d0..eeee601 100644 (file)
@@ -1,3 +1,7 @@
+2010-01-10  Rafael Avila de Espindola  <espindola@google.com>
+
+       * gcc.dg/lto/20100108_0.c: New.
+
 2010-01-10  Uros Bizjak  <ubizjak@gmail.com>
 
        * gcc.dg/graphite/pr40281.c (dg-options): Add -w.
diff --git a/gcc/testsuite/gcc.dg/lto/20100108_0.c b/gcc/testsuite/gcc.dg/lto/20100108_0.c
new file mode 100644 (file)
index 0000000..73f44ec
--- /dev/null
@@ -0,0 +1,9 @@
+/* { dg-lto-do assemble } */
+/* The problem with this testcase is that we were missing an undefined
+   reference to flag_exceptions. This can be tested with
+   GNUTARGET=plugin nm --plugin liblto_plugin.so 20100108_0.o
+   but we don't have support in the testsuite for doing it. */
+
+extern int flag_exceptions;
+static int *foo = &flag_exceptions;
+int **bar = &foo;