summaryrefslogtreecommitdiff
path: root/gcc/cgraph.h
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2015-11-29 23:33:23 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2015-11-29 22:33:23 +0000
commitf1703a2e2b3fefa60a70e08f30be5fb4a7fd8b4f (patch)
treeb119bcfa394a1eeb2b5f120d0165f4e631cf136b /gcc/cgraph.h
parenta4850ce9b58d12158248dc7fbe1015646757c813 (diff)
downloadgcc-f1703a2e2b3fefa60a70e08f30be5fb4a7fd8b4f.tar.gz
cgraph.c (cgraph_node::make_local): No name is unique during incremental linking.
* cgraph.c (cgraph_node::make_local): No name is unique during incremental linking. * cgraph.h (can_be_discarded_p): Update comment; also common and WEAK in named sections can be discarded; when doing incremental link do not rely on resolution being the final one. * varasm.c (default_binds_local_p_3, decl_binds_to_current_def_p): When symbol can be discarded, do not rely on resolution info. * symtab.c (symtab_node::nonzero_address): Take into account that symbol can be discarded. * ipa-visibility.c (update_visibility_by_resolution_info): Handle definition correctly. (function_and_variable_visibility): Do not set unique_name when incrementally linking. From-SVN: r231050
Diffstat (limited to 'gcc/cgraph.h')
-rw-r--r--gcc/cgraph.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index b6390995ab9..6cff4468cc0 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -319,15 +319,23 @@ public:
/* Return true when there are references to the node. */
bool referred_to_p (bool include_self = true);
- /* Return true if NODE can be discarded by linker from the binary. */
+ /* Return true if symbol can be discarded by linker from the binary.
+ Assume that symbol is used (so there is no need to take into account
+ garbage collecting linkers)
+
+ This can happen for comdats, commons and weaks when they are previaled
+ by other definition at static linking time. */
inline bool
can_be_discarded_p (void)
{
return (DECL_EXTERNAL (decl)
- || (get_comdat_group ()
- && resolution != LDPR_PREVAILING_DEF
- && resolution != LDPR_PREVAILING_DEF_IRONLY
- && resolution != LDPR_PREVAILING_DEF_IRONLY_EXP));
+ || ((get_comdat_group ()
+ || DECL_COMMON (decl)
+ || (DECL_SECTION_NAME (decl) && DECL_WEAK (decl)))
+ && ((resolution != LDPR_PREVAILING_DEF
+ && resolution != LDPR_PREVAILING_DEF_IRONLY_EXP)
+ || flag_incremental_link)
+ && resolution != LDPR_PREVAILING_DEF_IRONLY));
}
/* Return true if NODE is local to a particular COMDAT group, and must not