https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65015
--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> --- 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