summaryrefslogtreecommitdiff
path: root/gcc/cgraphunit.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2013-06-01 16:49:47 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2013-06-01 16:49:47 +0000
commit4cd8ae4b844d51eb02d0a8da666209769b5a5c8a (patch)
treeac2dce5005e18ed4f36c52a77912850f89152318 /gcc/cgraphunit.c
parente4f633f742566637af0fbc6a05e44a9b792a5a0f (diff)
downloadgcc-4cd8ae4b844d51eb02d0a8da666209769b5a5c8a.tar.gz
PR middle-end/57366
* cgraphunit.c (compile): When weakref is not supported, set up transparent aliases before final output pass. * varasm.c (assemble_alias): Do not try to do it here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@199583 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r--gcc/cgraphunit.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 76ef876aa47..6143e8f3bbb 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -1996,6 +1996,32 @@ compile (void)
bitmap_obstack_release (NULL);
mark_functions_to_output ();
+ /* When weakref support is missing, we autmatically translate all
+ references to NODE to references to its ultimate alias target.
+ The renaming mechanizm uses flag IDENTIFIER_TRANSPARENT_ALIAS and
+ TREE_CHAIN.
+
+ Set up this mapping before we output any assembler but once we are sure
+ that all symbol renaming is done.
+
+ FIXME: All this uglyness can go away if we just do renaming at gimple
+ level by physically rewritting the IL. At the moment we can only redirect
+ calls, so we need infrastructure for renaming references as well. */
+#ifndef ASM_OUTPUT_WEAKREF
+ symtab_node node;
+
+ FOR_EACH_SYMBOL (node)
+ if (node->symbol.alias
+ && lookup_attribute ("weakref", DECL_ATTRIBUTES (node->symbol.decl)))
+ {
+ IDENTIFIER_TRANSPARENT_ALIAS
+ (DECL_ASSEMBLER_NAME (node->symbol.decl)) = 1;
+ TREE_CHAIN (DECL_ASSEMBLER_NAME (node->symbol.decl))
+ = (node->symbol.alias_target ? node->symbol.alias_target
+ : DECL_ASSEMBLER_NAME (symtab_alias_target (node)->symbol.decl));
+ }
+#endif
+
cgraph_state = CGRAPH_STATE_EXPANSION;
if (!flag_toplevel_reorder)
output_in_order ();