Tested x86_64-pc-linux-gnu.  Any thoughts?

-- 8< --

The patch for PR22340 (r104978) moved the adding of TARGET_LIB_PATH to
RPATH_ENVVAR from POSTSTAGE1_HOST_EXPORTS to HOST_EXPORTS, but didn't
mention that in the ChangeLog; it also wasn't part of the patch that was
sent to gcc-patches.  I suspect it was included accidentally?

It also causes PR105688 when rebuilding stage1: once the stage1 libstdc++
has been built, if calling the system gcc to build host code involves
invoking any tool that links against libstdc++.so (gold, ccache) they get
the just-built library instead of the system library they expect.

Reverting that hunk of the change fixed my problem with bubblestrapping GCC
12 with ccache on a host with a newer system libstdc++.

But I believe that adding TARGET_LIB_PATH to RPATH_ENVVAR is not needed for
post-stage1 either, at this point.  Including TARGET_LIB_PATH goes back to
r37545, with the stated rationale of getting other C++ library configury to
succeed, but it looks to me like that is no longer necessary.

So I propose to stop adding target libraries to LD_LIBRARY_PATH; see
https://gcc.gnu.org/legacy-ml/gcc/2012-06/msg00325.html for a previous
proposal by Ian to make this change.

I have tried and failed to test this on a system without system libstdc++;
bootstrap on cfarm220 and cfarm240 failed for unrelated reasons.

        PR bootstrap/105688

ChangeLog:

        * Makefile.tpl (HOST_EXPORTS): Don't add TARGET_LIB_PATH to
        RPATH_ENVVAR.
        * Makefile.in: Regenerate.
---
 Makefile.in  | 3 ---
 Makefile.tpl | 3 ---
 2 files changed, 6 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index edb0c8a9a42..c2843d5df89 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -242,9 +242,6 @@ HOST_EXPORTS = \
        ISLLIBS="$(HOST_ISLLIBS)"; export ISLLIBS; \
        ISLINC="$(HOST_ISLINC)"; export ISLINC; \
        XGCC_FLAGS_FOR_TARGET="$(XGCC_FLAGS_FOR_TARGET)"; export 
XGCC_FLAGS_FOR_TARGET; \
-@if gcc-bootstrap
-       $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 
's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
-@endif gcc-bootstrap
        $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 
's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
 
 POSTSTAGE1_CXX_EXPORT = \
diff --git a/Makefile.tpl b/Makefile.tpl
index adbcbdd1d57..cb39fbd0434 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -245,9 +245,6 @@ HOST_EXPORTS = \
        ISLLIBS="$(HOST_ISLLIBS)"; export ISLLIBS; \
        ISLINC="$(HOST_ISLINC)"; export ISLINC; \
        XGCC_FLAGS_FOR_TARGET="$(XGCC_FLAGS_FOR_TARGET)"; export 
XGCC_FLAGS_FOR_TARGET; \
-@if gcc-bootstrap
-       $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 
's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
-@endif gcc-bootstrap
        $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 
's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
 
 POSTSTAGE1_CXX_EXPORT = \

base-commit: c5d34912ad576be1ef19be92f7eabde54b9089eb
-- 
2.43.0

Reply via email to