From 407953e9df712b6d89295f1c402e8778a249a748 Mon Sep 17 00:00:00 2001 From: Ben Siraphob Date: Sat, 24 Jul 2021 01:20:02 +0700 Subject: [PATCH] Initial implementation of m68k cross-compile --- lib/systems/doubles.nix | 4 +++- 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(+), 2 deletions(-) diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix index 61ba7dad7cc..b8d154ad635 100644 --- a/lib/systems/doubles.nix +++ b/lib/systems/doubles.nix @@ -28,6 +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" # MMIXware "mmix-mmixware" @@ -39,7 +40,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" + "or1k-none" "powerpc-none" "riscv32-none" "riscv64-none" "vc4-none" "m68k-none" "x86_64-none" # OpenBSD @@ -74,6 +75,7 @@ in { riscv = filterDoubles predicates.isRiscV; vc4 = filterDoubles predicates.isVc4; or1k = filterDoubles predicates.isOr1k; + m68k = filterDoubles predicates.isM68k; js = filterDoubles predicates.isJavaScript; bigEndian = filterDoubles predicates.isBigEndian; diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 6a8f4e091aa..ce7515bc9cc 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -144,6 +144,10 @@ rec { libc = "newlib"; }; + m68k = { + config = "m68k-unknown-linux-gnu"; + }; + arm-embedded = { config = "arm-none-eabi"; libc = "newlib"; diff --git a/lib/systems/inspect.nix b/lib/systems/inspect.nix index d2b7271210c..a74847d4340 100644 --- a/lib/systems/inspect.nix +++ b/lib/systems/inspect.nix @@ -26,6 +26,7 @@ rec { isAvr = { cpu = { family = "avr"; }; }; isAlpha = { cpu = { family = "alpha"; }; }; isOr1k = { cpu = { family = "or1k"; }; }; + isM68k = { cpu = { family = "m68k"; }; }; isJavaScript = { cpu = cpuTypes.js; }; is32bit = { cpu = { bits = 32; }; }; diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix index 2b789fd8ecb..8a8b0888149 100644 --- a/lib/systems/parse.nix +++ b/lib/systems/parse.nix @@ -95,6 +95,8 @@ rec { mmix = { bits = 64; significantByte = bigEndian; family = "mmix"; }; + m68k = { bits = 32; significantByte = bigEndian; family = "m68k"; }; + powerpc = { bits = 32; significantByte = bigEndian; family = "power"; }; powerpc64 = { bits = 64; significantByte = bigEndian; family = "power"; }; powerpc64le = { bits = 64; significantByte = littleEndian; family = "power"; }; diff --git a/lib/tests/systems.nix b/lib/tests/systems.nix index 36f82b783b4..378dc537598 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" ]; + 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" ]; 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 5d2f2f977a7..0674c88924e 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -208,6 +208,7 @@ stdenv.mkDerivation { else if targetPlatform.isAlpha then "alpha" else if targetPlatform.isVc4 then "vc4" else if targetPlatform.isOr1k then "or1k" + else if targetPlatform.isM68k then "m68k" else if targetPlatform.isRiscV then "lriscv" else throw "unknown emulation for platform: ${targetPlatform.config}"; in if targetPlatform.useLLVM or false then ""