diff options
author | Alyssa Ross <hi@alyssa.is> | 2021-06-01 14:54:14 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2021-06-06 18:52:58 +0000 |
commit | 4d6a0bb9667c8083076a96744bdc71643c6febc6 (patch) | |
tree | 7058655b4b39e03172032b8e61f5d27da13804fc /lib/systems | |
parent | 5a8372d04e5afbca44daed90ff82e0f0003e59b2 (diff) |
lib.systems.parsed: add "elf" for some NetBSD archs
In Autoconf, some old NetBSD targets like "i686-unknown-netbsd" are
interpreted as a.out, not elf, and virtually nothing supports it. We
need to specify e.g. "i686-unknown-netbsdelf" to get the right
behaviour.
Diffstat (limited to 'lib/systems')
-rw-r--r-- | lib/systems/parse.nix | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix index b27d37f55aee..2b789fd8ecb3 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}"; ################################################################################ |