[Bug middle-end/57366] gcc.dg/lto/attr-weakref-1 FAILs
hubicka at ucw dot cz
gcc-bugzilla@gcc.gnu.org
Sat Jun 1 14:57:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57366
--- Comment #14 from Jan Hubicka <hubicka at ucw dot cz> ---
Hi,
the problems with weakref are bit deeper than I though. They way RTL rewriting
is done
breaks completely with any symbol renaming that is quite common with LTO. I am
testing
the following
Index: cgraphunit.c
===================================================================
--- cgraphunit.c (revision 199577)
+++ cgraphunit.c (working copy)
@@ -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 ();
More information about the Gcc-bugs
mailing list