Merge pull request #209054 from trofi/stdcxx-out-of-bootstrap-lib

linux/bootstrap-tools: move libstdc++ out of default library search path
This commit is contained in:
Sergei Trofimovich 2023-01-12 18:27:58 +00:00 committed by GitHub
commit 4433093854
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,6 +17,15 @@ else
LD_BINARY=$out/lib/ld-*so.?
fi
# path to version-specific libraries, like libstdc++.so
LIBSTDCXX_SO_DIR=$(echo $out/lib/gcc/*/*)
# Move version-specific libraries out to avoid library mix when we
# upgrade gcc.
# TODO(trofi): update bootstrap tarball script and tarballs to put them
# into expected location directly.
LD_LIBRARY_PATH=$out/lib $LD_BINARY $out/bin/mv $out/lib/libstdc++.* $LIBSTDCXX_SO_DIR/
# On x86_64, ld-linux-x86-64.so.2 barfs on patchelf'ed programs. So
# use a copy of patchelf.
LD_LIBRARY_PATH=$out/lib $LD_BINARY $out/bin/cp $out/bin/patchelf .
@ -25,8 +34,8 @@ for i in $out/bin/* $out/libexec/gcc/*/*/*; do
if [ -L "$i" ]; then continue; fi
if [ -z "${i##*/liblto*}" ]; then continue; fi
echo patching "$i"
LD_LIBRARY_PATH=$out/lib $LD_BINARY \
./patchelf --set-interpreter $LD_BINARY --set-rpath $out/lib --force-rpath "$i"
LD_LIBRARY_PATH=$out/lib:$LIBSTDCXX_SO_DIR $LD_BINARY \
./patchelf --set-interpreter $LD_BINARY --set-rpath $out/lib:$LIBSTDCXX_SO_DIR --force-rpath "$i"
done
for i in $out/lib/librt-*.so $out/lib/libpcre*; do