[PATCH][LTO] Fix the remaining builtin execute LTO fails
Richard Guenther
rguenther@suse.de
Fri Dec 11 15:52:00 GMT 2009
On Fri, 11 Dec 2009, Diego Novillo wrote:
> On 12/11/09 09:41 , Richard Guenther wrote:
>
> > 2009-12-11 Richard Guenther <rguenther@suse.de>
> >
> > PR lto/41658
> > * lto-streamer-out.c (write_global_stream): Do not make decls
> > weak but resort to TREE_ASM_WRITTEN to avoid multiple definitions.
>
> OK, thanks.
Actually looking at PR41657 reveals more problems in this function.
When we output a decl via DECL_INITIAL of another we end up not
marking it as written. Also we can get away with the hashtable
if simply marking all written decls as written (heh - that now
sounds obvious).
So I'll test the following instead. Ok?
Thanks,
Richard.
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.
Index: gcc/lto-streamer-out.c
===================================================================
*** gcc/lto-streamer-out.c (revision 155164)
--- gcc/lto-streamer-out.c (working copy)
*************** write_global_stream (struct output_block
*** 2147,2181 ****
{
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);
}
}
}
--- 2147,2166 ----
{
t = lto_tree_ref_encoder_get_tree (encoder, index);
if (!lto_streamer_cache_lookup (ob->writer_cache, t, NULL))
! 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;
}
}
}
More information about the Gcc-patches
mailing list