summaryrefslogtreecommitdiff
path: root/gcc/cgraphunit.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2013-05-17 22:20:58 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2013-05-17 22:20:58 +0000
commitfc8456b4c99f339cd782b0990af3a7c107c9ced4 (patch)
tree53d9b1d7619f8f399786efc4b2699b0c661f580d /gcc/cgraphunit.c
parent59651d3b2414f63afae9bbf4da992c4789fbe6f1 (diff)
downloadgcc-fc8456b4c99f339cd782b0990af3a7c107c9ced4.tar.gz
* lto-symtab.c (lto_symtab_merge_cgraph_nodes): Resolve cross module
weakrefs. * cgraph.c (dump_cgraph_node): Do not ice on unresolved alias. * cgraphunit.c (handle_alias_pairs): Store target of unresolved weakrefs. (output_weakrefs): Update. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@199041 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r--gcc/cgraphunit.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 7fa8055878c..6ebf8d4aa06 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -1069,9 +1069,17 @@ handle_alias_pairs (void)
if (!target_node && lookup_attribute ("weakref", DECL_ATTRIBUTES (p->decl)) != NULL)
{
if (TREE_CODE (p->decl) == FUNCTION_DECL)
- cgraph_get_create_node (p->decl)->alias = true;
+ {
+ struct cgraph_node *anode = cgraph_get_create_node (p->decl);
+ anode->alias = true;
+ anode->thunk.alias = p->target;
+ }
else
- varpool_get_node (p->decl)->alias = true;
+ {
+ struct varpool_node *anode = varpool_get_node (p->decl);
+ anode->alias = true;
+ anode->alias_of = p->target;
+ }
DECL_EXTERNAL (p->decl) = 1;
alias_pairs->unordered_remove (i);
continue;
@@ -1939,14 +1947,14 @@ output_weakrefs (void)
&& !TREE_ASM_WRITTEN (node->symbol.decl)
&& lookup_attribute ("weakref", DECL_ATTRIBUTES (node->symbol.decl)))
do_assemble_alias (node->symbol.decl,
- node->thunk.alias ? DECL_ASSEMBLER_NAME (node->thunk.alias)
+ node->thunk.alias && DECL_P (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)))
do_assemble_alias (vnode->symbol.decl,
- vnode->alias_of ? DECL_ASSEMBLER_NAME (vnode->alias_of)
+ vnode->alias_of && DECL_P (vnode->alias_of) ? DECL_ASSEMBLER_NAME (vnode->alias_of)
: get_alias_symbol (vnode->symbol.decl));
}