diff options
author | Jan Hubicka <jh@suse.cz> | 2013-03-12 13:38:47 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2013-03-12 12:38:47 +0000 |
commit | 4f38fa8ce5b39d0a04f9d76c6f3844734fc4837b (patch) | |
tree | 00ec5d59f0f58c60fd301a2a96110ce4ee19f789 /gcc | |
parent | c5c5ba89acc96e48bf6eed87489fcda3efcd7fc3 (diff) | |
download | gcc-4f38fa8ce5b39d0a04f9d76c6f3844734fc4837b.zip gcc-4f38fa8ce5b39d0a04f9d76c6f3844734fc4837b.tar.gz gcc-4f38fa8ce5b39d0a04f9d76c6f3844734fc4837b.tar.bz2 |
re PR libstdc++/56557 (Link error about `std::fstream' or `std::stringstream' with `-flto' and `-rdynamic' options)
PR lto/56557
* lto-streamer-out.c (output_symbol_p): Skip references from
constructors of external variables.
From-SVN: r196613
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/lto-streamer-out.c | 31 |
2 files changed, 31 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8fad9e6..9acbb52 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2013-03-11 Jan Hubicka <jh@suse.cz> + PR lto/56557 + * lto-streamer-out.c (output_symbol_p): Skip references from + constructors of external variables. + +2013-03-11 Jan Hubicka <jh@suse.cz> + PR middle-end/56571 * valtrack.c (cleanup_auto_inc_dec): Unshare clobbers originating from pseudos. diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index 6cbe045..b205092 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -1265,17 +1265,36 @@ bool output_symbol_p (symtab_node node) { struct cgraph_node *cnode; - struct ipa_ref *ref; - if (!symtab_real_symbol_p (node)) return false; /* We keep external functions in symtab for sake of inlining and devirtualization. We do not want to see them in symbol table as - references. */ + references unless they are really used. */ cnode = dyn_cast <cgraph_node> (node); - if (cnode && DECL_EXTERNAL (cnode->symbol.decl)) - return (cnode->callers - || ipa_ref_list_referring_iterate (&cnode->symbol.ref_list, 0, ref)); + if (cnode && DECL_EXTERNAL (cnode->symbol.decl) + && cnode->callers) + return true; + + /* Ignore all references from external vars initializers - they are not really + part of the compilation unit until they are used by folding. Some symbols, + like references to external construction vtables can not be referred to at all. + We decide this at can_refer_decl_in_current_unit_p. */ + if (DECL_EXTERNAL (node->symbol.decl)) + { + int i; + struct ipa_ref *ref; + for (i = 0; ipa_ref_list_referring_iterate (&node->symbol.ref_list, + i, ref); i++) + { + if (ref->use == IPA_REF_ALIAS) + continue; + if (is_a <cgraph_node> (ref->referring)) + return true; + if (!DECL_EXTERNAL (ref->referring->symbol.decl)) + return true; + } + return false; + } return true; } |