I am trying to compile my project with LTO using the GCC 7.2 RC1 from earlier this week. Previously, this was compiled successfully with 6.2.0, and I have not tried any other 7 series release. The error in question is: `_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev' referenced in section `.text.startup' of/tmp/ccaymMp.ltrans5.ltrans.o: defined in discarded section `.gnu.linkonce.t._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev' of build_dir/build.dir/source.cpp.o (symbol from plugin) This is repeated 4 times in a row. To save anyone c++filt-ing it, the mangled symbol is std::string's destructor i.e. std::__cxx11::basic_string<char, std::char_traits<char>, > std::allocator<char> >::~basic_string() I'm using --std=c++1z, -flto=4, and a bunch of warning flags, as well as -fuse-ld=gold (removing this doesn't fix the problem). I can provide other flags if this is helpful. The error occurs when compiling a shared library. I have many such libraries and only two are affected. Nothing about them stands out immediately. The issue bears some similarity to this one - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81004- and interestingly I am using boost program options. It's not the same, though. I do have an unsavoury workaround. If I edit <string> and add "__attribute__((used))" to basic_string's destructor, the issue is resolved. So clearly, the symbol is being optimised away, erroneously. I cannot conscionably apply this to my and my developers' environment, however, so any other suggestions for a solution would be greatly appreciated, as I would very much like to move to GCC 7. And if I can provide any further information, let me know.