drop support for powerpc64-linux-gnu

glibc has never officially supported ELFv2 on big-endian PowerPC, and we do not
(and likely never will) support linking ELFv1. So just drop this target instead
of pretending we actually have anything resembling usable support for it. This
is a dying target anyway; IBM have been pushing people to powerpc64le for years
now, and most distros have dropped big endian.

glibc headers and abilists are not updated as part of this; I'll just let that
happen automatically on the next glibc update. Size savings are expected to be
very minimal anyway since there's large overlap between powerpc64 and
powerpc64le.

This commit also fixes a couple of bad assumptions in std.Target:

* The dynamic linker path should be /lib64/ld64.so.1. We should get this right
  even if the Zig compiler doesn't support the target.
* cCallingConvention() was picking powerpc64_elf_v2 only for musl targets. In
  reality, for the targets we support in std.Target, it should pick v2 for all
  except powerpc64-linux-gnu.

Finally, this switches LLVM codegen to use ELFv2 data layout for all targets
except ps3.
This commit is contained in:
Alex Rønne Petersen
2026-03-13 05:33:42 +01:00
parent 8c5542bd38
commit 9f2f6aaef5
6 changed files with 7 additions and 20 deletions
+5 -6
View File
@@ -2682,9 +2682,8 @@ pub const DynamicLinker = struct {
else => none,
},
.powerpc64,
.powerpc64le,
=> if (abi == .gnu) init("/lib64/ld64.so.2") else none,
.powerpc64 => if (abi == .gnu) init("/lib64/ld64.so.1") else none,
.powerpc64le => if (abi == .gnu) init("/lib64/ld64.so.2") else none,
.riscv32,
.riscv64,
@@ -3741,10 +3740,10 @@ pub fn cCallingConvention(target: *const Target) ?std.builtin.CallingConvention
.riscv32, .riscv32be => .{ .riscv32_ilp32 = .{} },
.sparc64 => .{ .sparc64_sysv = .{} },
.sparc => .{ .sparc_sysv = .{} },
.powerpc64 => if (target.abi.isMusl())
.{ .powerpc64_elf_v2 = .{} }
.powerpc64 => if (target.abi.isGnu())
.{ .powerpc64_elf = .{} }
else
.{ .powerpc64_elf = .{} },
.{ .powerpc64_elf_v2 = .{} },
.powerpc64le => .{ .powerpc64_elf_v2 = .{} },
.powerpc, .powerpcle => .{ .powerpc_sysv = .{} },
.wasm32, .wasm64 => .{ .wasm_mvp = .{} },
+1 -2
View File
@@ -84,7 +84,6 @@ pub const available_libcs = [_]ArchOsAbi{
.{ .arch = .powerpc, .os = .netbsd, .abi = .eabihf, .os_ver = .{ .major = 1, .minor = 4, .patch = 0 } },
.{ .arch = .powerpc, .os = .openbsd, .abi = .eabihf, .os_ver = .{ .major = 2, .minor = 8, .patch = 0 } },
.{ .arch = .powerpc64, .os = .freebsd, .abi = .none, .os_ver = .{ .major = 8, .minor = 0, .patch = 0 } },
.{ .arch = .powerpc64, .os = .linux, .abi = .gnu, .os_ver = .{ .major = 2, .minor = 6, .patch = 0 } },
.{ .arch = .powerpc64, .os = .linux, .abi = .musl, .os_ver = .{ .major = 2, .minor = 6, .patch = 0 } },
.{ .arch = .powerpc64, .os = .openbsd, .abi = .none, .os_ver = .{ .major = 6, .minor = 8, .patch = 0 } },
.{ .arch = .powerpc64le, .os = .freebsd, .abi = .none, .os_ver = .{ .major = 13, .minor = 0, .patch = 0 } },
@@ -245,7 +244,7 @@ pub fn glibcArchNameHeaders(arch: std.Target.Cpu.Arch) [:0]const u8 {
.arm, .armeb => "arm",
.loongarch64 => "loongarch",
.mips, .mipsel, .mips64, .mips64el => "mips",
.powerpc, .powerpc64, .powerpc64le => "powerpc",
.powerpc, .powerpc64le => "powerpc",
.riscv32, .riscv64 => "riscv",
.sparc, .sparc64 => "sparc",
.x86, .x86_64 => "x86",
+1 -1
View File
@@ -695,7 +695,7 @@ pub fn llvmMachineAbi(target: *const std.Target) ?[:0]const u8 {
.gnuabin32, .muslabin32 => "n32",
else => "n64",
},
.powerpc64, .powerpc64le => "elfv2", // We do not support ELFv1.
.powerpc64, .powerpc64le => if (target.os.tag == .ps3) "elfv1" else "elfv2",
.riscv64, .riscv64be => if (target.cpu.has(.riscv, .e))
"lp64e"
else if (target.cpu.has(.riscv, .d))
-1
View File
@@ -205,7 +205,6 @@ const targets = [_]std.Target.Query{
.{ .cpu_arch = .powerpc64, .os_tag = .freebsd, .abi = .none },
.{ .cpu_arch = .powerpc64, .os_tag = .freestanding, .abi = .none },
.{ .cpu_arch = .powerpc64, .os_tag = .linux, .abi = .gnu },
.{ .cpu_arch = .powerpc64, .os_tag = .linux, .abi = .musl },
.{ .cpu_arch = .powerpc64, .os_tag = .linux, .abi = .none },
.{ .cpu_arch = .powerpc64, .os_tag = .openbsd, .abi = .none },
-9
View File
@@ -837,15 +837,6 @@ const module_test_targets = blk: {
.link_libc = true,
.extra_target = true,
},
// glibc's build-many-glibcs.py currently only builds this target for ELFv1.
// .{
// .target = .{
// .cpu_arch = .powerpc64,
// .os_tag = .linux,
// .abi = .gnu,
// },
// .link_libc = true,
// },
.{
.target = .{
.cpu_arch = .powerpc64le,
-1
View File
@@ -49,7 +49,6 @@ const glibc_targets = [_]LibCTarget{
.{ .arch = .mips64el, .abi = .gnuabin32, .dest = "mips-linux-gnu" },
.{ .arch = .powerpc, .abi = .gnueabi, .dest = "powerpc-linux-gnu" },
.{ .arch = .powerpc, .abi = .gnueabihf, .dest = "powerpc-linux-gnu" },
.{ .arch = .powerpc64, .abi = .gnu, .dest = "powerpc-linux-gnu" },
.{ .arch = .powerpc64le, .abi = .gnu, .dest = "powerpc-linux-gnu" },
.{ .arch = .riscv32, .abi = .gnu, .dest = "riscv-linux-gnu" },
.{ .arch = .riscv64, .abi = .gnu, .dest = "riscv-linux-gnu" },