summaryrefslogtreecommitdiff
path: root/gcc/lto-streamer-out.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-12-11 18:00:24 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-12-11 18:00:24 +0000
commit9ed14341ab980f7f7d2e0e09b92838a58fc57fd9 (patch)
tree9de40a53031617104951f6fd37441cc49b1fae6f /gcc/lto-streamer-out.c
parenta34688d46dcb6f390ad8e43be4307335980ee20e (diff)
downloadgcc-9ed14341ab980f7f7d2e0e09b92838a58fc57fd9.tar.gz
2009-12-11 Richard Guenther <rguenther@suse.de>
PR lto/41658 PR lto/41657 * lto-streamer-out.c (write_global_stream): Do not make decls weak but resort to TREE_ASM_WRITTEN to avoid multiple definitions. Make sure to mark all decls that we have written. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155174 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto-streamer-out.c')
-rw-r--r--gcc/lto-streamer-out.c41
1 files changed, 13 insertions, 28 deletions
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index 49877ff1a39..920cd270865 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -2147,35 +2147,20 @@ write_global_stream (struct output_block *ob,
{
t = lto_tree_ref_encoder_get_tree (encoder, index);
if (!lto_streamer_cache_lookup (ob->writer_cache, t, NULL))
- {
- if (flag_wpa)
- {
- /* In WPA we should not emit multiple definitions of the
- same symbol to all the files in the link set. If
- T had already been emitted as the pervailing definition
- in one file, emit it as an external reference in the
- others. */
- /* FIXME lto. We should check if T belongs to the
- file we are writing to. */
- if (TREE_CODE (t) == VAR_DECL
- && TREE_PUBLIC (t)
- && !DECL_EXTERNAL (t))
- {
- /* FIXME lto. Make DECLS_ALREADY_EMITTED an argument
- to this function so it can be freed up afterwards.
- Alternately, assign global symbols to cgraph
- node sets. */
- static struct pointer_set_t *decls_already_emitted = NULL;
-
- if (decls_already_emitted == NULL)
- decls_already_emitted = pointer_set_create ();
-
- if (pointer_set_insert (decls_already_emitted, t))
- make_decl_one_only (t, DECL_ASSEMBLER_NAME (t));
- }
- }
+ lto_output_tree (ob, t, false);
- lto_output_tree (ob, t, false);
+ if (flag_wpa)
+ {
+ /* In WPA we should not emit multiple definitions of the
+ same symbol to all the files in the link set. If
+ T had already been emitted as the pervailing definition
+ in one file, do not emit it in the others. */
+ /* FIXME lto. We should check if T belongs to the
+ file we are writing to. */
+ if (TREE_CODE (t) == VAR_DECL
+ && TREE_PUBLIC (t)
+ && !DECL_EXTERNAL (t))
+ TREE_ASM_WRITTEN (t) = 1;
}
}
}