https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96389
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- You also want -O2 and maybe -g in your CXXFLAGS_FOR_TARGET, I'm not sure if LTO IL in libgcc_s.a or libstdc++.a "works" for consumers or if there's unintended side-effects of LTOing those system pieces. I think altering CXXFLAGS_FOR_TARGET (plus CFLAGS_FOR_TARGET) is correct though. Not sure about LTO and MinGW-w64 in general. If the linker plugin is not supported then it would be still second class. It definitely is second class with respect to debug info support because it's not using ELF.