From 08346abd1968a14666f6a99ae8be09914d9ed088 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Wed, 12 Jun 2013 00:41:54 +0200 Subject: c-common.c (handle_alias_ifunc_attribute): Do not set DECL_EXTERNAL for weakref variables. * c-family/c-common.c (handle_alias_ifunc_attribute): Do not set DECL_EXTERNAL for weakref variables. * c-family/c-pragma.c (handle_pragma_weak): Make sure aliases are not declared as external. * cgraph.c (cgraph_create_function_alias): Set weakref flag. * cgraph.h (symtab_node_base): Add weakref flag. * cgraphunit.c (cgraph_reset_node): Clear weakref flag. (handle_alias_pairs): Set weakref flag, do not set DECL_EXTERNAL. (output_weakrefs): Use weakref flag. * fold-const.c (simple_operand_p): Handle WEAK. * gimple-fold.c (can_refer_decl_in_current_unit_p): Drop weakref. * ipa.c (varpool_externally_visible_p): Drop weakref. (function_and_variable_visibility): Update comment; fix weakref sanity checks; do not clear DECL_WEAK on them. * lto-cgraph.c (lto_output_node): update. (lto_output_varpool_node): Update. (input_overwrite_node): Update. (input_node): Update. (input_varpool_node): Update. * lto-symtab.c (lto_symtab_symbol_p): Do not special case weakrefs. (lto_symtab_merge_symbols): Add sanity check. (lto_symtab_prevailing_decl): Do not special case weakrefs. * passes.c (rest_of_decl_compilation): Set static flag, too. * symtab.c (dump_symtab_base): Dump weakref. (verify_symtab_base): Sanity check weakrefs. (symtab_make_decl_local): Remove duplicated code. (symtab_alias_ultimate_target): Simplify. * varpool.c (varpool_create_variable_alias): Set weakref flag. * lto-partition.c (get_symbol_class): Simplify weakref handling. (add_symbol_to_partition_1): Likewise. (contained_in_symbol): Likewise. (lto_balanced_map): Likewise. (rename_statics): Drop weakref. From-SVN: r199971 --- gcc/cgraphunit.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'gcc/cgraphunit.c') diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 044bdf7..016a6e4 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -379,6 +379,7 @@ cgraph_reset_node (struct cgraph_node *node) node->symbol.analyzed = false; node->symbol.definition = false; node->symbol.alias = false; + node->symbol.weakref = false; node->symbol.cpp_implicit_alias = false; cgraph_node_remove_callees (node); @@ -1021,9 +1022,9 @@ handle_alias_pairs (void) if (node) { node->symbol.alias_target = p->target; + node->symbol.weakref = true; node->symbol.alias = true; } - DECL_EXTERNAL (p->decl) = 1; alias_pairs->unordered_remove (i); continue; } @@ -1034,16 +1035,6 @@ handle_alias_pairs (void) continue; } - /* Normally EXTERNAL flag is used to mark external inlines, - however for aliases it seems to be allowed to use it w/o - any meaning. See gcc.dg/attr-alias-3.c - However for weakref we insist on EXTERNAL flag being set. - See gcc.dg/attr-alias-5.c */ - if (DECL_EXTERNAL (p->decl)) - DECL_EXTERNAL (p->decl) - = 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 @@ -1885,9 +1876,9 @@ output_weakrefs (void) { symtab_node node; FOR_EACH_SYMBOL (node) - if (node->symbol.alias && DECL_EXTERNAL (node->symbol.decl) + if (node->symbol.alias && !TREE_ASM_WRITTEN (node->symbol.decl) - && lookup_attribute ("weakref", DECL_ATTRIBUTES (node->symbol.decl))) + && node->symbol.weakref) { tree target; -- cgit v1.1