about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Ericson <git@JohnEricson.me>2021-01-30 16:26:06 -0500
committerGitHub <noreply@github.com>2021-01-30 16:26:06 -0500
commit5fc5e83808c1f9ce5b414a1d596f6427b77ac180 (patch)
treec8a1f403c89f13ae51830d1706d3737ccef3c4e9
parentfccda5aae6659e8abce91503194d618c2bfc6e59 (diff)
parent5530a3adbe9be842f22cd83b59b06cdd5a94308e (diff)
Merge pull request #111345 from r-burns/ppc64-big-endian
Enable PPC64 (big-endian)
-rw-r--r--lib/systems/doubles.nix5
-rw-r--r--lib/systems/examples.nix13
-rw-r--r--lib/systems/parse.nix9
-rw-r--r--lib/tests/systems.nix2
-rw-r--r--pkgs/development/compilers/gcc/common/platform-flags.nix2
-rw-r--r--pkgs/stdenv/default.nix1
-rw-r--r--pkgs/stdenv/linux/make-bootstrap-tools-cross.nix2
-rw-r--r--pkgs/stdenv/linux/make-bootstrap-tools.nix3
8 files changed, 32 insertions, 5 deletions
diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix
index b0bc7dd1188a3..07327fa227368 100644
--- a/lib/systems/doubles.nix
+++ b/lib/systems/doubles.nix
@@ -24,6 +24,7 @@ let
 
     "x86_64-redox"
 
+    "powerpc64-linux"
     "powerpc64le-linux"
 
     "riscv32-linux" "riscv64-linux"
@@ -72,7 +73,7 @@ in {
   darwin        = filterDoubles predicates.isDarwin;
   freebsd       = filterDoubles predicates.isFreeBSD;
   # Should be better, but MinGW is unclear.
-  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; });
+  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; });
   illumos       = filterDoubles predicates.isSunOS;
   linux         = filterDoubles predicates.isLinux;
   netbsd        = filterDoubles predicates.isNetBSD;
@@ -85,5 +86,5 @@ in {
 
   embedded      = filterDoubles predicates.isNone;
 
-  mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "armv7a-linux" "aarch64-linux" "powerpc64le-linux"];
+  mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "armv7a-linux" "aarch64-linux" "powerpc64-linux" "powerpc64le-linux"];
 }
diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix
index be87fb1d06945..8a43b86db701e 100644
--- a/lib/systems/examples.nix
+++ b/lib/systems/examples.nix
@@ -21,6 +21,19 @@ rec {
     config = "powerpc64le-unknown-linux-musl";
   };
 
+  ppc64-elfv1 = {
+    config = "powerpc64-unknown-linux-elfv1";
+  };
+  ppc64-elfv2 = {
+    config = "powerpc64-unknown-linux-elfv2";
+  };
+  ppc64 = ppc64-elfv2; # default to modern elfv2
+
+  ppc64-musl = {
+    config = "powerpc64-unknown-linux-musl";
+    gcc = { abi = "elfv2"; }; # for gcc configuration
+  };
+
   sheevaplug = {
     config = "armv5tel-unknown-linux-gnueabi";
   } // platforms.sheevaplug;
diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix
index a06ac0d11f747..8e012622ccd02 100644
--- a/lib/systems/parse.nix
+++ b/lib/systems/parse.nix
@@ -337,10 +337,18 @@ rec {
             The "gnu" ABI is ambiguous on 32-bit ARM. Use "gnueabi" or "gnueabihf" instead.
           '';
         }
+        { assertion = platform: platform.system != "powerpc64-linux";
+          message = ''
+            The "gnu" ABI is ambiguous on big-endian 64-bit PPC. Use "elfv1" or "elfv2" instead.
+          '';
+        }
       ];
     };
     gnuabi64     = { abi = "64"; };
 
+    elfv1        = { abi = "elfv1"; };
+    elfv2        = { abi = "elfv2"; };
+
     musleabi     = { float = "soft"; };
     musleabihf   = { float = "hard"; };
     musl         = {};
@@ -444,6 +452,7 @@ rec {
             if lib.versionAtLeast (parsed.cpu.version or "0") "6"
             then abis.gnueabihf
             else abis.gnueabi
+          else if cpu == "powerpc64" then abis.elfv2
           else abis.gnu
         else                     abis.unknown;
     };
diff --git a/lib/tests/systems.nix b/lib/tests/systems.nix
index eed7ee725bc47..c0800df25ed7b 100644
--- a/lib/tests/systems.nix
+++ b/lib/tests/systems.nix
@@ -28,7 +28,7 @@ with lib.systems.doubles; lib.runTests {
   testredox = mseteq redox [ "x86_64-redox" ];
   testgnu = mseteq gnu (linux /* ++ kfreebsd ++ ... */);
   testillumos = mseteq illumos [ "x86_64-solaris" ];
-  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" ];
+  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" ];
   testnetbsd = mseteq netbsd [ "i686-netbsd" "x86_64-netbsd" ];
   testopenbsd = mseteq openbsd [ "i686-openbsd" "x86_64-openbsd" ];
   testwindows = mseteq windows [ "i686-cygwin" "x86_64-cygwin" "i686-windows" "x86_64-windows" ];
diff --git a/pkgs/development/compilers/gcc/common/platform-flags.nix b/pkgs/development/compilers/gcc/common/platform-flags.nix
index 66af8c4a4cc77..bd5a72f960364 100644
--- a/pkgs/development/compilers/gcc/common/platform-flags.nix
+++ b/pkgs/development/compilers/gcc/common/platform-flags.nix
@@ -11,6 +11,6 @@ in lib.concatLists [
   (lib.optional (p ? float) "--with-float=${p.float}")
   (lib.optional (p ? mode) "--with-mode=${p.mode}")
   (lib.optional
-    (let tp = targetPlatform; in tp.isPower && tp.libc == "glibc" && tp.is64bit && tp.isLittleEndian)
+    (let tp = targetPlatform; in tp.isPower && tp.libc == "glibc" && tp.is64bit)
     "--with-long-double-128")
 ]
diff --git a/pkgs/stdenv/default.nix b/pkgs/stdenv/default.nix
index b0db1be5f4466..d9eadf26804c6 100644
--- a/pkgs/stdenv/default.nix
+++ b/pkgs/stdenv/default.nix
@@ -54,6 +54,7 @@ in
     aarch64-linux = stagesLinux;
     mipsel-linux = stagesLinux;
     powerpc-linux = /* stagesLinux */ stagesNative;
+    powerpc64-linux = stagesLinux;
     powerpc64le-linux = stagesLinux;
     x86_64-darwin = stagesDarwin;
     x86_64-solaris = stagesNix;
diff --git a/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix b/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix
index d1ee317a2bcf4..d8ab96952b7f2 100644
--- a/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix
+++ b/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix
@@ -17,6 +17,8 @@ in lib.mapAttrs (n: make) (with lib.systems.examples; {
   armv6l-musl  = muslpi;
   aarch64-musl = aarch64-multiplatform-musl;
   riscv64 = riscv64;
+  powerpc64 = ppc64;
+  powerpc64-musl = ppc64-musl;
   powerpc64le = powernv;
   powerpc64le-musl = musl-power;
 })
diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix
index e4db92b7717c2..869405a27607c 100644
--- a/pkgs/stdenv/linux/make-bootstrap-tools.nix
+++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix
@@ -19,7 +19,8 @@ in with pkgs; rec {
   tarMinimal = gnutar.override { acl = null; };
 
   busyboxMinimal = busybox.override {
-    useMusl = !stdenv.targetPlatform.isRiscV;
+    useMusl = with stdenv.targetPlatform; !isRiscV &&
+                (system == "powerpc64-linux" -> parsed.abi.name != "elfv1");
     enableStatic = true;
     enableMinimal = true;
     extraConfig = ''