&& !node->forced_by_abi
&& !symtab_used_from_object_file_p (node)
&& !node->same_comdat_group)
- || DECL_EXTERNAL (node->decl)
|| !node->externally_visible));
}
{
symtab_make_decl_local (node->decl);
+ node->set_section (NULL);
node->set_comdat_group (NULL);
node->externally_visible = false;
node->forced_by_abi = false;
node->local.local = true;
- node->reset_section ();
+ node->set_section (NULL);
node->unique_name = (node->resolution == LDPR_PREVAILING_DEF_IRONLY
- || node->unique_name
- || node->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP);
+ || node->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP);
node->resolution = LDPR_PREVAILING_DEF_IRONLY;
gcc_assert (cgraph_function_body_availability (node) == AVAIL_LOCAL);
}
return true;
if (node->resolution == LDPR_PREVAILING_DEF_IRONLY)
return false;
- /* When doing LTO or whole program, we can bring COMDAT functions static.
+ /* When doing LTO or whole program, we can bring COMDAT functoins static.
This improves code quality and we know we will duplicate them at most twice
(in the case that we are not using plugin and link with object file
implementing same COMDAT) */
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. */
+ if (symtab_used_from_object_file_p (vnode))
+ return true;
if (vnode->resolution == LDPR_PREVAILING_DEF_IRONLY)
return false;
if (!node->externally_visible
|| (!DECL_WEAK (node->decl) && !DECL_ONE_ONLY (node->decl))
- || node->resolution == LDPR_UNKNOWN
- || node->resolution == LDPR_UNDEF)
+ || node->resolution == LDPR_UNKNOWN)
return;
define = (node->resolution == LDPR_PREVAILING_DEF_IRONLY
if (node->same_comdat_group)
for (symtab_node *next = node->same_comdat_group;
next != node; next = next->same_comdat_group)
- gcc_assert (!next->externally_visible
+ gcc_assert (!node->externally_visible
|| define == (next->resolution == LDPR_PREVAILING_DEF_IRONLY
|| next->resolution == LDPR_PREVAILING_DEF
|| next->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP));
if (next->externally_visible
&& !define)
DECL_EXTERNAL (next->decl) = true;
- if (!next->alias)
- next->reset_section ();
}
node->set_comdat_group (NULL);
DECL_WEAK (node->decl) = false;
if (!define)
DECL_EXTERNAL (node->decl) = true;
- if (!node->alias)
- node->reset_section ();
symtab_dissolve_same_comdat_group_list (node);
}
symtab_dissolve_same_comdat_group_list (node);
}
gcc_assert ((!DECL_WEAK (node->decl)
- && !DECL_COMDAT (node->decl))
+ && !DECL_COMDAT (node->decl))
|| TREE_PUBLIC (node->decl)
|| node->weakref
|| DECL_EXTERNAL (node->decl));
&& node->definition && !node->weakref
&& !DECL_EXTERNAL (node->decl))
{
- bool reset = TREE_PUBLIC (node->decl);
gcc_assert (whole_program || in_lto_p
|| !TREE_PUBLIC (node->decl));
node->unique_name = ((node->resolution == LDPR_PREVAILING_DEF_IRONLY
next = next->same_comdat_group)
{
next->set_comdat_group (NULL);
+ if (!next->alias)
+ next->set_section (NULL);
symtab_make_decl_local (next->decl);
- if (!node->alias)
- node->reset_section ();
next->unique_name = ((next->resolution == LDPR_PREVAILING_DEF_IRONLY
|| next->unique_name
|| next->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP)
}
if (TREE_PUBLIC (node->decl))
node->set_comdat_group (NULL);
+ if (DECL_COMDAT (node->decl) && !node->alias)
+ node->set_section (NULL);
symtab_make_decl_local (node->decl);
- if (reset && !node->alias)
- node->reset_section ();
}
if (node->thunk.thunk_p
if (!vnode->externally_visible
&& !vnode->weakref)
{
- bool reset = TREE_PUBLIC (vnode->decl);
gcc_assert (in_lto_p || whole_program || !TREE_PUBLIC (vnode->decl));
vnode->unique_name = ((vnode->resolution == LDPR_PREVAILING_DEF_IRONLY
|| vnode->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP)
next = next->same_comdat_group)
{
next->set_comdat_group (NULL);
- symtab_make_decl_local (next->decl);
if (!next->alias)
- next->reset_section ();
+ next->set_section (NULL);
+ symtab_make_decl_local (next->decl);
next->unique_name = ((next->resolution == LDPR_PREVAILING_DEF_IRONLY
|| next->unique_name
|| next->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP)
}
if (TREE_PUBLIC (vnode->decl))
vnode->set_comdat_group (NULL);
+ if (DECL_COMDAT (vnode->decl) && !vnode->alias)
+ vnode->set_section (NULL);
symtab_make_decl_local (vnode->decl);
- if (reset && !vnode->alias)
- vnode->reset_section ();
vnode->resolution = LDPR_PREVAILING_DEF_IRONLY;
}
update_visibility_by_resolution_info (vnode);