https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84923
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- So in spirit of the comment#2 patch I'd propose Index: gcc/varasm.c =================================================================== --- gcc/varasm.c (revision 259638) +++ gcc/varasm.c (working copy) @@ -5641,7 +5641,8 @@ weak_finish (void) tree alias_decl = TREE_PURPOSE (t); tree target = ultimate_transparent_alias_target (&TREE_VALUE (t)); - if (! TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (alias_decl))) + if (! TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (alias_decl)) + || TREE_SYMBOL_REFERENCED (target)) /* Remove alias_decl from the weak list, but leave entries for the target alone. */ target = NULL_TREE; given do_assemble_alias skips the weak_finish part if TREE_SYMBOL_REFERENCED (target) and thus will not end up removing target from the alias list. The above makes both paths match.