http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47333
--- Comment #22 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-06 13:49:08 UTC --- I think this is an ordering problem. When not using lto, assemble_alias is called on the weakref __gthrw_pthread_once with pthread_once target (etc.) early, from the FE which calls rest_of_decl_compilation, and when ASM_OUTPUT_WEAKREF is not defined, this among other things sets IDENTIFIER_TRANSPARENT_ALIAS (alias) = 1; and TREE_CHAIN (alias) = target; But the LTO FE doesn't call assemble_alias early, first emits assembly for the routines, and only at the end calls output_weakrefs. Thus during assembly of the functions we don't handle the weakrefs as transparent aliases. Can't we just move up output_weakrefs before cgraph_output_in_order/cgraph_expand_all_functions/cgraph_output_pending_asms?