authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-03-13 05:33:42+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-04-26 19:24:46+02:00
log9f2f6aaef519fe37a6936653bbd01b69b1f65a2f
tree6ab57e62404caf246810f38e99700a8779bed8fe
parent8c5542bd38c4c78139d4f18b83cd8d52e3e71a83

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.

6 files changed, 7 insertions(+), 20 deletions(-)

lib/std/Target.zig+5-6
......@@ -2682,9 +2682,8 @@ pub const DynamicLinker = struct {
26822682 else => none,
26832683 },
26842684
2685 .powerpc64,
2686 .powerpc64le,
2687 => if (abi == .gnu) init("/lib64/ld64.so.2") else none,
2685 .powerpc64 => if (abi == .gnu) init("/lib64/ld64.so.1") else none,
2686 .powerpc64le => if (abi == .gnu) init("/lib64/ld64.so.2") else none,
26882687
26892688 .riscv32,
26902689 .riscv64,
......@@ -3741,10 +3740,10 @@ pub fn cCallingConvention(target: *const Target) ?std.builtin.CallingConvention
37413740 .riscv32, .riscv32be => .{ .riscv32_ilp32 = .{} },
37423741 .sparc64 => .{ .sparc64_sysv = .{} },
37433742 .sparc => .{ .sparc_sysv = .{} },
3744 .powerpc64 => if (target.abi.isMusl())
3745 .{ .powerpc64_elf_v2 = .{} }
3743 .powerpc64 => if (target.abi.isGnu())
3744 .{ .powerpc64_elf = .{} }
37463745 else
3747 .{ .powerpc64_elf = .{} },
3746 .{ .powerpc64_elf_v2 = .{} },
37483747 .powerpc64le => .{ .powerpc64_elf_v2 = .{} },
37493748 .powerpc, .powerpcle => .{ .powerpc_sysv = .{} },
37503749 .wasm32, .wasm64 => .{ .wasm_mvp = .{} },
lib/std/zig/target.zig+1-2
......@@ -84,7 +84,6 @@ pub const available_libcs = [_]ArchOsAbi{
8484 .{ .arch = .powerpc, .os = .netbsd, .abi = .eabihf, .os_ver = .{ .major = 1, .minor = 4, .patch = 0 } },
8585 .{ .arch = .powerpc, .os = .openbsd, .abi = .eabihf, .os_ver = .{ .major = 2, .minor = 8, .patch = 0 } },
8686 .{ .arch = .powerpc64, .os = .freebsd, .abi = .none, .os_ver = .{ .major = 8, .minor = 0, .patch = 0 } },
87 .{ .arch = .powerpc64, .os = .linux, .abi = .gnu, .os_ver = .{ .major = 2, .minor = 6, .patch = 0 } },
8887 .{ .arch = .powerpc64, .os = .linux, .abi = .musl, .os_ver = .{ .major = 2, .minor = 6, .patch = 0 } },
8988 .{ .arch = .powerpc64, .os = .openbsd, .abi = .none, .os_ver = .{ .major = 6, .minor = 8, .patch = 0 } },
9089 .{ .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 {
245244 .arm, .armeb => "arm",
246245 .loongarch64 => "loongarch",
247246 .mips, .mipsel, .mips64, .mips64el => "mips",
248 .powerpc, .powerpc64, .powerpc64le => "powerpc",
247 .powerpc, .powerpc64le => "powerpc",
249248 .riscv32, .riscv64 => "riscv",
250249 .sparc, .sparc64 => "sparc",
251250 .x86, .x86_64 => "x86",
src/target.zig+1-1
......@@ -695,7 +695,7 @@ pub fn llvmMachineAbi(target: *const std.Target) ?[:0]const u8 {
695695 .gnuabin32, .muslabin32 => "n32",
696696 else => "n64",
697697 },
698 .powerpc64, .powerpc64le => "elfv2", // We do not support ELFv1.
698 .powerpc64, .powerpc64le => if (target.os.tag == .ps3) "elfv1" else "elfv2",
699699 .riscv64, .riscv64be => if (target.cpu.has(.riscv, .e))
700700 "lp64e"
701701 else if (target.cpu.has(.riscv, .d))
test/llvm_targets.zig-1
......@@ -205,7 +205,6 @@ const targets = [_]std.Target.Query{
205205
206206 .{ .cpu_arch = .powerpc64, .os_tag = .freebsd, .abi = .none },
207207 .{ .cpu_arch = .powerpc64, .os_tag = .freestanding, .abi = .none },
208 .{ .cpu_arch = .powerpc64, .os_tag = .linux, .abi = .gnu },
209208 .{ .cpu_arch = .powerpc64, .os_tag = .linux, .abi = .musl },
210209 .{ .cpu_arch = .powerpc64, .os_tag = .linux, .abi = .none },
211210 .{ .cpu_arch = .powerpc64, .os_tag = .openbsd, .abi = .none },
test/tests.zig-9
......@@ -837,15 +837,6 @@ const module_test_targets = blk: {
837837 .link_libc = true,
838838 .extra_target = true,
839839 },
840 // glibc's build-many-glibcs.py currently only builds this target for ELFv1.
841 // .{
842 // .target = .{
843 // .cpu_arch = .powerpc64,
844 // .os_tag = .linux,
845 // .abi = .gnu,
846 // },
847 // .link_libc = true,
848 // },
849840 .{
850841 .target = .{
851842 .cpu_arch = .powerpc64le,
tools/process_headers.zig-1
......@@ -49,7 +49,6 @@ const glibc_targets = [_]LibCTarget{
4949 .{ .arch = .mips64el, .abi = .gnuabin32, .dest = "mips-linux-gnu" },
5050 .{ .arch = .powerpc, .abi = .gnueabi, .dest = "powerpc-linux-gnu" },
5151 .{ .arch = .powerpc, .abi = .gnueabihf, .dest = "powerpc-linux-gnu" },
52 .{ .arch = .powerpc64, .abi = .gnu, .dest = "powerpc-linux-gnu" },
5352 .{ .arch = .powerpc64le, .abi = .gnu, .dest = "powerpc-linux-gnu" },
5453 .{ .arch = .riscv32, .abi = .gnu, .dest = "riscv-linux-gnu" },
5554 .{ .arch = .riscv64, .abi = .gnu, .dest = "riscv-linux-gnu" },