ipa.c (cgraph_externally_visible_p, [...]): Use info provided by linker plugin.

* ipa.c (cgraph_externally_visible_p, varpool_externally_visible_p):
	Use info provided by linker plugin.

From-SVN: r165978
This commit is contained in:
Jan Hubicka 2010-10-26 20:34:03 +02:00 committed by Jan Hubicka
parent 0e0f02ff92
commit 892ae21cc7
2 changed files with 24 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2010-10-26 Jan Hubicka <jh@suse.cz>
* ipa.c (cgraph_externally_visible_p, varpool_externally_visible_p):
Use info provided by linker plugin.
2010-10-26 Jason Merrill <jason@redhat.com>
* varasm.c (constructor_static_from_elts_p): Don't require a

View file

@ -603,6 +603,7 @@ ipa_discover_readonly_nonaddressable_vars (void)
static bool
cgraph_externally_visible_p (struct cgraph_node *node, bool whole_program, bool aliased)
{
struct cgraph_node *alias;
if (!node->local.finalized)
return false;
if (!DECL_COMDAT (node->decl)
@ -622,6 +623,18 @@ cgraph_externally_visible_p (struct cgraph_node *node, bool whole_program, bool
if (lookup_attribute ("externally_visible", DECL_ATTRIBUTES (node->decl)))
return true;
/* See if we have linker information about symbol not being used or
if we need to make guess based on the declaration.
Even if the linker clams the symbol is unused, never bring internal
symbols that are declared by user as used or externally visible.
This is needed for i.e. references from asm statements. */
for (alias = node->same_body; alias; alias = alias->next)
if (alias->resolution != LDPR_PREVAILING_DEF_IRONLY)
break;
if (!alias && node->resolution == LDPR_PREVAILING_DEF_IRONLY)
return false;
/* When doing link time optimizations, hidden symbols become local. */
if (in_lto_p
&& (DECL_VISIBILITY (node->decl) == VISIBILITY_HIDDEN
@ -665,6 +678,7 @@ cgraph_externally_visible_p (struct cgraph_node *node, bool whole_program, bool
static bool
varpool_externally_visible_p (struct varpool_node *vnode, bool aliased)
{
struct varpool_node *alias;
if (!DECL_COMDAT (vnode->decl) && !TREE_PUBLIC (vnode->decl))
return false;
@ -691,6 +705,11 @@ varpool_externally_visible_p (struct varpool_node *vnode, bool aliased)
This is needed for i.e. references from asm statements. */
if (varpool_used_from_object_file_p (vnode))
return true;
for (alias = vnode->extra_name; alias; alias = alias->next)
if (alias->resolution != LDPR_PREVAILING_DEF_IRONLY)
break;
if (!alias && vnode->resolution == LDPR_PREVAILING_DEF_IRONLY)
return false;
/* When doing link time optimizations, hidden symbols become local. */
if (in_lto_p