https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84847
--- Comment #20 from rguenther at suse dot de <rguenther at suse dot de> --- On Tue, 13 Mar 2018, nickc at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84847 > > --- Comment #14 from Nick Clifton <nickc at gcc dot gnu.org> --- > Created attachment 43643 > --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43643&action=edit > Proposed patch > > Hi Guys. > > Here is a possible patch, although it is a bit hackish. > Richard might not like it because it changes gcc/lto-wrapper.c rather than > the linker, but I honestly think that the linker is doing the right thing > in this case. Note with all workarounds proposed they have to "work" (aka not break) with non-GNU ld including gold, Solaris ld, HPUX ld, etc. ... I presume the linker plugin API doesn't allow us to even tell whether --gc-sections was specified for the link or not. So I agree with HJ that this needs to be fixed in the linker. Given there's a known workaround for users that isn't too bad.