From 49347667a879991e4593c38ca18d7297f248b05c Mon Sep 17 00:00:00 2001 From: hsloan Date: Wed, 28 Jun 2017 15:59:14 -0400 Subject: [PATCH] gcc-wrapper-old: Don't use stdenv.cross Take the dynamic linker logic for cc-wrapper for now --- .../build-support/gcc-wrapper-old/default.nix | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/pkgs/build-support/gcc-wrapper-old/default.nix b/pkgs/build-support/gcc-wrapper-old/default.nix index f8a7c62edc7..a37d94c36e0 100644 --- a/pkgs/build-support/gcc-wrapper-old/default.nix +++ b/pkgs/build-support/gcc-wrapper-old/default.nix @@ -8,6 +8,7 @@ { name ? "", stdenv, lib, nativeTools, nativeLibc, nativePrefix ? "" , gcc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? "" , zlib ? null +, hostPlatform, targetPlatform }: assert nativeTools -> nativePrefix != ""; @@ -69,9 +70,9 @@ stdenv.mkDerivation { # 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 + (if hostPlatform.arch == "arm" then "ld-linux.so.3" else + if hostPlatform.arch == "mips" then "ld.so.1" else + if stdenv.lib.hasSuffix "pc-gnu" hostPlatform.config then "ld.so.1" else abort "don't know the name of the dynamic linker for this platform"); }; @@ -85,15 +86,20 @@ stdenv.mkDerivation { + " (wrapper script)"; }; - # The dynamic linker has different names on different Linux platforms. + # The dynamic linker has different names on different platforms. 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 stdenv.isArm then "ld-linux*.so.3" else - if stdenv.system == "powerpc-linux" then "ld.so.1" else - if stdenv.system == "mips64el-linux" then "ld.so.1" else - abort "don't know the name of the dynamic linker for this platform") + 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 + builtins.trace + "Don't know the name of the dynamic linker for platform ${targetPlatform.config}, so guessing instead." + null) else ""; }