From 7896b1d207b64556253733ce8f478c7f40503e3d Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Sun, 20 Feb 2022 22:34:27 -0800 Subject: [PATCH] mips64: have mips64el chips auto-detect abi=n64 This PR adds an additional two-line patch to the code which calculates a `hostPlatform` based on the `builtins.system` provided by the `nix` interpreter, which is in turn derived from the runtime CPU. If the runtime CPU is a 64-bit mips chip running on a little-endian kernel, and the user has not specified otherwise, this commit will cause nixpkgs to assume the "n64" ABI. All mips64 chips are capable of supporting all the mips ABIs. The n64 ABI was chosen because boost's user-scheduled threading (which nix requires) currently does not support the n32 ABI -- it lacks the assembler file which explains how to save and restore the processor state for that ABI. This is also the ABI that Debian has chosen for this platform. --- lib/systems/parse.nix | 1 + lib/systems/platforms.nix | 2 ++ 2 files changed, 3 insertions(+) diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix index 3ceddbb599b9c..1d6ef81ed3e24 100644 --- a/lib/systems/parse.nix +++ b/lib/systems/parse.nix @@ -470,6 +470,7 @@ rec { if lib.versionAtLeast (parsed.cpu.version or "0") "6" then abis.gnueabihf else abis.gnueabi + else if args.cpu=="mips64el" then abis.gnuabi64 # gnuabin32 is also possible on mips64 else abis.gnu else abis.unknown; }; diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix index 04d55416242e1..2c7161021c28f 100644 --- a/lib/systems/platforms.nix +++ b/lib/systems/platforms.nix @@ -566,6 +566,8 @@ rec { else if platform.parsed.cpu == lib.systems.parse.cpuTypes.mipsel then fuloong2f_n32 + else if platform.parsed.cpu == lib.systems.parse.cpuTypes.mips64el then (import ./examples.nix { lib = lib; }).mips64el-linux-gnuabi64 + else if platform.parsed.cpu == lib.systems.parse.cpuTypes.powerpc64le then powernv else pc;