summary refs log tree commit diff
path: root/pkgs/build-support/bintools-wrapper/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/build-support/bintools-wrapper/default.nix')
-rw-r--r--pkgs/build-support/bintools-wrapper/default.nix16
1 files changed, 15 insertions, 1 deletions
diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix
index 0dcae204824d..bb0e6b82aa5d 100644
--- a/pkgs/build-support/bintools-wrapper/default.nix
+++ b/pkgs/build-support/bintools-wrapper/default.nix
@@ -164,7 +164,21 @@ stdenv.mkDerivation {
       set +u
     '';
 
-  propagatedBuildInputs = extraPackages;
+  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);
+
+  depsTargetTargetPropagated = extraPackages;
 
   setupHook = ./setup-hook.sh;