aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Avila de Espindola <espindola@google.com>2010-01-11 02:28:49 +0000
committerRafael Espindola <espindola@gcc.gnu.org>2010-01-11 02:28:49 +0000
commit06bfe1d0e2c40805cc6fa1d8d39f59c4d529965f (patch)
tree8ce29cad9a5651018f71714cf70674e0e440c9e5
parentbd2638ac9f3a937b9084fd130d7a3002dae4a201 (diff)
downloadgcc-06bfe1d0e2c40805cc6fa1d8d39f59c4d529965f.zip
gcc-06bfe1d0e2c40805cc6fa1d8d39f59c4d529965f.tar.gz
gcc-06bfe1d0e2c40805cc6fa1d8d39f59c4d529965f.tar.bz2
20100108_0.c: New.
2010-01-10 Rafael Avila de Espindola <espindola@google.com> * 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. From-SVN: r155800
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/lto-streamer-out.c11
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/lto/20100108_0.c9
4 files changed, 25 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9761902..a5ef0cf 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index b27bbdd..fe43dce 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -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);
}
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c0811d0..eeee601 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..73f44ec
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20100108_0.c
@@ -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;