From 8ea1660b9e45f36d597af201b0f752478388ca66 Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Mon, 15 Mar 2021 19:22:57 -0700 Subject: [PATCH 1/3] 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. --- lib/systems/doubles.nix | 2 +- lib/systems/examples.nix | 10 +++------- lib/systems/parse.nix | 9 --------- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix index 07327fa22736..8220bca249fb 100644 --- a/lib/systems/doubles.nix +++ b/lib/systems/doubles.nix @@ -73,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; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.elfv1; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.elfv2; }); + 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; }); illumos = filterDoubles predicates.isSunOS; linux = filterDoubles predicates.isLinux; netbsd = filterDoubles predicates.isNetBSD; diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 8a43b86db701..81dc893871d3 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -21,14 +21,10 @@ rec { config = "powerpc64le-unknown-linux-musl"; }; - ppc64-elfv1 = { - config = "powerpc64-unknown-linux-elfv1"; + ppc64 = { + config = "powerpc64-unknown-linux-gnu"; + gcc = { abi = "elfv2"; }; # for gcc configuration }; - 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 diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix index 8e012622ccd0..a06ac0d11f74 100644 --- a/lib/systems/parse.nix +++ b/lib/systems/parse.nix @@ -337,18 +337,10 @@ 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 = {}; @@ -452,7 +444,6 @@ 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; }; From 7b9c1dbd28218c68e923f5226705f2cb10b44390 Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Mon, 15 Mar 2021 19:24:41 -0700 Subject: [PATCH 2/3] pkgs/top-level/stage: force elfv2 on static powerpc64-linux The staging logic reconstructs the target platform, discarding powerpc64's custom gcc.abi = elfv2 setup. Musl requires ELFv2 ABI so this should be set unconditionally here. --- pkgs/top-level/stage.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix index 8fc460ca5227..77f3cc677f65 100644 --- a/pkgs/top-level/stage.nix +++ b/pkgs/top-level/stage.nix @@ -227,6 +227,8 @@ let }.${stdenv.hostPlatform.parsed.abi.name} or lib.systems.parse.abis.musl; }; + } // lib.optionalAttrs (stdenv.hostPlatform.system == "powerpc64-linux") { + gcc.abi = "elfv2"; }; }); }; From 68823d6d65b17eb900307588a723ed5acdcf98f9 Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Mon, 15 Mar 2021 19:23:35 -0700 Subject: [PATCH 3/3] stdenv/bootstrap-tools: remove powerpc64 special case Now that powerpc64 is always ELFv2, we can unconditionally use musl tools here. --- pkgs/stdenv/linux/make-bootstrap-tools.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix index 869405a27607..e4db92b7717c 100644 --- a/pkgs/stdenv/linux/make-bootstrap-tools.nix +++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix @@ -19,8 +19,7 @@ in with pkgs; rec { tarMinimal = gnutar.override { acl = null; }; busyboxMinimal = busybox.override { - useMusl = with stdenv.targetPlatform; !isRiscV && - (system == "powerpc64-linux" -> parsed.abi.name != "elfv1"); + useMusl = !stdenv.targetPlatform.isRiscV; enableStatic = true; enableMinimal = true; extraConfig = ''