summaryrefslogtreecommitdiff
path: root/gcc/varpool.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2009-11-12 17:21:59 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2009-11-12 16:21:59 +0000
commita82892595bc3b2a84b13455711a609138dbcb052 (patch)
treefc25b09495438c43fe8c72dd5a37344a2338dc1a /gcc/varpool.c
parent06bd7f563b5358d34b592e9d630ad770c3ec15c2 (diff)
downloadgcc-a82892595bc3b2a84b13455711a609138dbcb052.tar.gz
cgraph.h (varpool_node_name): Declare.
* cgraph.h (varpool_node_name): Declare. * cgraphunit.c (process_function_and_variable_attributes): Set force_output flag on used variables. * ipa.c (function_and_variable_visibility): Dump externally visible and needed variables. * varpool.c (varpool_node_name): Export. (decide_is_variable_needed): Check COMDAT for externally visible vars; ignore needed flag. From-SVN: r154121
Diffstat (limited to 'gcc/varpool.c')
-rw-r--r--gcc/varpool.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/gcc/varpool.c b/gcc/varpool.c
index 8815efda249..90a9ace0ff9 100644
--- a/gcc/varpool.c
+++ b/gcc/varpool.c
@@ -80,7 +80,7 @@ static GTY(()) struct varpool_node *varpool_first_unanalyzed_node;
static GTY(()) struct varpool_node *varpool_assembled_nodes_queue;
/* Return name of the node used in debug output. */
-static const char *
+const char *
varpool_node_name (struct varpool_node *node)
{
return lang_hooks.decl_printable_name (node->decl, 2);
@@ -229,7 +229,8 @@ bool
decide_is_variable_needed (struct varpool_node *node, tree decl)
{
/* If the user told us it is used, then it must be so. */
- if (node->externally_visible || node->force_output)
+ if ((node->externally_visible && !DECL_COMDAT (decl))
+ || node->force_output)
return true;
/* ??? If the assembler name is set by hand, it is possible to assemble
@@ -239,11 +240,6 @@ decide_is_variable_needed (struct varpool_node *node, tree decl)
&& TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
return true;
- /* If we decided it was needed before, but at the time we didn't have
- the definition available, then it's still needed. */
- if (node->needed)
- return true;
-
/* Externally visible variables must be output. The exception is
COMDAT variables that must be output only when they are needed. */
if (TREE_PUBLIC (decl)