https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99618
--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> --- (In reply to Jakub Jelinek from comment #6) > For normal non-LTO debug macro we emit: > .section .debug_macro,"",@progbits > .Ldebug_macro0: > .value 0x5 # DWARF macro version number > .byte 0x2 # Flags: 32-bit, lineptr present > .long .Ldebug_line0 > .byte 0x7 # Import > .long .Ldebug_macro2 > ... > .section > .debug_macro,"G",@progbits,wm4.0.d634b2ca9ddb72f687ab125549c033d0,comdat > .Ldebug_macro2: > .value 0x5 # DWARF macro version number > .byte 0 # Flags: 32-bit > .byte 0x5 # Define macro strp > .uleb128 0 # At line number 0 > ... > I don't see how that is any different from the above. The intent is (and it > has been working fine for years) that linker merges the comdat sections with > the same hash into one, and the import relocations resolve to the start of > that section. Same result: [hjl@gnu-cfl-2 pr27590]$ cat bad2.s .section .gnu.debuglto_.debug_macro,"",@progbits .Ldebug_macro0: .long .Ldebug_macro2 .section .gnu.debuglto_.debug_macro,"G",@progbits,wm4,comdat .Ldebug_macro2: .value 0x4 [hjl@gnu-cfl-2 pr27590]$ gcc -c bad2.s [hjl@gnu-cfl-2 pr27590]$ ld -r bad2.o bad2.o `.gnu.debuglto_.debug_macro' referenced in section `.gnu.debuglto_.debug_macro' of bad2.o: defined in discarded section `.gnu.debuglto_.debug_macro[wm4]' of bad2.o [hjl@gnu-cfl-2 pr27590]$