From b9bd2075e20c6db31320ef73fa1721483f5d54f6 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Wed, 5 Jun 2013 00:58:22 +0200 Subject: [PATCH] lto-cgraph.c (get_alias_symbol): Remove weakref sanity check. * lto-cgraph.c (get_alias_symbol): Remove weakref sanity check. (input_node, input_varpool_node): Handle correctly external same body aliases. * ipa.c (symtab_remove_unreachable_nodes): Do not remove external nodes at ltrans stage. From-SVN: r199675 --- gcc/ChangeLog | 8 ++++++++ gcc/ipa.c | 6 +++++- gcc/lto-cgraph.c | 7 ++++--- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 690c9680e61..c168af85878 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2013-06-04 Jan Hubicka + + * lto-cgraph.c (get_alias_symbol): Remove weakref sanity check. + (input_node, input_varpool_node): Handle correctly external same + body aliases. + * ipa.c (symtab_remove_unreachable_nodes): Do not remove external + nodes at ltrans stage. + 2013-06-04 Jan Hubicka * ipa-inline.c (update_caller_keys): Fix availability test. diff --git a/gcc/ipa.c b/gcc/ipa.c index 5382b7a8f31..443d737c44a 100644 --- a/gcc/ipa.c +++ b/gcc/ipa.c @@ -387,7 +387,11 @@ symtab_remove_unreachable_nodes (bool before_inlining_p, FILE *file) for (vnode = varpool_first_variable (); vnode; vnode = vnext) { vnext = varpool_next_variable (vnode); - if (!vnode->symbol.aux) + if (!vnode->symbol.aux + /* For can_refer_decl_in_current_unit_p we want to track for + all external variables if they are defined in other partition + or not. */ + && (!flag_ltrans || !DECL_EXTERNAL (vnode->symbol.decl))) { if (file) fprintf (file, " %s", varpool_node_name (vnode)); diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c index 6699b8aa2ff..065d8480eb9 100644 --- a/gcc/lto-cgraph.c +++ b/gcc/lto-cgraph.c @@ -918,7 +918,6 @@ static tree get_alias_symbol (tree decl) { tree alias = lookup_attribute ("alias", DECL_ATTRIBUTES (decl)); - gcc_assert (lookup_attribute ("weakref", DECL_ATTRIBUTES (decl))); return get_identifier (TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (alias)))); } @@ -1008,7 +1007,8 @@ input_node (struct lto_file_decl_data *file_data, node->thunk.virtual_value = virtual_value; node->thunk.virtual_offset_p = (type & 4); } - if (node->symbol.alias && !node->symbol.analyzed) + if (node->symbol.alias && !node->symbol.analyzed + && lookup_attribute ("weakref", DECL_ATTRIBUTES (node->symbol.decl))) node->symbol.alias_target = get_alias_symbol (node->symbol.decl); return node; } @@ -1050,7 +1050,8 @@ input_varpool_node (struct lto_file_decl_data *file_data, DECL_EXTERNAL (node->symbol.decl) = 1; TREE_STATIC (node->symbol.decl) = 0; } - if (node->symbol.alias && !node->symbol.analyzed) + if (node->symbol.alias && !node->symbol.analyzed + && lookup_attribute ("weakref", DECL_ATTRIBUTES (node->symbol.decl))) node->symbol.alias_target = get_alias_symbol (node->symbol.decl); ref = streamer_read_hwi (ib); /* Store a reference for now, and fix up later to be a pointer. */