authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-09-06 10:48:21-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2024-09-06 10:48:21-07:00
log1511a4171f1717ef9d5eeef2b69e6636bd487e0a
tree7ac4f72840377da12f7488dfd44c8c531e3e14f1
parentb230e4f598bd18b47f3f1c981869c597a06c7452
parentee3efe8007402c496a6e589fc279e07578e8280f
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #21310 from alexrp/ppc64-tests

Force ELFv2 for PPC64 and add `powerpc64-linux-(none,musl)` to CI

4 files changed, 34 insertions(+), 2 deletions(-)

src/target.zig+8-1
......@@ -381,6 +381,14 @@ pub fn addrSpaceCastIsValid(
381381}
382382
383383pub fn llvmMachineAbi(target: std.Target) ?[:0]const u8 {
384 // LLD does not support ELFv1. Rather than having LLVM produce ELFv1 code and then linking it
385 // into a broken ELFv2 binary, just force LLVM to use ELFv2 as well. This will break when glibc
386 // is linked as glibc only supports ELFv2 for little endian, but there's nothing we can do about
387 // that. With this hack, `powerpc64-linux-none` will at least work.
388 //
389 // Once our self-hosted linker can handle both ABIs, this hack should go away.
390 if (target.cpu.arch == .powerpc64) return "elfv2";
391
384392 const have_float = switch (target.abi) {
385393 .gnueabihf, .musleabihf, .eabihf => true,
386394 else => false,
......@@ -409,7 +417,6 @@ pub fn llvmMachineAbi(target: std.Target) ?[:0]const u8 {
409417 return "ilp32";
410418 }
411419 },
412 //TODO add ARM, Mips, and PowerPC
413420 else => return null,
414421 }
415422}
test/behavior/union.zig+1-1
......@@ -1891,7 +1891,7 @@ test "reinterpret packed union" {
18911891 try comptime S.doTheTest();
18921892
18931893 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
1894 if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; // TODO
1894 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21050
18951895 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21050
18961896 if (builtin.cpu.arch.isWasm()) return error.SkipZigTest; // TODO
18971897 try S.doTheTest();
test/behavior/vector.zig+1
......@@ -1450,6 +1450,7 @@ test "store vector with memset" {
14501450 .mips64el,
14511451 .riscv64,
14521452 .powerpc,
1453 .powerpc64,
14531454 => {
14541455 // LLVM 16 ERROR: "Converting bits to bytes lost precision"
14551456 // https://github.com/ziglang/zig/issues/16177
test/tests.zig+24
......@@ -438,6 +438,30 @@ const test_targets = blk: {
438438 // .link_libc = true,
439439 //},
440440
441 .{
442 .target = .{
443 .cpu_arch = .powerpc64,
444 .os_tag = .linux,
445 .abi = .none,
446 },
447 },
448 .{
449 .target = .{
450 .cpu_arch = .powerpc64,
451 .os_tag = .linux,
452 .abi = .musl,
453 },
454 .link_libc = true,
455 },
456 // Requires ELFv1 linker support.
457 // .{
458 // .target = .{
459 // .cpu_arch = .powerpc64,
460 // .os_tag = .linux,
461 // .abi = .gnu,
462 // },
463 // .link_libc = true,
464 // },
441465 .{
442466 .target = .{
443467 .cpu_arch = .powerpc64le,