https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98414
--- Comment #10 from Martin Liška <marxin at gcc dot gnu.org> --- (In reply to Martin Liška from comment #9) > (In reply to Jakub Jelinek from comment #8) > > I don't. LIBUBSAN_SPEC comes from gcc.c, while the libstdc++ stuff comes > > from cp/g++spec.c and the ordering between the two is hard to achieve, plus > > it is unclear if we shouldn't for -static-libubsan instead just add another > > -lstdc++ copy (but one honoring -static-libstdc++). > > Hm, and what about something like that: > > diff --git a/config/bootstrap-ubsan.mk b/config/bootstrap-ubsan.mk > index 1d85fe1c836..b2a474ae158 100644 > --- a/config/bootstrap-ubsan.mk > +++ b/config/bootstrap-ubsan.mk > @@ -2,7 +2,7 @@ > > STAGE2_CFLAGS += -fsanitize=undefined -DUBSAN_BOOTSTRAP > STAGE3_CFLAGS += -fsanitize=undefined -DUBSAN_BOOTSTRAP > -POSTSTAGE1_LDFLAGS += -fsanitize=undefined -static-libubsan > -DUBSAN_BOOTSTRAP \ > +POSTSTAGE1_LDFLAGS += -fsanitize=undefined -static-libubsan -lstdc++ > -DUBSAN_BOOTSTRAP \ > -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ \ > -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ubsan/ \ > -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ubsan/.libs That's not going to work: ./xgcc -B./ -B/usr/local/x86_64-pc-linux-gnu/bin/ -isystem /usr/local/x86_64-pc-linux-gnu/include -isystem /usr/local/x86_64-pc-linux-gnu/sys-include -L/home/mliska/Programming/gcc/objdir/gcc/../ld -xc++ -nostdinc /dev/null -S -o /dev/null -fself-test=../../gcc/testsuite/selftests ./cc1./cc1plus: : /usr/lib64/libstdc++.so.6/usr/lib64/libstdc++.so.6: : version `GLIBCXX_3.4.29' not found (required by ./cc1)version `GLIBCXX_3.4.29' not found (required by ./cc1plus) leaving to Nathan.