The symbol table is constructed starting from the trivially needed
symbols finalized by the frontend. Functions are lowered into
GIMPLE representation and callgraph/reference lists are constructed.
- Those are used to discover other neccesary functions and variables.
+ Those are used to discover other necessary functions and variables.
At the end the bodies of unreachable functions are removed.
/* Determine if function DECL is trivially needed and should stay in the
compilation unit. This is used at the symbol table construction time
- and differs from later logic removing unnecesary functions that can
+ and differs from later logic removing unnecessary functions that can
take into account results of analysis, whole program info etc. */
static bool
if (!cgraph_new_nodes)
return false;
- finish_aliases_1 ();
handle_alias_pairs ();
/* Note that this queue may grow as its being processed, as the new
functions may generate new ones. */
{
struct ipa_ref *ref;
- /* See if there are any refrences at all. */
+ /* See if there are any references at all. */
if (ipa_ref_list_referring_iterate (&node->symbol.ref_list, 0, ref))
return true;
/* For functions check also calls. */
= lookup_attribute ("weakref",
DECL_ATTRIBUTES (p->decl)) != NULL;
+ if (DECL_EXTERNAL (target_node->symbol.decl)
+ /* We use local aliases for C++ thunks to force the tailcall
+ to bind locally. This is a hack - to keep it working do
+ the following (which is not strictly correct). */
+ && (! TREE_CODE (target_node->symbol.decl) == FUNCTION_DECL
+ || ! DECL_VIRTUAL_P (target_node->symbol.decl))
+ && ! lookup_attribute ("weakref", DECL_ATTRIBUTES (p->decl)))
+ {
+ error ("%q+D aliased to external symbol %qE",
+ p->decl, p->target);
+ }
+
if (TREE_CODE (p->decl) == FUNCTION_DECL
&& target_node && symtab_function_p (target_node))
{
end up not removing the body since we no longer have an
analyzed node pointing to it. */
&& !node->symbol.in_other_partition
+ && !node->clones
&& !DECL_EXTERNAL (decl))
{
dump_cgraph_node (stderr, node);
-/* Assemble thunks and aliases asociated to NODE. */
+/* Assemble thunks and aliases associated to NODE. */
static void
assemble_thunks_and_aliases (struct cgraph_node *node)
/* Force assemble_alias to really output the alias this time instead
of buffering it in same alias pairs. */
TREE_ASM_WRITTEN (alias->thunk.alias) = 1;
- assemble_alias (alias->symbol.decl,
- DECL_ASSEMBLER_NAME (alias->thunk.alias));
+ do_assemble_alias (alias->symbol.decl,
+ DECL_ASSEMBLER_NAME (alias->thunk.alias));
assemble_thunks_and_aliases (alias);
TREE_ASM_WRITTEN (alias->thunk.alias) = saved_written;
}
/* Weakrefs may be associated to external decls and thus not output
- at expansion time. Emit all neccesary aliases. */
+ at expansion time. Emit all necessary aliases. */
static void
output_weakrefs (void)
if (node->alias && DECL_EXTERNAL (node->symbol.decl)
&& !TREE_ASM_WRITTEN (node->symbol.decl)
&& lookup_attribute ("weakref", DECL_ATTRIBUTES (node->symbol.decl)))
- assemble_alias (node->symbol.decl,
- node->thunk.alias ? DECL_ASSEMBLER_NAME (node->thunk.alias)
- : get_alias_symbol (node->symbol.decl));
+ do_assemble_alias (node->symbol.decl,
+ node->thunk.alias ? DECL_ASSEMBLER_NAME (node->thunk.alias)
+ : get_alias_symbol (node->symbol.decl));
FOR_EACH_VARIABLE (vnode)
if (vnode->alias && DECL_EXTERNAL (vnode->symbol.decl)
&& !TREE_ASM_WRITTEN (vnode->symbol.decl)
&& lookup_attribute ("weakref", DECL_ATTRIBUTES (vnode->symbol.decl)))
- assemble_alias (vnode->symbol.decl,
- vnode->alias_of ? DECL_ASSEMBLER_NAME (vnode->alias_of)
- : get_alias_symbol (vnode->symbol.decl));
+ do_assemble_alias (vnode->symbol.decl,
+ vnode->alias_of ? DECL_ASSEMBLER_NAME (vnode->alias_of)
+ : get_alias_symbol (vnode->symbol.decl));
}
/* Initialize callgraph dump file. */
#endif
bitmap_obstack_release (NULL);
mark_functions_to_output ();
- output_weakrefs ();
cgraph_state = CGRAPH_STATE_EXPANSION;
if (!flag_toplevel_reorder)
cgraph_process_new_functions ();
cgraph_state = CGRAPH_STATE_FINISHED;
+ output_weakrefs ();
if (cgraph_dump_file)
{
finalize_size_functions ();
/* Mark alias targets necessary and emit diagnostics. */
- finish_aliases_1 ();
handle_alias_pairs ();
if (!quiet_flag)
cgraph_analyze_functions ();
/* Mark alias targets necessary and emit diagnostics. */
- finish_aliases_1 ();
handle_alias_pairs ();
/* Gimplify and lower thunks. */