cc-wrapper: Simplify and correct logic to chose dynamic linker library

This commit is contained in:
John Ericson 2017-05-22 20:59:39 -04:00 committed by John Ericson
parent 459f1c60f5
commit d70e7263f4

View file

@ -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 =