diff options
author | Richard Guenther <rguenther@suse.de> | 2009-10-05 14:05:54 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2009-10-05 14:05:54 +0000 |
commit | 1a735925e30877491ac12ca78612e4de29c4bf0f (patch) | |
tree | 666c7b939b006e039aeec82b1397690b52070e18 /gcc/lto | |
parent | e9d85fa6a7fdd48c00c02b8ad915a75d3b025708 (diff) | |
download | gcc-1a735925e30877491ac12ca78612e4de29c4bf0f.zip gcc-1a735925e30877491ac12ca78612e4de29c4bf0f.tar.gz gcc-1a735925e30877491ac12ca78612e4de29c4bf0f.tar.bz2 |
re PR lto/41552 (Undefined references with -flto, dependent on object file ordering)
2009-10-05 Richard Guenther <rguenther@suse.de>
PR lto/41552
PR lto/41487
* lto-symtab.c (struct lto_symtab_base_def): Remove.
(struct lto_symtab_identifier_def): Likewise.
(struct lto_symtab_decl_def): Likewise.
(struct lto_symtab_entry_def): New.
(lto_symtab_identifier_t): Rename to ...
(lto_symtab_entry_t): ... this.
(lto_symtab_decls): Remove.
(lto_symtab_base_hash): Rename to ...
(lto_symtab_entry_hash): ... this.
(lto_symtab_base_eq): Rename to ...
(lto_symtab_entry_eq): ... this.
(lto_symtab_base_marked_p): Rename to ...
(lto_symtab_entry_marked_p): ... this.
(lto_symtab_identifier_marked_p): Remove.
(lto_symtab_decl_marked_p): Likewise.
(lto_symtab_maybe_init_hash_tables): Rename to ...
(lto_symtab_maybe_init_hash_table): ... this.
(lto_symtab_set_resolution_and_file_data): Remove.
(lto_symtab_register_decl): New function.
(lto_symtab_get_identifier): Remove.
(lto_symtab_get): New function.
(lto_symtab_get_resolution): Adjust.
(lto_symtab_get_identifier_decl): Remove.
(lto_symtab_set_identifier_decl): Likewise.
(lto_symtab_merge_decl): Rename to ...
(lto_symtab_merge): ... this. Rewrite.
(lto_symtab_merge_var): Remove.
(lto_symtab_merge_fn): Likewise.
(lto_symtab_prevailing_decl): Adjust.
(lto_cgraph_replace_node): New function.
(lto_symtab_merge_decls_2): Likewise.
(lto_symtab_merge_decls_1): Likewise.
(lto_symtab_fixup_var_decls): Likewise.
(lto_symtab_resolve_symbols): Likewise.
(lto_symtab_merge_decls): Likewise.
(lto_symtab_prevailing_decl): Adjust.
(lto_symtab_get_symtab_def): Remove.
(lto_symtab_get_file_data): Likewise.
(lto_symtab_clear_resolution): Adjust.
(lto_symtab_clear_resolution): Likewise.
* lto-cgraph.c (input_edge): Do not merge cgraph nodes here.
(input_cgraph_1): Likewise.
* lto-streamer-in.c (get_resolution): Do not provide fake
symbol resolutions here.
(deferred_global_decls): Remove.
(lto_register_deferred_decls_in_symtab): Likewise.
(lto_register_var_decl_in_symtab): Change signature, register
variable via lto_symtab_register_decl.
(lto_register_function_decl_in_symtab): Likewise.
(lto_read_tree): Adjust.
* lto-streamer.h (lto_register_deferred_decls_in_symtab): Remove.
(lto_symtab_merge_var): Likewise.
(lto_symtab_merge_fn): Likewise.
(lto_symtab_register_decl): Declare.
(lto_symtab_merge_decls): Likewise.
lto/
* lto.c (lto_read_decls): Do not register deferred decls.
(read_cgraph_and_symbols): Delay symbol and cgraph merging
until after reading the IPA summaries.
* g++.dg/lto/20091002-1_0.C: Adjust flags.
* g++.dg/lto/20091004-1_0.C: New testcase.
* g++.dg/lto/20091004-1_1.C: Likewise.
* g++.dg/lto/20091004-2_0.C: Likewise.
* g++.dg/lto/20091004-2_1.C: Likewise.
* g++.dg/lto/20091004-3_0.C: Likewise.
* g++.dg/lto/20091004-3_1.C: Likewise.
From-SVN: r152450
Diffstat (limited to 'gcc/lto')
-rw-r--r-- | gcc/lto/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/lto/lto.c | 65 |
2 files changed, 20 insertions, 53 deletions
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 3ccce8f..c4ee42a 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,11 @@ +2009-10-05 Richard Guenther <rguenther@suse.de> + + PR lto/41552 + PR lto/41487 + * lto.c (lto_read_decls): Do not register deferred decls. + (read_cgraph_and_symbols): Delay symbol and cgraph merging + until after reading the IPA summaries. + 2009-10-02 Rafael Avila de Espindola <espindola@google.com> * Make-lang.in (lto/lto-lang.o): Don't depend on lto/common.h. diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index 056d249..daefa82 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -244,10 +244,6 @@ lto_read_decls (struct lto_file_decl_data *decl_data, const void *data, /* Set the current decl state to be the global state. */ decl_data->current_decl_state = decl_data->global_decl_state; - /* After each CU is read register and possibly merge global - symbols and their types. */ - lto_register_deferred_decls_in_symtab (data_in); - lto_data_in_delete (data_in); } @@ -1763,6 +1759,7 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) unsigned int i, last_file_ix; struct lto_file_decl_data **all_file_decl_data; FILE *resolution; + struct cgraph_node *node; lto_stats.num_input_files = nfiles; @@ -1821,60 +1818,22 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) /* Read the callgraph. */ input_cgraph (); + /* Read the IPA summary data. */ ipa_read_summaries (); - timevar_push (TV_IPA_LTO_DECL_IO); - - lto_fixup_decls (all_file_decl_data); + /* Merge global decls. */ + lto_symtab_merge_decls (); - /* See if we have multiple decls for a symbol and choose the largest - one to generate the common. */ - for (i = 0; i < VEC_length (tree, lto_global_var_decls); ++i) - { - tree decl = VEC_index (tree, lto_global_var_decls, i); - tree prev_decl = NULL_TREE; - tree size; - - if (TREE_CODE (decl) != VAR_DECL - || !DECL_LANG_SPECIFIC (decl)) - continue; - - /* Find the preceeding decl of the largest one. */ - size = DECL_SIZE (decl); - do - { - tree next = (tree) DECL_LANG_SPECIFIC (decl); - if (tree_int_cst_lt (size, DECL_SIZE (next))) - { - size = DECL_SIZE (next); - prev_decl = decl; - } - decl = next; - } - while (DECL_LANG_SPECIFIC (decl)); + /* Mark cgraph nodes needed in the merged cgraph. + ??? Is this really necessary? */ + for (node = cgraph_nodes; node; node = node->next) + if (cgraph_decide_is_function_needed (node, node->decl)) + cgraph_mark_needed_node (node); - /* If necessary move the largest decl to the front of the - chain. */ - if (prev_decl != NULL_TREE) - { - decl = (tree) DECL_LANG_SPECIFIC (prev_decl); - DECL_LANG_SPECIFIC (prev_decl) = DECL_LANG_SPECIFIC (decl); - DECL_LANG_SPECIFIC (decl) - = (struct lang_decl *) VEC_index (tree, lto_global_var_decls, i); - VEC_replace (tree, lto_global_var_decls, i, decl); - } + timevar_push (TV_IPA_LTO_DECL_IO); - /* Mark everything apart from the first var as written out and - unlink the chain. */ - decl = VEC_index (tree, lto_global_var_decls, i); - while (DECL_LANG_SPECIFIC (decl)) - { - tree next = (tree) DECL_LANG_SPECIFIC (decl); - DECL_LANG_SPECIFIC (decl) = NULL; - decl = next; - TREE_ASM_WRITTEN (decl) = true; - } - } + /* Fixup all decls and types. */ + lto_fixup_decls (all_file_decl_data); /* FIXME lto. This loop needs to be changed to use the pass manager to call the ipa passes directly. */ |