https://sourceware.org/bugzilla/show_bug.cgi?id=27590
--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> --- Created attachment 13319 --> https://sourceware.org/bugzilla/attachment.cgi?id=13319&action=edit A testcase [hjl@gnu-cfl-2 pr27590]$ ld -r x.o.debug.temp.o x.o.debug.temp.o `.gnu.debuglto_.debug_macro' referenced in section `.gnu.debuglto_.debug_macro' of x.o.debug.temp.o: defined in discarded section `.gnu.debuglto_.debug_macro[wm4.wordsize.h.1.b68ef8235bd466c01307f942f7f51e04]' of x.o.debug.temp.o [hjl@gnu-cfl-2 pr27590]$ ld.gold -r x.o.debug.temp.o x.o.debug.temp.o gold output looks odd: [hjl@gnu-cfl-2 pr27590]$ readelf -SWg a.out There are 17 section headers, starting at offset 0x5f8: Section Headers: [Nr] Name Type Address Off Size ES Flg Lk Inf Al [ 0] NULL 0000000000000000 000000 000000 00 0 0 0 [ 1] wm4.wordsize.h.1.b68ef8235bd466c01307f942f7f51e04 GROUP 0000000000000000 000040 00000c 04 14 1 4 [ 2] .note.gnu.property NOTE 0000000000000000 000050 000020 00 A 0 0 8 [ 3] .gnu.debuglto_.debug_info PROGBITS 0000000000000000 000070 000042 00 0 0 1 [ 4] .gnu.debuglto_.debug_abbrev PROGBITS 0000000000000000 0000b2 000026 00 0 0 1 [ 5] .gnu.debuglto_.debug_macro PROGBITS 0000000000000000 0000d8 00002a 00 0 0 1 [ 6] .gnu.debuglto_.debug_macro PROGBITS 0000000000000000 000102 000010 00 G 0 0 1 [ 7] .gnu.debuglto_.debug_line PROGBITS 0000000000000000 000112 00008a 00 0 0 1 [ 8] .gnu.debuglto_.debug_str PROGBITS 0000000000000000 00019c 0000ae 01 MS 0 0 1 [ 9] .comment PROGBITS 0000000000000000 00024a 000030 01 MS 0 0 1 [10] .rela.gnu.debuglto_.debug_info RELA 0000000000000000 000280 0000f0 18 I 14 3 8 [11] .rela.gnu.debuglto_.debug_macro RELA 0000000000000000 000370 000048 18 I 14 5 8 [12] .rela.gnu.debuglto_.debug_macro RELA 0000000000000000 0003b8 000030 18 IG 14 6 8 [13] .note.GNU-stack PROGBITS 0000000000000000 0003e8 000000 00 0 0 0 [14] .symtab SYMTAB 0000000000000000 0003e8 0000f0 18 15 9 8 [15] .strtab STRTAB 0000000000000000 0004d8 000012 00 0 0 1 [16] .shstrtab STRTAB 0000000000000000 0004ea 00010e 00 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings), I (info), L (link order), O (extra OS processing required), G (group), T (TLS), C (compressed), x (unknown), o (OS specific), E (exclude), D (mbind), l (large), p (processor specific) COMDAT group section [ 1] `wm4.wordsize.h.1.b68ef8235bd466c01307f942f7f51e04' [wm4.wordsize.h.1.b68ef8235bd466c01307f942f7f51e04] contains 2 sections: [Index] Name [ 6] .gnu.debuglto_.debug_macro [ 12] .rela.gnu.debuglto_.debug_macro [hjl@gnu-cfl-2 pr27590]$ [hjl@gnu-cfl-2 pr27590]$ ld.lld -r x.o.debug.temp.o x.o.debug.temp.o ld.lld: warning: relocation refers to a discarded section: .gnu.debuglto_.debug_macro >>> referenced by x.o.debug.temp.o:(.rela.gnu.debuglto_.debug_macro+0x23) [hjl@gnu-cfl-2 pr27590]$ -- You are receiving this mail because: You are on the CC list for the bug.