https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85238
--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Eric Botcazou from comment #7) > This doesn't seem to work: > > (gdb) run > The program being debugged has been started already. > Start it from the beginning? (y or n) [answered Y; input not from terminal] > Starting program: > c:\home\botcazou\anod-wave\x86_64-windows\gcc-gcc- > head\install\libexec\gcc\x86_64-pc-mingw32\8.0.1\cc1.exe -quiet -v -iprefix > c:homebotcazouanod-wavex86_64-windowsgcc-gcc-headinstallbin../lib/gcc/x86_64- > pc-mingw32/8.0.1/ t.c -quiet -dumpbase t.c "-mtune=generic" "-march=x86-64" > -auxbase t -g -version -flto -o C:tmpcc6RiDxZ.s > [New Thread 16284.0x1968] > > Breakpoint 1, 0x0000000000b4b4b0 in i386_pe_asm_lto_start() () > (gdb) bt > #0 0x0000000000b4b4b0 in i386_pe_asm_lto_start() () > #1 0x00000000005318bc in symbol_table::compile() [clone .part.74] () > #2 0x000000000053333b in symbol_table::finalize_compilation_unit() () > #3 0x000000000086b125 in compile_file() () > #4 0x00000000011a4ad3 in toplev::main(int, char**) () > #5 0x00000000011c5743 in main () > > $ gcc -o t t.c -flto -g > lto-wrapper.exe: fatal error: simple_object_copy_lto_debug_sections not > implemented: Invalid argument > > compilation terminated. > c:/home/botcazou/anod-wave/x86_64-windows/gcc-gcc-head/install/bin/../ > libexec/gcc/x86_64-pc-mingw32/8.0.1/ld.exe: error: lto-wrapper failed > collect2.exe: error: ld returned 1 exit status can you inspect the object file and see whether there's a .gnu.debuglto_.debug_info section? Or I guess more easily break in dwarf2out_early_finish and see whether/why debug_info_level isn't properly unset. Ah, quite naturally this doesn't work as the early_finish hook is called very much earlier... I wonder why this works on darwin and if it has additional bad side-effects there (disabling debug for the non-LTO path?)