about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorJohn Ericson <Ericson2314@Yahoo.com>2017-05-22 20:59:39 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2017-06-22 17:52:27 -0400
commitd70e7263f47e890a350f50686bbf38e5f342cf37 (patch)
tree86b1421606b6da32700a796a346caeedb788f4cf /pkgs/build-support
parent459f1c60f5e53acb96123a7da8463d1e21093426 (diff)
downloadnixlib-d70e7263f47e890a350f50686bbf38e5f342cf37.tar
nixlib-d70e7263f47e890a350f50686bbf38e5f342cf37.tar.gz
nixlib-d70e7263f47e890a350f50686bbf38e5f342cf37.tar.bz2
nixlib-d70e7263f47e890a350f50686bbf38e5f342cf37.tar.lz
nixlib-d70e7263f47e890a350f50686bbf38e5f342cf37.tar.xz
nixlib-d70e7263f47e890a350f50686bbf38e5f342cf37.tar.zst
nixlib-d70e7263f47e890a350f50686bbf38e5f342cf37.zip
cc-wrapper: Simplify and correct logic to chose dynamic linker library
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/cc-wrapper/default.nix28
1 files changed, 12 insertions, 16 deletions
diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix
index 29766a7fe020..c58523d3981c 100644
--- a/pkgs/build-support/cc-wrapper/default.nix
+++ b/pkgs/build-support/cc-wrapper/default.nix
@@ -274,31 +274,27 @@ stdenv.mkDerivation {
     + extraBuildCommands;
 
   # The dynamic linker has different names on different Linux platforms.
+  #
+  # TODO(1b62c9c06173f4d5e6b090e5ae0c68fa5f478faf): This is not the best way to
+  # do this. I think the reference should be the style in the gcc-cross-wrapper,
+  # but to keep a stable stdenv now I do this sufficient if/else.
   dynamicLinker =
     if !nativeLibc then
-      (if stdenv.system == "i686-linux" then "ld-linux.so.2" else
-       if stdenv.system == "x86_64-linux" then "ld-linux-x86-64.so.2" else
+      (if targetPlatform.system == "i686-linux"     then "ld-linux.so.2" else
+       if targetPlatform.system == "x86_64-linux"   then "ld-linux-x86-64.so.2" else
        # ARM with a wildcard, which can be "" or "-armhf".
-       if targetPlatform.isArm32 then "ld-linux*.so.3" else
-       if stdenv.system == "aarch64-linux" then "ld-linux-aarch64.so.1" else
-       if stdenv.system == "powerpc-linux" then "ld.so.1" else
-       if stdenv.system == "mips64el-linux" then "ld.so.1" else
-       if stdenv.system == "x86_64-darwin" then "/usr/lib/dyld" else
+       if targetPlatform.isArm32                    then "ld-linux*.so.3" else
+       if targetPlatform.system == "aarch64-linux"  then "ld-linux-aarch64.so.1" else
+       if targetPlatform.system == "powerpc-linux"  then "ld.so.1" else
+       if targetPlatform.system == "mips64el-linux" then "ld.so.1" else
+       if targetPlatform.system == "x86_64-darwin"  then "/usr/lib/dyld" else
+       if stdenv.lib.hasSuffix "pc-gnu" targetPlatform.config then "ld.so.1" else
        abort "Don't know the name of the dynamic linker for this platform.")
     else "";
 
   crossAttrs = {
     shell = shell.crossDrv + shell.crossDrv.shellPath;
     libc = stdenv.ccCross.libc;
-    #
-    # This is not the best way to do this. I think the reference should be
-    # the style in the gcc-cross-wrapper, but to keep a stable stdenv now I
-    # do this sufficient if/else.
-    dynamicLinker =
-      (if stdenv.cross.arch == "arm" then "ld-linux.so.3" else
-       if stdenv.cross.arch == "mips" then "ld.so.1" else
-       if stdenv.lib.hasSuffix "pc-gnu" stdenv.cross.config then "ld.so.1" else
-       abort "don't know the name of the dynamic linker for this platform");
   };
 
   meta =