From 0f1204bd2be0ca1ea60b70d6d1eb7a11077f6986 Mon Sep 17 00:00:00 2001 From: Ben Siraphob Date: Sat, 24 Jul 2021 01:20:02 +0700 Subject: [PATCH] Initial implementation of s390 cross-compile --- lib/systems/doubles.nix | 5 +++-- lib/systems/examples.nix | 4 ++++ lib/systems/inspect.nix | 1 + lib/systems/parse.nix | 2 ++ lib/tests/systems.nix | 2 +- pkgs/build-support/bintools-wrapper/default.nix | 1 + 6 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix index b8d154ad635..aa630b51ed8 100644 --- a/lib/systems/doubles.nix +++ b/lib/systems/doubles.nix @@ -28,7 +28,7 @@ let "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-linux" "mipsel-linux" "powerpc64-linux" "powerpc64le-linux" "riscv32-linux" "riscv64-linux" "x86_64-linux" - "m68k-linux" + "m68k-linux" "s390-linux" # MMIXware "mmix-mmixware" @@ -41,7 +41,7 @@ let # none "aarch64-none" "arm-none" "armv6l-none" "avr-none" "i686-none" "msp430-none" "or1k-none" "powerpc-none" "riscv32-none" "riscv64-none" "vc4-none" "m68k-none" - "x86_64-none" + "s390-none" "x86_64-none" # OpenBSD "i686-openbsd" "x86_64-openbsd" @@ -76,6 +76,7 @@ in { vc4 = filterDoubles predicates.isVc4; or1k = filterDoubles predicates.isOr1k; m68k = filterDoubles predicates.isM68k; + s390 = filterDoubles predicates.isS390; js = filterDoubles predicates.isJavaScript; bigEndian = filterDoubles predicates.isBigEndian; diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index ce7515bc9cc..32b236d6960 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -148,6 +148,10 @@ rec { config = "m68k-unknown-linux-gnu"; }; + s390 = { + config = "s390-unknown-linux-gnu"; + }; + arm-embedded = { config = "arm-none-eabi"; libc = "newlib"; diff --git a/lib/systems/inspect.nix b/lib/systems/inspect.nix index a74847d4340..2fba95aa1a6 100644 --- a/lib/systems/inspect.nix +++ b/lib/systems/inspect.nix @@ -27,6 +27,7 @@ rec { isAlpha = { cpu = { family = "alpha"; }; }; isOr1k = { cpu = { family = "or1k"; }; }; isM68k = { cpu = { family = "m68k"; }; }; + isS390 = { cpu = { family = "s390"; }; }; isJavaScript = { cpu = cpuTypes.js; }; is32bit = { cpu = { bits = 32; }; }; diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix index 8a8b0888149..386f252f2ba 100644 --- a/lib/systems/parse.nix +++ b/lib/systems/parse.nix @@ -105,6 +105,8 @@ rec { riscv32 = { bits = 32; significantByte = littleEndian; family = "riscv"; }; riscv64 = { bits = 64; significantByte = littleEndian; family = "riscv"; }; + s390 = { bits = 32; significantByte = bigEndian; family = "s390"; }; + sparc = { bits = 32; significantByte = bigEndian; family = "sparc"; }; sparc64 = { bits = 64; significantByte = bigEndian; family = "sparc"; }; diff --git a/lib/tests/systems.nix b/lib/tests/systems.nix index 378dc537598..6bd43f0d0d0 100644 --- a/lib/tests/systems.nix +++ b/lib/tests/systems.nix @@ -28,7 +28,7 @@ with lib.systems.doubles; lib.runTests { testredox = mseteq redox [ "x86_64-redox" ]; testgnu = mseteq gnu (linux /* ++ kfreebsd ++ ... */); testillumos = mseteq illumos [ "x86_64-solaris" ]; - testlinux = mseteq linux [ "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-linux" "mipsel-linux" "riscv32-linux" "riscv64-linux" "x86_64-linux" "powerpc64-linux" "powerpc64le-linux" "m68k-linux" ]; + testlinux = mseteq linux [ "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-linux" "mipsel-linux" "riscv32-linux" "riscv64-linux" "x86_64-linux" "powerpc64-linux" "powerpc64le-linux" "m68k-linux" "s390-linux" ]; testnetbsd = mseteq netbsd [ "aarch64-netbsd" "armv6l-netbsd" "armv7a-netbsd" "armv7l-netbsd" "i686-netbsd" "mipsel-netbsd" "powerpc-netbsd" "riscv32-netbsd" "riscv64-netbsd" "x86_64-netbsd" ]; testopenbsd = mseteq openbsd [ "i686-openbsd" "x86_64-openbsd" ]; testwindows = mseteq windows [ "i686-cygwin" "x86_64-cygwin" "i686-windows" "x86_64-windows" ]; diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index 0674c88924e..82d17369743 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -209,6 +209,7 @@ stdenv.mkDerivation { else if targetPlatform.isVc4 then "vc4" else if targetPlatform.isOr1k then "or1k" else if targetPlatform.isM68k then "m68k" + else if targetPlatform.isS390 then "s390" else if targetPlatform.isRiscV then "lriscv" else throw "unknown emulation for platform: ${targetPlatform.config}"; in if targetPlatform.useLLVM or false then ""