about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLluís Batlle i Rossell <viric@vicerveza.homeunix.net>2010-12-13 22:46:21 +0000
committerLluís Batlle i Rossell <viric@vicerveza.homeunix.net>2010-12-13 22:46:21 +0000
commit195a90d7ce5a3e449a43bf5d81299040601d1bb2 (patch)
treee507fa0ac40e601d2be1ed4e0001beef3909dbb3
parent532e844a0c226e73bde8958d3ccd2a1bf13bf830 (diff)
downloadnixlib-195a90d7ce5a3e449a43bf5d81299040601d1bb2.tar
nixlib-195a90d7ce5a3e449a43bf5d81299040601d1bb2.tar.gz
nixlib-195a90d7ce5a3e449a43bf5d81299040601d1bb2.tar.bz2
nixlib-195a90d7ce5a3e449a43bf5d81299040601d1bb2.tar.lz
nixlib-195a90d7ce5a3e449a43bf5d81299040601d1bb2.tar.xz
nixlib-195a90d7ce5a3e449a43bf5d81299040601d1bb2.tar.zst
nixlib-195a90d7ce5a3e449a43bf5d81299040601d1bb2.zip
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
-rw-r--r--pkgs/build-support/gcc-wrapper/ld-wrapper.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/pkgs/build-support/gcc-wrapper/ld-wrapper.sh b/pkgs/build-support/gcc-wrapper/ld-wrapper.sh
index 99ba3968ae33..ec09e758daf1 100644
--- a/pkgs/build-support/gcc-wrapper/ld-wrapper.sh
+++ b/pkgs/build-support/gcc-wrapper/ld-wrapper.sh
@@ -105,6 +105,11 @@ if test "$NIX_DONT_SET_RPATH" != "1"; then
             n=$((n + 1))
         elif test "${p:0:2}" = "-l"; then
             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
             # This is a direct reference to a shared library, so add
             # its directory to the rpath.