node->symbol.previous = NULL;
slot = htab_find_slot (symtab_hash, node, NO_INSERT);
- if (*slot == node)
+
+ /* During LTO symtab merging we temporarily corrupt decl to symtab node
+ hash. */
+ gcc_assert ((slot && *slot) || in_lto_p);
+ if (slot && *slot && *slot == node)
{
symtab_node replacement_node = NULL;
if (cgraph_node *cnode = dyn_cast <cgraph_node> (node))
symtab_node *slot;
struct symtab_node_base key;
+#ifdef ENABLE_CHECKING
+ /* Check that we are called for sane type of object - functions
+ and static or external variables. */
gcc_checking_assert (TREE_CODE (decl) == FUNCTION_DECL
|| (TREE_CODE (decl) == VAR_DECL
&& (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
|| in_lto_p)));
+#endif
if (!symtab_hash)
return NULL;
fprintf (f, " analyzed");
if (node->symbol.alias)
fprintf (f, " alias");
+ if (node->symbol.weakref)
+ fprintf (f, " weakref");
if (node->symbol.cpp_implicit_alias)
fprintf (f, " cpp_implicit_alias");
if (node->symbol.alias_target)
fprintf (f, " used_from_other_partition");
if (node->symbol.force_output)
fprintf (f, " force_output");
+ if (node->symbol.forced_by_abi)
+ fprintf (f, " forced_by_abi");
+ if (node->symbol.externally_visible)
+ fprintf (f, " externally_visible");
if (node->symbol.resolution != LDPR_UNKNOWN)
fprintf (f, " %s",
ld_plugin_symbol_resolution_names[(int)node->symbol.resolution]);
error_found = true;
}
- hashed_node = symtab_get_node (node->symbol.decl);
- if (!hashed_node)
+ if (cgraph_state != CGRAPH_LTO_STREAMING)
{
- error ("node not found in symtab decl hashtable");
- error_found = true;
+ hashed_node = symtab_get_node (node->symbol.decl);
+ if (!hashed_node)
+ {
+ error ("node not found in symtab decl hashtable");
+ error_found = true;
+ }
+ if (hashed_node != node
+ && (!is_a <cgraph_node> (node)
+ || !dyn_cast <cgraph_node> (node)->clone_of
+ || dyn_cast <cgraph_node> (node)->clone_of->symbol.decl
+ != node->symbol.decl))
+ {
+ error ("node differs from symtab decl hashtable");
+ error_found = true;
+ }
}
if (assembler_name_hash)
{
error_found = true;
}
if (node->symbol.alias && !node->symbol.definition
- && !lookup_attribute ("weakref", DECL_ATTRIBUTES (node->symbol.decl)))
+ && !node->symbol.weakref)
{
error ("node is alias but not definition");
error_found = true;
}
+ if (node->symbol.weakref && !node->symbol.alias)
+ {
+ error ("node is weakref but not an alias");
+ error_found = true;
+ }
if (node->symbol.same_comdat_group)
{
symtab_node n = node->symbol.same_comdat_group;
DECL_VISIBILITY_SPECIFIED (decl) = 0;
DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT;
TREE_PUBLIC (decl) = 0;
- DECL_VISIBILITY_SPECIFIED (decl) = 0;
- DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT;
if (!DECL_RTL_SET_P (decl))
return;
if (availability)
{
- weakref_p = DECL_EXTERNAL (node->symbol.decl) && node->symbol.alias;
+ weakref_p = node->symbol.weakref;
if (!weakref_p)
*availability = symtab_node_availability (node);
else
enum availability a = symtab_node_availability (node);
if (a < *availability)
*availability = a;
- weakref_p = DECL_EXTERNAL (node->symbol.decl) && node->symbol.alias;
+ weakref_p = node->symbol.weakref;
}
}
if (availability)
We do not want to keep it around or we would have to mind updating them
when renaming symbols. */
node->symbol.alias_target = NULL;
- DECL_ATTRIBUTES (node->symbol.decl)
- = remove_attribute ("alias", DECL_ATTRIBUTES (node->symbol.decl));
if (node->symbol.cpp_implicit_alias && cgraph_state >= CGRAPH_STATE_CONSTRUCTION)
fixup_same_cpp_alias_visibility (node, target);