https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67092
--- Comment #7 from vries at gcc dot gnu.org --- (In reply to vries from comment #6) > (In reply to H.J. Lu from comment #5) > > (In reply to vries from comment #4) > > > (In reply to H.J. Lu from comment #3) > > > > Only build/genpreds in stage1 should be linked with libstdc++.so.6. > > > > > > Why? > > > > Top level configure.ac has > > > > [stage1_ldflags= > > # In stage 1, default to linking libstdc++ and libgcc statically with GCC > > # if supported. But if the user explicitly specified the libraries to use, > > # trust that they are doing what they want. > > if test "$stage1_libs" = "" -a "$have_static_libs" = yes; then > > stage1_ldflags="-static-libstdc++ -static-libgcc" > > fi]) > > AC_SUBST(stage1_ldflags) > > > > Why doesn't it work for you? > > AFAIU, this question has the premise that something is going wrong in > stage1, which is not the case in this PR, it's about stage2. So I'm not sure > how to answer this question. OK, I think I got your point (the posted code was stage1 related, but there is similar code for poststage1). The question is why we're linking with dynamic instead of static libstdc++ in stage2. I start to suspect it's related to this configure bit: ... --with-host-libstdcxx=-L/usr/local/tools/gcc-4.7.3/lib64 -static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm ... This causes poststage1_libs to be set, which causes poststage1_ldflags to be empty, rather than the default "-static-libstdc++ -static-libgcc". So, on one hand, in the build/genpreds link line, we do not use poststage1_libs. OTOH, we do use poststage1_ldflags, but that's empty now.