This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][LTO] Fix multiple symbol definition problem in WHOPR.
- From: Diego Novillo <dnovillo at google dot com>
- To: Doug Kwan (éæå) <dougkwan at google dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, Rafael Espindola <espindola at google dot com>
- Date: Thu, 13 Nov 2008 10:54:11 -0500
- Subject: Re: [PATCH][LTO] Fix multiple symbol definition problem in WHOPR.
- References: <498552560811121335k6c506c38g74b5e1e541569f48@mail.gmail.com>
On Wed, Nov 12, 2008 at 16:35, Doug Kwan (éæå) <dougkwan@google.com> wrote:
> @@ -2277,23 +2400,18 @@ output_constructors_and_inits (void)
> /* Make string 0 be a NULL string. */
> lto_output_1_stream (ob->string_stream, 0);
>
> - /* Process the global static vars that have initializers or
> - constructors. */
> - FOR_EACH_STATIC_VARIABLE (vnode)
> + /* In WPA mode. Output inits and constructors of used variables. */
Clarify that by 'used' we mean variables used in one particular file.
> @@ -2694,10 +2808,26 @@ output_function_decl (struct output_bloc
> static void
> output_var_decl (struct output_block *ob, tree decl)
> {
> + bool saved_public;
> +
> /* tag and flags */
> /* Assume static or external variable. */
> output_global_record_start (ob, NULL, NULL, LTO_var_decl1);
> - output_tree_flags (ob, 0, decl, true);
> + if (flag_wpa
> + && (lto_get_var_flags (decl) & LTO_VAR_FLAG_FORCE_GLOBAL))
> + {
> + /* This variable is a file-scope static that is now shared by
> + multiple translation units owing to IPA-inlining. We promote
> + it to a global. */
> +
> + gcc_assert (TREE_STATIC (decl) && !TREE_PUBLIC (decl));
> + saved_public = TREE_PUBLIC (decl);
No need to save TREE_PUBLIC. You are asserting that TREE_PUBLIC
is false.
> @@ -641,6 +751,9 @@ lto_wpa_write_files (void)
> decls = VEC_index (bitmap, inlined_decls, i);
> lto_force_functions_static_inline (decls);
>
> + /* Set AUX to 1 in the last LTRANS file. */
> + set = VEC_index (cgraph_node_set, lto_cgraph_node_sets, i);
> + set->aux = (void*) (i == (n_sets - 1));
s/(void*)/(void *)(intptr_t)/ to avoid int/ptr problems in 64 bit
hosts.
> +lto-utils.o: lto-utils.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
> + $(TM_H)
Missing tree.h bitmap.h vec.h lto-header.h and lto-utils.h
> @@ -0,0 +1,39 @@
> +/* Miscellaneous utilies for LTO.
> +
> + Copyright (C) 2008 Free Software Foundation, Inc.
> + Contributed by Doug Kwan<dougkwan@google.com>
Space before '<'.
The rest looks fine.
Thanks. Diego.