summaryrefslogtreecommitdiff
path: root/gcc/lto
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2013-05-15 08:09:26 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2013-05-15 08:09:26 +0000
commit33864132630200ba0cdef1ace3619d0055a47e1a (patch)
treeb5bf9542ac17e96b9f1eab08c77364e8adba45c3 /gcc/lto
parent9b0c154affa210af04c3345bbe1f3e7550485a37 (diff)
downloadgcc-33864132630200ba0cdef1ace3619d0055a47e1a.tar.gz
PR lto/57038
PR lto/47375 * lto-symtab.c (lto_symtab_symbol_p): Add external symbol; weakrefs are not external. (lto_symtab_merge_decls): Fix thinko when dealing with non-lto_symtab decls. (lto_symtab_merge_cgraph_nodes): Use lto_symtab_symbol_p. (lto_symtab_prevailing_decl): Get int sync with lto_symtab_symbol_p. * varpool.c (dump_varpool_node): Dump more flags. * lto-partition.c (get_symbol_class): Fix weakrefs. (lto_balanced_map): Fix weakrefs. (privatize_symbol_name): Remove unnecesary label. (rename_statics): Handle weakrefs as statics. * gcc.dg/lto/attr-weakref-1_0.c: New testcase. * gcc.dg/lto/attr-weakref-1_1.c: New testcase. * gcc.dg/lto/attr-weakref-1_2.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198917 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto')
-rw-r--r--gcc/lto/ChangeLog9
-rw-r--r--gcc/lto/lto-partition.c22
2 files changed, 21 insertions, 10 deletions
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 87320693361..9a86b4958d7 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,12 @@
+2013-05-15 Jan Hubicka <jh@suse.cz>
+
+ PR lto/57038
+ PR lto/47375
+ * lto-partition.c (get_symbol_class): Fix weakrefs.
+ (lto_balanced_map): Fix weakrefs.
+ (privatize_symbol_name): Remove unnecesary label.
+ (rename_statics): Handle weakrefs as statics.
+
2013-05-09 Jan Hubicka <jh@suse.cz>
Richard Biener <rguenther@suse.de>
diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c
index 652272ac1ef..acf8f290237 100644
--- a/gcc/lto/lto-partition.c
+++ b/gcc/lto/lto-partition.c
@@ -59,6 +59,10 @@ get_symbol_class (symtab_node node)
if (cnode && cnode->global.inlined_to)
return SYMBOL_DUPLICATE;
+ /* Weakref aliases are always duplicated. */
+ if (lookup_attribute ("weakref", DECL_ATTRIBUTES (node->symbol.decl)))
+ return SYMBOL_DUPLICATE;
+
/* External declarations are external. */
if (DECL_EXTERNAL (node->symbol.decl))
return SYMBOL_EXTERNAL;
@@ -79,10 +83,6 @@ get_symbol_class (symtab_node node)
else if (!cgraph (node)->analyzed)
return SYMBOL_EXTERNAL;
- /* Weakref aliases are always duplicated. */
- if (lookup_attribute ("weakref", DECL_ATTRIBUTES (node->symbol.decl)))
- return SYMBOL_DUPLICATE;
-
/* Comdats are duplicated to every use unless they are keyed.
Those do not need duplication. */
if (DECL_COMDAT (node->symbol.decl)
@@ -561,7 +561,8 @@ lto_balanced_map (void)
last_visited_node++;
- gcc_assert (node->analyzed);
+ gcc_assert (node->analyzed
+ || lookup_attribute ("weakref", DECL_ATTRIBUTES (node->symbol.decl)));
/* Compute boundary cost of callgraph edges. */
for (edge = node->callees; edge; edge = edge->next_callee)
@@ -768,7 +769,6 @@ privatize_symbol_name (symtab_node node)
{
tree decl = node->symbol.decl;
const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
- char *label;
/* Our renaming machinery do not handle more than one change of assembler name.
We should not need more than one anyway. */
@@ -793,7 +793,6 @@ privatize_symbol_name (symtab_node node)
name);
return;
}
- ASM_FORMAT_PRIVATE_NAME (label, name, DECL_UID (decl));
change_decl_assembler_name (decl, clone_function_name (decl, "lto_priv"));
if (node->symbol.lto_file_data)
lto_record_renamed_decl (node->symbol.lto_file_data, name,
@@ -869,7 +868,8 @@ rename_statics (lto_symtab_encoder_t encoder, symtab_node node)
once this is fixed. */
|| DECL_EXTERNAL (node->symbol.decl)
|| !symtab_real_symbol_p (node))
- && !may_need_named_section_p (encoder, node))
+ && !may_need_named_section_p (encoder, node)
+ && !lookup_attribute ("weakref", DECL_ATTRIBUTES (node->symbol.decl)))
return;
/* Now walk symbols sharing the same name and see if there are any conflicts.
@@ -894,9 +894,11 @@ rename_statics (lto_symtab_encoder_t encoder, symtab_node node)
/* Assign every symbol in the set that shares the same ASM name an unique
mangled name. */
for (s = symtab_node_for_asm (name); s;)
- if (!s->symbol.externally_visible
+ if ((!s->symbol.externally_visible
+ || lookup_attribute ("weakref", DECL_ATTRIBUTES (node->symbol.decl)))
&& ((symtab_real_symbol_p (s)
- && !DECL_EXTERNAL (node->symbol.decl)
+ && (!DECL_EXTERNAL (node->symbol.decl)
+ || lookup_attribute ("weakref", DECL_ATTRIBUTES (node->symbol.decl)))
&& !TREE_PUBLIC (node->symbol.decl))
|| may_need_named_section_p (encoder, s))
&& (!encoder