Fixing a bug in the ld-wrapper, where the dynamic-linker path was taken as a

path worth a "-rpath" entry.

This put a problem in the bootstrap, where we built 'zlib' and wanted to link programs with it, and while they got linked well, at runtime the boostrap-tools zlib came first on rpath becaue
the ld call was done with "-dynamic-linker ..." before "-lz".

I saw this trouble on the fuloong, where the zlib in boostrap-tools is not
runtime compatible with that binutils are linked to.

svn path=/nixpkgs/branches/stdenv-updates/; revision=25107
This commit is contained in:
Lluís Batlle i Rossell 2010-12-13 22:46:21 +00:00
parent 532e844a0c
commit 195a90d7ce

View file

@ -105,6 +105,11 @@ if test "$NIX_DONT_SET_RPATH" != "1"; then
n=$((n + 1)) n=$((n + 1))
elif test "${p:0:2}" = "-l"; then elif test "${p:0:2}" = "-l"; then
addToLibs ${p:2} addToLibs ${p:2}
elif test "$p" = "-dynamic-linker"; then
# Ignore the dynamic linker argument, or it
# will get into the next 'elif'. We don't want
# the dynamic linker path rpath to go always first.
n=$((n + 1))
elif [[ "$p" =~ ^[^-].*\.so($|\.) ]]; then elif [[ "$p" =~ ^[^-].*\.so($|\.) ]]; then
# This is a direct reference to a shared library, so add # This is a direct reference to a shared library, so add
# its directory to the rpath. # its directory to the rpath.