https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96880
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The problem is that lang_specific_driver adds -lstdc++ -lm before the generic code adds -lubsan. If you link normally (dynamically), it will work just fine. Or you can always add -lubsan -lstdc++ Not sure how to fix this properly, the C++ lang_specific_driver doesn't see the -lubsan option that is only added later on and where exactly in the arguments -lstdc++ ends up is not something gcc.c can predict.