diff options
author | Adam Joseph <adam@westernsemico.com> | 2022-02-20 20:32:52 -0800 |
---|---|---|
committer | Adam Joseph <adam@westernsemico.com> | 2022-03-10 20:30:16 -0800 |
commit | 12371a51e647a00b90fe250837f056642125c095 (patch) | |
tree | 7e46578a84ceb08b250e61be1516e3478c79b511 /pkgs | |
parent | b77a575dc8f825eb82d6a916fe01fe953d93033e (diff) | |
download | nixlib-12371a51e647a00b90fe250837f056642125c095.tar nixlib-12371a51e647a00b90fe250837f056642125c095.tar.gz nixlib-12371a51e647a00b90fe250837f056642125c095.tar.bz2 nixlib-12371a51e647a00b90fe250837f056642125c095.tar.lz nixlib-12371a51e647a00b90fe250837f056642125c095.tar.xz nixlib-12371a51e647a00b90fe250837f056642125c095.tar.zst nixlib-12371a51e647a00b90fe250837f056642125c095.zip |
lib/systems: add mips64el definitions
MIPS has a large space of {architecture,abi,endianness}; this commit adds all of them to lib/systems/platforms.nix so we can be done with it. Currently lib/systems/inspect.nix has a single "isMips" predicate, which is a bit ambiguous now that we will have both mips32 and mips64 support, with the latter having two ABIs. Let's add four new predicates (isMips32, isMips64, isMips64n32, and isMips64n64) and treat the now-ambiguous isMips as deprecated in favor of the more-specific predicates. These predicates are used mainly for enabling/disabling target-specific workarounds, and it is extremely rare that a platform-specific workaround is needed, and both mips32 and mips64 need exactly the same workaround. The separate predicates (isMips64n32 and isMips64n64) for ABI distinctions are, unfortunately, useful. Boost's user-scheduled threading (used by nix) does does not currently supports mips64n32, which is a very desirable ABI on routers since they rarely have more than 2**32 bytes of DRAM.
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/stdenv/default.nix | 1 | ||||
-rw-r--r-- | pkgs/stdenv/linux/make-bootstrap-tools-cross.nix | 2 | ||||
-rw-r--r-- | pkgs/top-level/stage.nix | 44 |
3 files changed, 29 insertions, 18 deletions
diff --git a/pkgs/stdenv/default.nix b/pkgs/stdenv/default.nix index 0d328d98ba11..25a593c67437 100644 --- a/pkgs/stdenv/default.nix +++ b/pkgs/stdenv/default.nix @@ -53,6 +53,7 @@ in armv8m-linux = stagesLinux; aarch64-linux = stagesLinux; mipsel-linux = stagesLinux; + mips64el-linux = stagesLinux; powerpc-linux = /* stagesLinux */ stagesNative; powerpc64-linux = stagesLinux; powerpc64le-linux = stagesLinux; diff --git a/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix b/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix index d8ab96952b7f..a21f677f117c 100644 --- a/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix +++ b/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix @@ -17,6 +17,8 @@ in lib.mapAttrs (n: make) (with lib.systems.examples; { armv6l-musl = muslpi; aarch64-musl = aarch64-multiplatform-musl; riscv64 = riscv64; + mips64el-linux-gnuabin32 = lib.systems.platforms.mips64el-linux-gnuabin32; + mips64el-linux-gnuabi64 = lib.systems.platforms.mips64el-linux-gnuabi64; powerpc64 = ppc64; powerpc64-musl = ppc64-musl; powerpc64le = powernv; diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix index 9d34ddb3685f..8ca69315b542 100644 --- a/pkgs/top-level/stage.nix +++ b/pkgs/top-level/stage.nix @@ -64,6 +64,30 @@ } @args: let + # This is a function from parsed platforms (like + # stdenv.hostPlatform.parsed) to parsed platforms. + makeStaticParsedPlatform = parsed: + # The following line guarantees that the output of this function + # is a well-formed platform with no missing fields. It will be + # uncommented in a separate PR, in case it breaks the build. + #(x: lib.trivial.pipe x [ (x: builtins.removeAttrs x [ "_type" ]) lib.systems.parse.mkSystem ]) + (parsed // { + abi = { + gnu = lib.systems.parse.abis.musl; + gnueabi = lib.systems.parse.abis.musleabi; + gnueabihf = lib.systems.parse.abis.musleabihf; + musleabi = lib.systems.parse.abis.musleabi; + musleabihf = lib.systems.parse.abis.musleabihf; + gnuabin32 = lib.systems.parse.abis.muslabin32; + gnuabi64 = lib.systems.parse.abis.muslabi64; + # The following two entries ensure that this function is idempotent. + muslabin32 = lib.systems.parse.abis.muslabin32; + muslabi64 = lib.systems.parse.abis.muslabi64; + }.${parsed.abi.name} + or lib.systems.parse.abis.musl; + }); + + stdenvAdapters = self: super: let res = import ../stdenv/adapters.nix { @@ -188,14 +212,7 @@ let })] ++ overlays; ${if stdenv.hostPlatform == stdenv.buildPlatform then "localSystem" else "crossSystem"} = { - parsed = stdenv.hostPlatform.parsed // { - abi = { - gnu = lib.systems.parse.abis.musl; - gnueabi = lib.systems.parse.abis.musleabi; - gnueabihf = lib.systems.parse.abis.musleabihf; - }.${stdenv.hostPlatform.parsed.abi.name} - or lib.systems.parse.abis.musl; - }; + parsed = makeStaticParsedPlatform stdenv.hostPlatform.parsed; }; } else throw "Musl libc only supports Linux systems."; @@ -239,16 +256,7 @@ let } // lib.optionalAttrs stdenv.hostPlatform.isLinux { crossSystem = { isStatic = true; - parsed = stdenv.hostPlatform.parsed // { - abi = { - gnu = lib.systems.parse.abis.musl; - gnueabi = lib.systems.parse.abis.musleabi; - gnueabihf = lib.systems.parse.abis.musleabihf; - musleabi = lib.systems.parse.abis.musleabi; - musleabihf = lib.systems.parse.abis.musleabihf; - }.${stdenv.hostPlatform.parsed.abi.name} - or lib.systems.parse.abis.musl; - }; + parsed = makeStaticParsedPlatform stdenv.hostPlatform.parsed; } // lib.optionalAttrs (stdenv.hostPlatform.system == "powerpc64-linux") { gcc.abi = "elfv2"; }; |