diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix index b27d37f55ae..2b789fd8ecb 100644 --- a/lib/systems/parse.nix +++ b/lib/systems/parse.nix @@ -121,6 +121,14 @@ rec { js = { bits = 32; significantByte = littleEndian; family = "js"; }; }; + # GNU build systems assume that older NetBSD architectures are using a.out. + gnuNetBSDDefaultExecFormat = cpu: + if (cpu.family == "x86" && cpu.bits == 32) || + (cpu.family == "arm" && cpu.bits == 32) || + (cpu.family == "sparc" && cpu.bits == 32) + then execFormats.aout + else execFormats.elf; + # Determine when two CPUs are compatible with each other. That is, # can code built for system B run on system A? For that to happen, # the programs that system B accepts must be a subset of the @@ -463,8 +471,12 @@ rec { else "${cpu.name}-${kernel.name}"; tripleFromSystem = { cpu, vendor, kernel, abi, ... } @ sys: assert isSystem sys; let + optExecFormat = + lib.optionalString (kernel.name == "netbsd" && + gnuNetBSDDefaultExecFormat cpu != kernel.execFormat) + kernel.execFormat.name; optAbi = lib.optionalString (abi != abis.unknown) "-${abi.name}"; - in "${cpu.name}-${vendor.name}-${kernel.name}${optAbi}"; + in "${cpu.name}-${vendor.name}-${kernel.name}${optExecFormat}${optAbi}"; ################################################################################