https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81968
--- Comment #55 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> --- > --- Comment #54 from Richard Biener <rguenth at gcc dot gnu.org> --- > Created attachment 43075 > --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43075&action=edit > Updated patch with SHT_GROUP and extended section index handling > > More fixes accumulated. Works for the large # input section testcase now. > Also goes happily into stage2 with bootstrap-lto. Solaris ld is almost happy again with this patch :-) There's one last failure remaining: FAIL: gcc.dg/debug/pr41893-1.c -gdwarf-2 -g3 (test for excess errors) Excess errors: ld: fatal: relocation error: R_386_32: file /var/tmp//cctCq6ccdebugobjtem: section [11].rel.debug_macro: symbol .debug_macro%wm4.0.3a71fa84800da6806674b2243f0bb574 (section): symbol has been discarded with discarded section: [6].debug_macro%wm4.0.3a71fa84800da6806674b2243f0bb574 Compiling the test with -save-temps works, however... Here's what I find: the error happens during the ld -r stage again. The invocations boil down to $ lto-wrapper pr41893-1.o pr41893-2.o $ ld -r -o ccO7nK8bdebugobj cc0vpSPddebugobjtem ccTcSAFadebugobjtem elfdump complains about those objects: cc0vpSPddebugobjtem: [2: .group%wm4.0.3a71fa84800da6806674b2243f0bb574][2]: invalid section index: 0 as can be seen with elfdump -g: Group Section: .group%wm4.0.3a71fa84800da6806674b2243f0bb574 Signature Symbol: wm4.0.3a71fa84800da6806674b2243f0bb574 Members: index flags / section [0] [ COMDAT ] [1] .debug_macro%wm4.0.3a71fa84800da6806674b2243f0bb574 [2] <invalid section> while readelf -g doesn't seem to care about the section index here: COMDAT group section [ 2] `.group%wm4.0.3a71fa84800da6806674b2243f0bb574' [wm4.0.3a71fa84800da6806674b2243f0bb574] contains 2 sections: [Index] Name [ 6] .debug_macro%wm4.0.3a71fa84800da6806674b2243f0bb574 [ 0] The input object had COMDAT group section [ 2] `.group%wm4.0.3a71fa84800da6806674b2243f0bb574' [wm4.0.3a71fa84800da6806674b2243f0bb574] contains 2 sections: [Index] Name [ 7] .gnu.debuglto_.debug_macro%wm4.0.3a71fa84800da6806674b2243f0bb574 [ 25] .debug_macro%wm4.0.3a71fa84800da6806674b2243f0bb574 Rainer