summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorLluís Batlle i Rossell <viric@vicerveza.homeunix.net>2010-12-14 15:22:25 +0000
committerLluís Batlle i Rossell <viric@vicerveza.homeunix.net>2010-12-14 15:22:25 +0000
commite930a7385b87d84d25d1882c11e441d43cde983b (patch)
treed27d069d8814f2f84ab89a7d0c4790fbbf818ce5 /pkgs/build-support
parenta8a01a54ab2e405ee5440465cd1c8bc879bb3968 (diff)
downloadnixlib-e930a7385b87d84d25d1882c11e441d43cde983b.tar
nixlib-e930a7385b87d84d25d1882c11e441d43cde983b.tar.gz
nixlib-e930a7385b87d84d25d1882c11e441d43cde983b.tar.bz2
nixlib-e930a7385b87d84d25d1882c11e441d43cde983b.tar.lz
nixlib-e930a7385b87d84d25d1882c11e441d43cde983b.tar.xz
nixlib-e930a7385b87d84d25d1882c11e441d43cde983b.tar.zst
nixlib-e930a7385b87d84d25d1882c11e441d43cde983b.zip
Fix about the order of -rpath and -L in the ld-wrapper
svn path=/nixpkgs/branches/stdenv-updates/; revision=25128
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/gcc-wrapper/ld-wrapper.sh10
1 files changed, 6 insertions, 4 deletions
diff --git a/pkgs/build-support/gcc-wrapper/ld-wrapper.sh b/pkgs/build-support/gcc-wrapper/ld-wrapper.sh
index ec09e758daf1..74b6273848ed 100644
--- a/pkgs/build-support/gcc-wrapper/ld-wrapper.sh
+++ b/pkgs/build-support/gcc-wrapper/ld-wrapper.sh
@@ -122,11 +122,13 @@ if test "$NIX_DONT_SET_RPATH" != "1"; then
     # Second, for each directory in the library search path (-L...),
     # see if it contains a dynamic library used by a -l... flag.  If
     # so, add the directory to the rpath.
+    # It's important to add the rpath in the order of -L..., so
+    # the link time chosen objects will be those of runtime linking.
     
-    for i in $libs; do
-        for j in $libPath; do
-            if test -f "$j/lib$i.so"; then
-                addToRPath $j
+    for i in $libPath; do
+        for j in $libs; do
+            if test -f "$i/lib$j.so"; then
+                addToRPath $i
                 break
             fi
         done