From 195a90d7ce5a3e449a43bf5d81299040601d1bb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Mon, 13 Dec 2010 22:46:21 +0000 Subject: [PATCH] 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 --- pkgs/build-support/gcc-wrapper/ld-wrapper.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/build-support/gcc-wrapper/ld-wrapper.sh b/pkgs/build-support/gcc-wrapper/ld-wrapper.sh index 99ba3968ae3..ec09e758daf 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.