https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68881
--- Comment #16 from Jan Hubicka <hubicka at ucw dot cz> --- Hi, I am testing the attached patch and would apprechiate testing on any additional targets. It implements the optimization of weakref to non-weakref in the case the target is defined in same TU. Unfortunately this is not cmopletely trivial as I had to bring in the symbol privatization bits. Next stage1 I will cleanup the privatization little bit. Also this patch does not solve all cases - if you define weakref target in !binds_to_current_def then the transparent alias must be created and this can't be done for symbols marked as used. We need to eventually fix gas to handle the case. Honza