diff options
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r-- | gcc/cgraph.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index b9b1b14..af84ebf 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -807,7 +807,8 @@ bool decide_is_variable_needed (struct cgraph_varpool_node *node, tree decl) { /* If the user told us it is used, then it must be so. */ - if (lookup_attribute ("used", DECL_ATTRIBUTES (decl))) + if (node->externally_visible + || lookup_attribute ("used", DECL_ATTRIBUTES (decl))) return true; /* ??? If the assembler name is set by hand, it is possible to assemble @@ -863,7 +864,7 @@ cgraph_varpool_finalize_decl (tree decl) /* Since we reclaim unreachable nodes at the end of every language level unit, we need to be conservative about possible entry points there. */ - if (TREE_PUBLIC (decl) && !DECL_COMDAT (decl) && !DECL_EXTERNAL (decl)) + else if (TREE_PUBLIC (decl) && !DECL_COMDAT (decl) && !DECL_EXTERNAL (decl)) cgraph_varpool_mark_needed_node (node); if (cgraph_global_info_ready || !flag_unit_at_a_time) cgraph_varpool_assemble_pending_decls (); |