Commit Graph

90 Commits

Author SHA1 Message Date
Adam Joseph
06939ff3de add mipsisa{32,64}r6[el], closes 209952 2023-01-09 16:04:16 -08:00
Adam Joseph
36a566b78f lib/systems/parse.nix: mkSkeletonFromList: improve readability
The main purpose of this PR is to make the basis for
`mkSkeletonFromList`'s decision between `cpu-kernel-libcabi` vs
`cpu-vendor-os` clear, without changing its behavior.  The existing
code obscures this decision behind a sequence of prioritized matches
(i.e. `if-then`) which jump around between different coordinates.

Two side benefits of this PR:

1. It makes the root cause of #165836 obvious: we are missing a case
   for `cpu-vendor-libcabi`.  This is why nixpkgs stumbles over
   `*-none-*`.

2. It illuminates some very weird corner cases in the existing
   logic, like `*-${vendor}-ghcjs` overriding the `vendor` field,
   and `mingw32` being transformed into `windows` in some cases.

Co-authored-by: John Ericson <git@JohnEricson.me>
2022-11-13 23:08:57 -08:00
John Ericson
66aa02f190 lib/systems: Support FreeBSD
A tricky thing about FreeBSD is that there is no stable ABI across
versions. That means that putting in the version as part of the config
string is paramount.

We have a parsed represenation that separates name versus version to
accomplish this. We include FreeBSD versions 12 and 13 to demonstrate
how it works.
2022-11-04 16:49:28 -04:00
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
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
yvt
bf139d83ec
systems: support cross-compiling for Renesas RX microcontrollers (#173858) 2022-05-22 20:52:36 -04: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
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
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
Ben Siraphob
0f1204bd2b Initial implementation of s390 cross-compile 2021-07-25 10:12:18 +07:00
Ben Siraphob
407953e9df Initial implementation of m68k cross-compile 2021-07-24 14:37:35 +07:00
Alyssa Ross
4d6a0bb966 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.
2021-06-06 18:52:58 +00:00
Alyssa Ross
5a8372d04e lib.systems.parse.kernels: fix typo in comment 2021-06-06 18:52:58 +00:00
Ben Siraphob
f986333023 lib/systems/parse: make isCompatible description clearer and more useful
Stating that CPUs and the isCompatible relation forms a category (or
preorder) is correct but overtly technical.  We can state it more
clearly for readers unfamiliar with mathematics while retaining some
keywords to be useful to technical readers.
2021-05-14 13:23:28 -07:00
Ryan Burns
8ea1660b9e lib/systems: remove powerpc64 elfv1 support
I was specifying the ELF ABI using -elfv1 and -elfv2 target config
suffixes, which are nonstandard and no longer work with gnu-config.
2021-03-15 19:27:41 -07:00
Ryan Burns
72b3badb61 lib.systems: add powerpc64-linux
PPC64 supports two ABIs: ELF v1 and v2.

ELFv1 is historically what GCC and most packages expect, but this is
changing because musl outright does not work with ELFv1. So any distro
which uses musl must use ELFv2. Many other platforms are moving to ELFv2
too, such as FreeBSD (as of v13) and Gentoo (as of late 2020).

Since we use musl extensively, let's default to ELFv2.

Nix gives us the power to specify this declaratively for the entire
system, so ELFv1 is not dropped entirely. It can be specified explicitly
in the target config, e.g. "powerpc64-unknown-linux-elfv1". Otherwise the
default is "powerpc64-unknown-linux-elfv2". For musl,
"powerpc64-unknown-linux-musl" must use elfv2 internally to function.
2021-01-30 12:34:24 -08:00
Frederik Rietdijk
986c2d36da Merge master into staging-next 2020-11-16 09:01:53 +01:00
Samuel Dionne-Riel
6d8327ea96 Initial support for OpenRISC 1000 (or1k) 2020-11-09 22:32:11 -05:00
Ben Siraphob
445dde6304 Initial implementation of mmix cross-compile 2020-11-09 19:49:55 +07:00
Aaron Janse
60fd049b65 redox: add as target 2020-07-21 13:11:36 -07:00
Emery Hemingway
9f91fa02a6 lib/systems: Add Genode platform definitions
Add platform definitions for 64-bit ARM and x86. This is sufficient for
for building Genode where a toolchain is provided as an overlay.

Toolchain: git+https://git.sr.ht/~ehmry/genodepkgs?rev=14fc773ac9ecd2cbb30cb4612b284eee83d83546
2020-03-24 20:41:21 +05:30
Michael Bishop
4aa1ffae04
initial implementation of vc4 cross-compile 2019-11-19 22:19:15 -04:00
John Ericson
16f0fe7fe3 Merge remote-tracking branch 'upstream/master' into mingw-mcfthreads 2019-11-11 20:48:14 -05:00
John Ericson
91718534f1 lib: Switch to w64 vendor for MinGW
It is needed for the `-municode` flag, supposedly.
2019-11-11 00:25:24 -05:00
oxalica
955d032b47
lib.systems: handle mips family properly 2019-11-03 22:10:06 +08:00
Vladimír Čunát
f21211ebfe
Merge branch 'master' into staging 2019-09-02 23:25:24 +02:00
John Ericson
c33d80c071 Merge remote-tracking branch 'upstream/master' into feature/js-unknown-ghcjs 2019-09-02 01:31:31 -04:00
Moritz Angermann
446f8c851d Add support for js-unknown-ghcjs
This adds enough logic to nixpkgs to support the `js-unknown-ghcjs` triple.
2019-09-02 01:27:05 -04:00
volth
08f68313a4 treewide: remove redundant rec 2019-08-28 11:07:32 +00:00
volth
f3282c8d1e treewide: remove unused variables (#63177)
* treewide: remove unused variables

* making ofborg happy
2019-06-16 19:59:05 +00:00
Matthew Bauer
7488a367af
Merge pull request #56555 from matthewbauer/wasm
Initial WebAssembly/WASI cross-compilation support
2019-04-23 22:44:33 -04:00
Matthew Bauer
9abff4af4f wasm: init cross target
Adds pkgsCross.wasm32 and pkgsCross.wasm64. Use it to build Nixpkgs
with a WebAssembly toolchain.

stdenv/cross: use static overlay on isWasm

isWasm doesn’t make sense dynamically linked.
2019-04-23 21:48:57 -04:00
Matthew Bauer
d180cb9850 cc-wrapper: make machine configuration configurable
It is useful to make these dynamic and not bake them into gcc. This
means we don’t have to rebuild gcc to change these values. Instead, we
will pass cflags to gcc based on platform values. This was already
done hackily for android gcc (which is multi-target), but not for our
own gccs which are single target.

To accomplish this, we need to add a few things:

- add ‘arch’ to cpu
- add NIX_CFLAGS_COMPILE_BEFORE flag (goes before args)
- set -march everywhere
- set mcpu, mfpu, mmode, and mtune based on targetPlatform.gcc flags

cc-wrapper: only set -march when it is in the cpu type

Some architectures don’t have a good mapping of -march. For instance
POWER architecture doesn’t support the -march flag at all!

https://gcc.gnu.org/onlinedocs/gcc/RS_002f6000-and-PowerPC-Options.html#RS_002f6000-and-PowerPC-Options
2019-04-20 20:05:51 -04:00
Matthew Bauer
59bb1dcbfb systems/parse.nix: fixup arm compatibilities 2019-04-19 12:00:32 -04:00
Aaron Lindsay
1eca945e94 systems: support TI MSP430 microcontrollers 2019-03-25 20:33:58 -07:00
Matthew Bauer
f455a07f13 systems: add isCompatible handling 2019-02-21 22:17:51 -05:00
John Ericson
3bf0e4efc7 lib: Fix Mingw on 32-bit ARM 2019-01-04 12:05:35 -05:00
Matthew Bauer
3b32c920d5 systems/parse.nix: support eabihf
eabihf is an abi that can be used with ARM architectures that support
the “hard float”. It should probably only be used with ARM32 when you
are absolutely sure your binaries will run on ARM systems with a FPU.

Also, add an example "armhf-embedded" to match the preexisting
arm-embedded system. qmk_firmware needs hard float in a few places, so
add them here to get that to work.

Fixes #51184
2018-12-02 19:49:36 -06:00
Matthew Bauer
4b00cfe77f systems/parse: add older x86 architectures
i386, i486, i586 are added. These may have issues as many places
assume i686 is the only valid 32 bit x86 architecture.
2018-11-21 09:38:10 -06:00
Vincent Weisner
0607adde1a
Update parse.nix 2018-11-02 09:38:47 -04:00
Jörg Thalheim
aa75ebdcd3
CPU Fix
Co-Authored-By: vincrusher <vincentweisner@icloud.com>
2018-11-01 11:14:18 -04:00
Vincent Weisner
f9aaf7134b
Update parse.nix 2018-11-01 10:00:55 -04:00
Matthew Bauer
2634d37617 systems/examples: add i686 & x86-64 embedded
Fixes #28160
2018-10-30 13:46:01 -05:00
Matthew Bauer
52dbd3380e systems/parse.nix: support weird system configs
There are some weird ones out there that don’t follow any pattern:

- arm-none-eabi
- powerpc-none-eabi
- aarch64-none-elf
2018-10-29 14:34:10 -05:00
Matthew Bauer
d59a9ac7cf avr: use new compilation infrastructure
Gets rid of:
  avrbinutils
  avrgcc

to replace with:
  pkgsCross.avr.buildPackages.binutils
  pkgsCross.avr.buildPackages.gcc
2018-10-29 14:34:09 -05:00
Jörg Thalheim
9efffe0135 hurd: cleanup unmaintained target
This has been not touched in 6 years. Let's remove it to cause less
problems when adding new cross-compiling infrastructure.
This also simplify gcc significantly.
2018-08-28 22:18:02 +01:00
CrystalGamma
72d161f548 [RFC] ppc64le enablement (#45340)
* ppc64le enablement

* gcc, glibc: properly handle __float128

* lib/systems, stdenv: syntax cleanup

* gcc7: remove ugly hack

* gcc: add/update __float128 flags

* stdenv: add another pair of quotes for consistency

* gcc: move __float128 flag for ppc64le-glibc into common/platform-flags.nix
2018-08-21 15:31:34 -04:00