From fe836f35644a152c5a38d09e162694fec9755b6b Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Tue, 26 Apr 2022 22:08:44 +0200 Subject: [PATCH] lib/systems/parse: don't consider mode switching CPUs compatible Since we (exclusively) use isCompatible to gauge whether platform a can execute binaries built for platform b, mode switching CPUs are not to be considered compatible for our purposes: Switching the mode of a CPU usually requires a reset. At the very least we can't execute a mix of executables for the two modes which would usually be the case in nixpkgs where we may want to execute buildInputs for the hostPlatform in addition to nativeBuildInputs for the buildPlatform. --- lib/systems/parse.nix | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix index bf436ec8db57..9d2571c993a9 100644 --- a/lib/systems/parse.nix +++ b/lib/systems/parse.nix @@ -148,8 +148,10 @@ rec { # Every CPU is compatible with itself. # - (transitivity) # If A is compatible with B and B is compatible with C then A is compatible with C. - # - (compatible under multiple endianness) - # CPUs with multiple modes of endianness are pairwise compatible. + # + # Note: Since 22.11 the archs of a mode switching CPU are no longer considered + # pairwise compatible. Mode switching implies that binaries built for A + # and B respectively can't be executed at the same time. isCompatible = a: b: with cpuTypes; lib.any lib.id [ # x86 (b == i386 && isCompatible a i486) @@ -191,22 +193,13 @@ rec { (b == aarch64 && a == armv8a) (b == armv8a && isCompatible a aarch64) - (b == aarch64 && a == aarch64_be) - (b == aarch64_be && isCompatible a aarch64) - # PowerPC (b == powerpc && isCompatible a powerpc64) - (b == powerpcle && isCompatible a powerpc) - (b == powerpc && a == powerpcle) - (b == powerpc64le && isCompatible a powerpc64) - (b == powerpc64 && a == powerpc64le) + (b == powerpcle && isCompatible a powerpc64le) # MIPS (b == mips && isCompatible a mips64) - (b == mips && a == mipsel) - (b == mipsel && isCompatible a mips) - (b == mips64 && a == mips64el) - (b == mips64el && isCompatible a mips64) + (b == mipsel && isCompatible a mips64el) # RISCV (b == riscv32 && isCompatible a riscv64)