Commit graph

351 commits

Author SHA1 Message Date
Minijackson 3fa4274ff6 lib/systems/parse: use ELFv2 by default for PPC64 BE 2022-08-28 21:46:44 +02:00
Minijackson da2d9a2aca lib/systems: add elfv1 / elfv2 ABIs 2022-08-28 21:46:44 +02:00
Minijackson 4db467f7e9
lib/systems: add MicroBlaze architectures 2022-08-25 16:00:42 +02:00
Daniel Olsen 875d77ca03 lib/systems: Add staticLibrary and library
staticLibrary includes common extensions for static libraries
library is a new common attribute that includes both shared and static extensions
2022-08-16 08:36:57 +00:00
Sandro 7c073f917a
lib/system: resolve TODO 2022-08-02 14:13:18 +02:00
Sandro 463327086d lib/systems/inspect.nix: add isAarch 2022-07-29 19:16:01 +00:00
Vladimír Čunát 87980a5a14
Merge #170736: lib/systems/platforms.nix: fix mips32 ABI 2022-07-27 19:53:38 +02:00
Rick van Schijndel 9532db9eb7
Merge pull request #160554 from Cloudef/android-prebuilt
Fix android prebuilt toolchains
2022-07-18 10:01:00 +02:00
Alyssa Ross e8d7d52fae lib.systems.examples: canonicalize MIPS triples
In Nixpkgs, we assume that the "config" field is a canonicalized GNU
triple.  I noticed that non-canonical values were being used here,
because the pkgsCross.mips64el-linux-gnu triples did not contain the
vendor field, but the pkgsCross.mips64el-linux-gnu.pkgsStatic did.

Here, I've run all the MIPS triples in lib.systems.examples through
config.sub to canonicalize them.  I think this will avoid nasty
surprises in future.

Tested by building Nix and the bootstrap files for
pkgsCross.mips64el-linux-gnu.
2022-07-03 23:01:21 +00:00
Jari Vetoniemi 539222e8d4 canExecute: check for android 2022-06-29 18:27:16 +09:00
Jari Vetoniemi 2a914f022c update android targets to recommended ones 2022-06-29 18:27:16 +09:00
Alyssa Ross 74562a214e
lib.systems.amd64-netbsd: remove
This has been deprecated for a long time, and it's doubtful it had any
users to start with.  And having an undisablable warning when
enumarating platforms is not good.
2022-06-08 17:14:05 +00:00
sternenseemann d01774baa3
Merge pull request #174917 from alyssais/scaleway-c1
lib.systems: drop scaleway-c1
2022-05-27 14:52:42 +02:00
Alyssa Ross 089ff89f49
lib.systems: drop scaleway-c1
These servers apparently no longer exist, since September 2, 2021[1].
If somebody needs this for non-Scaleway machines, they should suggest
its reintroduction with a different name.

[1]: https://news.ycombinator.com/item?id=27192757
2022-05-27 12:02:39 +00:00
Adam Joseph c0085404bd lib/systems/inspect.nix: remove isPowerPC
Very confusingly, the `isPowerPC` predicate in
`lib/systems/inspect.nix` does *not* match `powerpc64le`!

This is because `isPowerPC` is defined as

  isPowerPC      = { cpu = cpuTypes.powerpc; };

Where `cpuTypes.powerpc` is:

  { bits = 32; significantByte = bigEndian; family = "power"; };

This means that the `isPowerPC` predicate actually only matches the
subset of machines marketed under this name which happen to be 32-bit
and running in big-endian mode which is equivalent to:

  with stdenv.hostPlatform; isPower && isBigEndian && is32bit

This seems like a sharp edge that people could easily cut themselves
on.  In fact, that has already happened: in
`linux/kernel/common-config.nix` there is a test which will always
fail:

  (stdenv.hostPlatform.isPowerPC && stdenv.hostPlatform.is64bit)

A more subtle case of the strict isPowerPC being used instead of the
moreg general isPower accidentally are the GHC expressions:

  Update pkgs/development/compilers/ghc/8.10.7.nix
  Update pkgs/development/compilers/ghc/8.8.4.nix
  Update pkgs/development/compilers/ghc/9.2.2.nix
  Update pkgs/development/compilers/ghc/9.0.2.nix
  Update pkgs/development/compilers/ghc/head.nix

Since the remaining legitimate use sites of isPowerPC are so few, remove
the isPowerPC predicate completely. The alternative expression above is
noted in the release notes as an alternative.

Co-authored-by: sternenseemann <sternenseemann@systemli.org>
2022-05-25 09:45:42 +02:00
Nick Cao eef4bbd82f
stdenv: fix evaluation of platform emulator 2022-05-24 12:01:56 +08:00
sternenseemann 82c434b3de lib.systems: inform isCompatible users about removal 2022-05-23 21:26:03 +02:00
sternenseemann acb063701a lib.systems.elaborate: expose canExecute predicate over isCompatible
canExecute is like isCompatible, but also checks that the Kernels are
_equal_, i.e. that both platforms use the same syscall interface. This
is crucial in order to actually be able to execute binaries for the
other platform.

isCompatible is dropped, since it has changed semantically and there's
no use case left in nixpkgs.
2022-05-23 21:25:04 +02:00
sternenseemann fe836f3564 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.
2022-05-23 21:25:04 +02:00
sternenseemann 168b926435 lib.systems: remove supported, replace with flakeExposed
Since the list only gates the platforms the nixpkgs flake exposes
packages to build on, the `hydra` label made little sense. It was also
only used for this purpose, so the `tier*` attributes were largely
unnecessary.

To reflect the intention more accurately, we expose
`lib.systems.flakeExposed` and use it to gate flake.nix's system list.
2022-05-23 15:27:30 +02:00
yvt bf139d83ec
systems: support cross-compiling for Renesas RX microcontrollers (#173858) 2022-05-22 20:52:36 -04:00
Rick van Schijndel b9e8ed239f
Merge pull request #161156 from a-m-joseph/abort-on-failed-platform-detection-instead-of-silently-assuming-pc
platforms.nix: use {} on failed detection instead of silently assuming pc
2022-05-04 05:37:16 +02:00
Adam Joseph 006c38fa53 platforms.nix: use {} on failed detection instead of silently assuming pc
This patch causes the autodetection code in lib/systems/platforms.nix
to return {} if it cannot detect the platform and one of the
platform.nix-detection-provided attributes (linux-kernel, gcc, and
rustc) are accessed, rather than silently assuming the "pc" platform
as was previously done.

It is definitely safe to assume that code using these attributes is
prepared to deal with `gcc` and `rustc` not being defined, because
many of the working entries in this file don't define it.

Regarding `linux-kernel` the situation is less certain, but some code
(`lib/systems/default.nix` for example) is already designed to deal
with that attribute being missing.  At worst it would result in an
"attribute not found" error.

While adding mips64el bootstrap support to nixpkgs, the silent
assumption that mips64el routers are actually Intel PCs caused
significant frustration.  This commit removes that assumption in order
to save people who port nixpkgs to new platforms in the future from
this frustration.
2022-05-03 13:31:41 -07:00
Alyssa Ross 2a6288d9b9 lib.systems: add riscv{32,64} sets and filters
For other platforms like Intel and ARM, we can do
e.g. lib.platforms.aarch64 to get only the 64-bit ARM platorms, but
until now there were no equivalents for RISC-V.
2022-04-28 08:17:02 +00:00
Adam Joseph 3e60871330 lib/systems/platforms.nix: use "32" instead of "o32" for mips32 ABI
There is only one ABI for 32-bit MIPS chips.  Before mips64, it didn't
really have a name.

The 64-bit MIPS ABI comes in two flavors, "n64" and "n32".  It is
commonplace to refer to the old 32-bit ABI as "o32" (MIPS and SGI
documents do this).

However, when configuring gcc, one must use --with-abi=32, not
--with-abi=o32.

Let's keep GCC happy with this commit.
2022-04-27 23:46:02 -07:00
Sandro 294ed1bed7
Merge pull request #168111 from a-m-joseph/lib-systems-inspect-powerpc
lib/systems/inspect.nix: add isPower64
2022-04-25 02:22:48 +02:00
Artturin 4aab12d5a1 lib/systems/platforms: correctly import examples.nix
before: :p lib.systems failed with
error: getting status of '...examples': no such file or directory
2022-04-15 20:25:58 +03:00
Adam Joseph 81afd541f9 lib/systems/inspect.nix: add isPower64
This commit adds an `isPower64` predicate to the two existing
predicates for this architecture (`isPower` and `isPowerPC`).

Note that `isPowerPC` matches only 32-bit machines, whereas `isPower`
matches both 64-bit and 32-bit machines.  Prior to this commit there
was no single `isXXX` predicate for `powerpc64le`.
2022-04-10 01:56:28 -07:00
Adam Joseph ff69b8c2bf Ericson2314's suggestion here: https://github.com/NixOS/nixpkgs/pull/161158#discussion_r822295406 2022-03-10 20:30:19 -08:00
Adam Joseph 6de935a012 This commit adds only comments to platforms.nix. 2022-03-10 20:30:19 -08:00
Adam Joseph ed4fa55fc3 comment: explain why gnuabi64 has a rustc.config but gnuabin32 does not. 2022-03-10 20:30:18 -08:00
Adam Joseph 998fd408e0 remove float = "hard" from mips entries 2022-03-10 20:30:18 -08:00
Adam Joseph e748e1fd18 https://github.com/NixOS/nixpkgs/pull/161158#pullrequestreview-903824553 2022-03-10 20:30:18 -08:00
Adam Joseph 12371a51e6 lib/systems: add mips64el definitions
MIPS has a large space of {architecture,abi,endianness}; this commit
adds all of them to lib/systems/platforms.nix so we can be done with
it.

Currently lib/systems/inspect.nix has a single "isMips" predicate,
which is a bit ambiguous now that we will have both mips32 and mips64
support, with the latter having two ABIs.  Let's add four new
predicates (isMips32, isMips64, isMips64n32, and isMips64n64) and
treat the now-ambiguous isMips as deprecated in favor of the
more-specific predicates.  These predicates are used mainly for
enabling/disabling target-specific workarounds, and it is extremely
rare that a platform-specific workaround is needed, and both mips32
and mips64 need exactly the same workaround.

The separate predicates (isMips64n32 and isMips64n64) for ABI
distinctions are, unfortunately, useful.  Boost's user-scheduled
threading (used by nix) does does not currently supports mips64n32,
which is a very desirable ABI on routers since they rarely have
more than 2**32 bytes of DRAM.
2022-03-10 20:30:16 -08:00
Levi Wright 752a8c516d
lib/systems: Fix uclibc float-abi being flipped
uclibceabihf and uclibceabi's float hardness was flipped, which causes many headaches
2022-03-07 17:05:51 +00:00
sternenseemann 9066c52e5a lib.systems.supported: remove aarch64-darwin from Tier 3 list
While it is a fact of life that aarch64-darwin is built on Hydra, it has
never formally been elevated from the Tier 7 state it was originally
assigned in RFC 0046. Since platform Tier status is not only
descriptive, but also normative, a consensus to commit to supporting
aarch64-darwin would need to be reached.
2021-12-16 17:51:21 +01:00
Jörg Thalheim 108ca3d04b
Merge pull request #149924 from Mic92/aarch64be-embedded
pkgsCross.aarch64be-embedded: fix eval
2021-12-09 22:11:37 +00:00
Jörg Thalheim a8c277c8a8 pkgsCross.x86_64-netbsd-llvm: mark as broken 2021-12-09 23:08:40 +01:00
Jörg Thalheim 41a1e7fc36 pkgsCross.ppcle-embedded: fix eval 2021-12-09 22:23:15 +01:00
Jörg Thalheim ce33ed7545 pkgsCross.aarch64be-embedded: fix eval 2021-12-09 21:49:19 +01:00
Jonathan Ringer dbe6e96d0a
lib/systems: add x86_64-darwin hostPlatform 2021-11-10 11:37:34 -08:00
Ryan Burns 81ee86a2c6
Merge pull request #139284 from r-burns/powernv-kernel-config
lib/systems: update powernv kernel config
2021-10-28 13:53:16 -07:00
zimbatm 60d3ef0484
lib.systems.supported.tier3: add aarch64-darwin
aarch64-darwin is getting built by hydra
2021-10-06 17:27:32 +02:00
Jonas Chevalier 8377a7bca9
lib: add list of supported systems (#140428)
Adds the first 3 tiers of RFC0046 that are being used in flake.nix.
2021-10-05 11:14:47 +02:00
Ryan Burns 288cc2007b lib/systems: update powernv kernel config
PowerNV was looking for a nonexisting zImage file.
Remove unnecessary .file / .installTarget.

Also add config options needed for default minimal
NixOS config and QEMU VirtIO/VirtFS devices.
2021-09-28 17:41:13 -07:00
Sergei Trofimovich 34e468dc42 lib/systems: add minimal s390x-linux cross-compile support
Tested basic functionality as:

    $ nix-build --arg crossSystem '{ config = "s390x-unknown-linux-gnu"; }' -A re2c
    $ file ./result/bin/re2c
    $ ./result/bin/re2c: ELF 64-bit MSB executable, IBM S/390, version 1 (SYSV),
    dynamically linked, interpreter ...-gnu-2.33-50/lib/ld64.so.1, for GNU/Linux 2.6.32, not stripped
    $ qemu-s390x ./result/bin/re2c --version
    re2c 2.2
2021-09-09 10:58:47 +00:00
Luke Granger-Brown 5ab1ce6734
Merge pull request #134763 from r-burns/fix-scaleway
lib/systems: fix scaleway-c1 platform
2021-08-21 03:40:30 +01:00
Alyssa Ross 273bab6bb6
lib.systems.inspect.patterns.isGnu: init
This allows checking e.g. stdenv.hostPlatform.isGnu, just like isMusl
or isUClibc.  It was already possible to check for glibc with
stdenv.hostPlatform.libc == "glibc", but when that doesn't line up
with how every other platform check works, this is apparently
sufficiently non-obvious that we've ended up with stuff like adding
glibc.static if !isMusl, which is obviously wrong.
2021-08-19 13:03:53 +00:00
Ryan Burns 525c69e724 lib/systems: fix scaleway-c1 platform
This regressed in 9c213398b3

The recursiveUpdate gave the platform both gcc.cpu and gcc.arch attrs
instead of only gcc.cpu. This is invalid; gcc configuration fails with:

```
Switch "--with-arch" may not be used with switch "--with-cpu"
```

So we revert to using `//` to retain only gcc.cpu
(which is more specific than the processor arch).
2021-08-18 21:52:14 -07:00
Alyssa Ross 3669b12f35 lib.systems: add m68k-netbsd support
m68k was recently added for Linux and none, but NetBSD also supports
m68k.  Nothing will build yet, but I want to make sure we at least
encode the existence of NetBSD support for every applicable
architecture we support for other operating systems.
2021-08-01 15:27:12 +00:00