diff options
author | John Ericson <Ericson2314@yahoo.com> | 2017-12-29 17:42:38 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-29 17:42:38 -0500 |
commit | eb27be0731aa9a6566eabec13dd24391eac45882 (patch) | |
tree | 9e43a9fc746d8d43f02e5223e344794770eb71ea /pkgs/build-support | |
parent | b1dcc6c2012ef2190caf30043af457c15253abcd (diff) | |
parent | cc44e04472bf8d0774e09a6cc4bd47175e531b8e (diff) |
Merge pull request #33186 from obsidiansystems/cross-binutils
binutils: Fix cross, again
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/bintools-wrapper/default.nix | 14 | ||||
-rw-r--r-- | pkgs/build-support/bintools-wrapper/ld-wrapper.sh | 5 |
2 files changed, 19 insertions, 0 deletions
diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index 0dcae204824d5..57859b2f371be 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -164,6 +164,20 @@ stdenv.mkDerivation { set +u ''; + emulation = let + fmt = + /**/ if targetPlatform.isDarwin then "mach-o" + else if targetPlatform.isWindows then "pe" + else "elf" + toString targetPlatform.parsed.cpu.bits; + endianPrefix = if targetPlatform.isBigEndian then "big" else "little"; + arch = + /**/ if targetPlatform.isAarch64 then endianPrefix + "aarch64" + else if targetPlatform.isArm then endianPrefix + "arm" + else if targetPlatform.isx86_64 then "x86-64" + else if targetPlatform.isi686 then "i386" + else throw "unknown emulation for platform: " + targetPlatform.config; + in targetPlatform.platform.bfdEmulation or (fmt + "-" + arch); + propagatedBuildInputs = extraPackages; setupHook = ./setup-hook.sh; diff --git a/pkgs/build-support/bintools-wrapper/ld-wrapper.sh b/pkgs/build-support/bintools-wrapper/ld-wrapper.sh index 136621d27af55..991ed0fe263c1 100644 --- a/pkgs/build-support/bintools-wrapper/ld-wrapper.sh +++ b/pkgs/build-support/bintools-wrapper/ld-wrapper.sh @@ -67,6 +67,11 @@ fi extraAfter+=($NIX_@infixSalt@_LDFLAGS_AFTER) +# Specify the target emulation if nothing is passed in ("-m" overrides this +# environment variable). Ensures we never blindly fallback on targeting the host +# platform. +: ${LDEMULATION:=@emulation@} + # Three tasks: # # 1. Find all -L... switches for rpath |