https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58203
--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> --- The basic problem is the gimple IR has no reference to either memset or memcpy in the case of zeroing aggregates or copying them. So the linker does think memset/memcpy is needed. And then when gcc expands the zeroing or copying, a reference happens but it is already too late to bring back in them. Marking memset/memcpy as used should bring in the reference to them if memcpy/memset is only in lto ir.