From 8b06bf875c0e494d59430cdf108656debc45f224 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Sat, 11 Oct 2025 20:48:52 +0200 Subject: [PATCH 1/2] lib.systems: Simplify ABI on POWER for rust.rustcTarget Rust does not know how to parse "gnuabielfv{1,2}", so simplify those down to just "gnu". This obsoletes the manual rustcTarget fix in the ppc64-elfv1 example. --- lib/systems/default.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 7e78ceb4827a..96bde04151ae 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -491,6 +491,13 @@ let } .${cpu.name} or cpu.name; vendor_ = final.rust.platform.vendor; + abi_ = + # We're very explicit about the POWER ELF ABI w/ glibc in our parsing, while Rust is not. + # TODO: Somehow ensure that Rust actually *uses* the correct ABI, and not just a libc-based default. + if (lib.strings.hasPrefix "powerpc" cpu.name) && (lib.strings.hasPrefix "gnuabielfv" abi.name) then + "gnu" + else + abi.name; in # TODO: deprecate args.rustc in favour of args.rust after 23.05 is EOL. args.rust.rustcTarget or args.rustc.config or ( @@ -501,7 +508,7 @@ let if final.isWasi then "${cpu_}-wasip1" else - "${cpu_}-${vendor_}-${kernel.name}${optionalString (abi.name != "unknown") "-${abi.name}"}" + "${cpu_}-${vendor_}-${kernel.name}${optionalString (abi.name != "unknown") "-${abi_}"}" ); # The name of the rust target if it is standard, or the json file From 8448c289197007e00b41c42999c3472c8ffa9e44 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Sat, 11 Oct 2025 20:50:02 +0200 Subject: [PATCH 2/2] lib.systems.examples.ppc64-elfv1: Drop manual fix of rust.rustcTarget ABI is now simplified automatically. --- lib/systems/examples.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index cdd28b1ddde1..47c3cf0c9558 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -23,7 +23,6 @@ rec { ppc64-elfv1 = { config = "powerpc64-unknown-linux-gnuabielfv1"; - rust.rustcTarget = "powerpc64-unknown-linux-gnu"; }; ppc64-elfv2 = { config = "powerpc64-unknown-linux-gnuabielfv2";