Skip to content

Commit

Permalink
lib/systems/inspect.nix: add isILP32 predicate
Browse files Browse the repository at this point in the history
I've run into a few packages that need an extra flag on platforms
where `int` has more bits than `void*` does.  I know of three such
platforms:

* [aarch64ilp32], used on both Linux and also on the [Apple Watch]
* [x32], the x86 ILP32 ABI
* [mips64n32], used on [Longsoon] and Cavium Octeon routers.

This PR introduces a predicate so the package flags can be added in
a generic way.

[Apple Watch]: https://gist.github.com/woachk/943828f37c14563a607a26116435bf27#watch
[mips64n32]: https://en.wikipedia.org/wiki/MIPS_architecture#Calling_conventions
[Longsoon]: https://en.wikipedia.org/wiki/Loongson
[x32]: https://en.wikipedia.org/wiki/X32_ABI
  • Loading branch information
Adam Joseph committed Jan 2, 2023
1 parent 47fd756 commit 14f337a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/systems/inspect.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ rec {

is32bit = { cpu = { bits = 32; }; };
is64bit = { cpu = { bits = 64; }; };
isILP32 = map (a: { abi = { abi = a; }; }) [ "n32" "ilp32" "x32" ];
isBigEndian = { cpu = { significantByte = significantBytes.bigEndian; }; };
isLittleEndian = { cpu = { significantByte = significantBytes.littleEndian; }; };

Expand Down

0 comments on commit 14f337a

Please sign in to comment.