aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraphunit.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2012-05-17 16:37:33 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2012-05-17 16:37:33 +0000
commitaa419a527f91567691f226133efb0469b59359ac (patch)
treec091b61bf18ed877244605adef29bd8f35c140b1 /gcc/cgraphunit.c
parent2572143c16564137a3042a04b9eca06ef5919600 (diff)
* lto-symtab.c (lto_symtab_resolve_symbols): Preffer decl with constructor
over decl without. * cgraph.c (cgraph_remove_node): Clear also body of unanalyzed nodes. * cgraph.h (varpool_can_remove_if_no_refs): Handle external correctly. * cgraphunit.c (process_function_and_variable_attributes): Finalize extrnal decls. (mark_functions_to_output): Also accept bodies for functions with clones. (output_in_order): Skip external vars. * lto-cgraph.c (lto_output_node): External functions are never in other partition. (lto_output_varpool_node): Likewise. * lto-streamer-out.c (lto_write_tree): Always use error_mark_nodes for forgotten initializers. * ipa.c (process_references): Handle external vars. (symtab_remove_unreachable_nodes): Update to handle external vars. (varpool_externally_visible_p): External vars are externally visible. * gimple-fold.c (can_refer_decl_in_current_unit_p): Update. * varpool.c (varpool_remove_node): Remove constructor. (decide_is_variable_needed): Handle externals. (varpool_remove_unreferenced_decls): Likewise. * lto-partition.c (add_references_to_partition): Handle external vars. (partition_varpool_node_p): Likewise. (lto_promote_cross_file_statics): Do not promote externals. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@187631 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r--gcc/cgraphunit.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index c21ddb84c2f..97e810e5f2a 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -782,6 +782,10 @@ process_function_and_variable_attributes (struct cgraph_node *first,
vnode = varpool_next_variable (vnode))
{
tree decl = vnode->symbol.decl;
+ if (DECL_EXTERNAL (decl)
+ && DECL_INITIAL (decl)
+ && const_value_known_p (decl))
+ varpool_finalize_decl (decl);
if (DECL_PRESERVE_P (decl))
vnode->symbol.force_output = true;
else if (lookup_attribute ("externally_visible", DECL_ATTRIBUTES (decl)))
@@ -1161,6 +1165,8 @@ mark_functions_to_output (void)
gcc_assert (node->global.inlined_to
|| !gimple_has_body_p (decl)
|| node->symbol.in_other_partition
+ || node->clones
+ || DECL_ARTIFICIAL (decl)
|| DECL_EXTERNAL (decl));
}
@@ -1760,12 +1766,13 @@ output_in_order (void)
}
FOR_EACH_DEFINED_VARIABLE (pv)
- {
- i = pv->symbol.order;
- gcc_assert (nodes[i].kind == ORDER_UNDEFINED);
- nodes[i].kind = ORDER_VAR;
- nodes[i].u.v = pv;
- }
+ if (!DECL_EXTERNAL (pv->symbol.decl))
+ {
+ i = pv->symbol.order;
+ gcc_assert (nodes[i].kind == ORDER_UNDEFINED);
+ nodes[i].kind = ORDER_VAR;
+ nodes[i].u.v = pv;
+ }
for (pa = asm_nodes; pa; pa = pa->next)
{