git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #111345 from r-burns/ppc64-big-endian

Enable PPC64 (big-endian)

commit5fc5e83808c1f9ce5b414a1d596f6427b77ac180 authorJohn Ericson <git@JohnEricson.me> dateSat 30 Jan 2021, 16:26 (6 years ago) parentfccda5a5530a3a
8 files changed+32−5
lib/systems/doubles.nix+3−2 lib/systems/examples.nix+13 lib/systems/parse.nix+9 lib/tests/systems.nix+1−1 pkgs/development/compilers/gcc/common/platform-flags.nix+1−1 pkgs/stdenv/default.nix+1 pkgs/stdenv/linux/make-bootstrap-tools-cross.nix+2 pkgs/stdenv/linux/make-bootstrap-tools.nix+2−1
lib/systems/doubles.nix+3−2
@@ -24,6 +24,7 @@ let
2424
2525 "x86_64-redox"
2626
27+ "powerpc64-linux"
2728 "powerpc64le-linux"
2829
2930 "riscv32-linux" "riscv64-linux"
@@ -72,7 +73,7 @@ in {
7273 darwin = filterDoubles predicates.isDarwin;
7374 freebsd = filterDoubles predicates.isFreeBSD;
7475 # Should be better, but MinGW is unclear.
75− gnu = filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnu; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnueabi; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnueabihf; });
76+ gnu = filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnu; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnueabi; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnueabihf; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.elfv1; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.elfv2; });
7677 illumos = filterDoubles predicates.isSunOS;
7778 linux = filterDoubles predicates.isLinux;
7879 netbsd = filterDoubles predicates.isNetBSD;
@@ -85,5 +86,5 @@ in {
8586
8687 embedded = filterDoubles predicates.isNone;
8788
88− mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "armv7a-linux" "aarch64-linux" "powerpc64le-linux"];
89+ mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "armv7a-linux" "aarch64-linux" "powerpc64-linux" "powerpc64le-linux"];
8990}
lib/systems/examples.nix+13
@@ -21,6 +21,19 @@ rec {
2121 config = "powerpc64le-unknown-linux-musl";
2222 };
2323
24+ ppc64-elfv1 = {
25+ config = "powerpc64-unknown-linux-elfv1";
26+ };
27+ ppc64-elfv2 = {
28+ config = "powerpc64-unknown-linux-elfv2";
29+ };
30+ ppc64 = ppc64-elfv2; # default to modern elfv2
31+
32+ ppc64-musl = {
33+ config = "powerpc64-unknown-linux-musl";
34+ gcc = { abi = "elfv2"; }; # for gcc configuration
35+ };
36+
2437 sheevaplug = {
2538 config = "armv5tel-unknown-linux-gnueabi";
2639 } // platforms.sheevaplug;
lib/systems/parse.nix+9
@@ -337,10 +337,18 @@ rec {
337337 The "gnu" ABI is ambiguous on 32-bit ARM. Use "gnueabi" or "gnueabihf" instead.
338338 '';
339339 }
340+ { assertion = platform: platform.system != "powerpc64-linux";
341+ message = ''
342+ The "gnu" ABI is ambiguous on big-endian 64-bit PPC. Use "elfv1" or "elfv2" instead.
343+ '';
344+ }
340345 ];
341346 };
342347 gnuabi64 = { abi = "64"; };
343348
349+ elfv1 = { abi = "elfv1"; };
350+ elfv2 = { abi = "elfv2"; };
351+
344352 musleabi = { float = "soft"; };
345353 musleabihf = { float = "hard"; };
346354 musl = {};
@@ -444,6 +452,7 @@ rec {
444452 if lib.versionAtLeast (parsed.cpu.version or "0") "6"
445453 then abis.gnueabihf
446454 else abis.gnueabi
455+ else if cpu == "powerpc64" then abis.elfv2
447456 else abis.gnu
448457 else abis.unknown;
449458 };
lib/tests/systems.nix+1−1
@@ -28,7 +28,7 @@ with lib.systems.doubles; lib.runTests {
2828 testredox = mseteq redox [ "x86_64-redox" ];
2929 testgnu = mseteq gnu (linux /* ++ kfreebsd ++ ... */);
3030 testillumos = mseteq illumos [ "x86_64-solaris" ];
31− testlinux = mseteq linux [ "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-linux" "mipsel-linux" "riscv32-linux" "riscv64-linux" "x86_64-linux" "powerpc64le-linux" ];
31+ testlinux = mseteq linux [ "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-linux" "mipsel-linux" "riscv32-linux" "riscv64-linux" "x86_64-linux" "powerpc64-linux" "powerpc64le-linux" ];
3232 testnetbsd = mseteq netbsd [ "i686-netbsd" "x86_64-netbsd" ];
3333 testopenbsd = mseteq openbsd [ "i686-openbsd" "x86_64-openbsd" ];
3434 testwindows = mseteq windows [ "i686-cygwin" "x86_64-cygwin" "i686-windows" "x86_64-windows" ];
pkgs/development/compilers/gcc/common/platform-flags.nix+1−1
@@ -11,6 +11,6 @@ in lib.concatLists [
1111 (lib.optional (p ? float) "--with-float=${p.float}")
1212 (lib.optional (p ? mode) "--with-mode=${p.mode}")
1313 (lib.optional
14− (let tp = targetPlatform; in tp.isPower && tp.libc == "glibc" && tp.is64bit && tp.isLittleEndian)
14+ (let tp = targetPlatform; in tp.isPower && tp.libc == "glibc" && tp.is64bit)
1515 "--with-long-double-128")
1616]
pkgs/stdenv/default.nix+1
@@ -54,6 +54,7 @@ in
5454 aarch64-linux = stagesLinux;
5555 mipsel-linux = stagesLinux;
5656 powerpc-linux = /* stagesLinux */ stagesNative;
57+ powerpc64-linux = stagesLinux;
5758 powerpc64le-linux = stagesLinux;
5859 x86_64-darwin = stagesDarwin;
5960 x86_64-solaris = stagesNix;
pkgs/stdenv/linux/make-bootstrap-tools-cross.nix+2
@@ -17,6 +17,8 @@ in lib.mapAttrs (n: make) (with lib.systems.examples; {
1717 armv6l-musl = muslpi;
1818 aarch64-musl = aarch64-multiplatform-musl;
1919 riscv64 = riscv64;
20+ powerpc64 = ppc64;
21+ powerpc64-musl = ppc64-musl;
2022 powerpc64le = powernv;
2123 powerpc64le-musl = musl-power;
2224})
pkgs/stdenv/linux/make-bootstrap-tools.nix+2−1
@@ -19,7 +19,8 @@ in with pkgs; rec {
1919 tarMinimal = gnutar.override { acl = null; };
2020
2121 busyboxMinimal = busybox.override {
22− useMusl = !stdenv.targetPlatform.isRiscV;
22+ useMusl = with stdenv.targetPlatform; !isRiscV &&
23+ (system == "powerpc64-linux" -> parsed.abi.name != "elfv1");
2324 enableStatic = true;
2425 enableMinimal = true;
2526 extraConfig = ''