https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65015
--- Comment #16 from H.J. Lu <hjl.tools at gmail dot com> --- (In reply to Richard Biener from comment #11) > For reference, the following patch doesn't work: > > Index: gcc/varasm.c > =================================================================== > --- gcc/varasm.c (revision 220677) > +++ gcc/varasm.c (working copy) > @@ -7042,7 +7042,9 @@ default_file_start (void) > && !(flag_verbose_asm || flag_debug_asm || flag_dump_rtl_in_asm)) > fputs (ASM_APP_OFF, asm_out_file); > > - if (targetm.asm_file_start_file_directive) > + if (targetm.asm_file_start_file_directive > + /* LTO produced units have no meaningful main_input_filename. */ > + && !in_lto_p) > output_file_directive (asm_out_file, main_input_filename); > } > > and -g is not necessary to trigger the bogus tempfile name in .symtab This patch works together with BFD linker patch: https://sourceware.org/ml/binutils/2015-02/msg00193.html