https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98414

--- Comment #9 from Martin Liška <marxin at gcc dot gnu.org> ---
(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

Reply via email to