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(...@@ -381,6 +381,14 @@ pub fn addrSpaceCastIsValid(
381}381}
382382
383pub fn llvmMachineAbi(target: std.Target) ?[:0]const u8 {383pub 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
384 const have_float = switch (target.abi) {392 const have_float = switch (target.abi) {
385 .gnueabihf, .musleabihf, .eabihf => true,393 .gnueabihf, .musleabihf, .eabihf => true,
386 else => false,394 else => false,
...@@ -409,7 +417,6 @@ pub fn llvmMachineAbi(target: std.Target) ?[:0]const u8 {...@@ -409,7 +417,6 @@ pub fn llvmMachineAbi(target: std.Target) ?[:0]const u8 {
409 return "ilp32";417 return "ilp32";
410 }418 }
411 },419 },
412 //TODO add ARM, Mips, and PowerPC
413 else => return null,420 else => return null,
414 }421 }
415}422}
test/behavior/union.zig+1-1
...@@ -1891,7 +1891,7 @@ test "reinterpret packed union" {...@@ -1891,7 +1891,7 @@ test "reinterpret packed union" {
1891 try comptime S.doTheTest();1891 try comptime S.doTheTest();
18921892
1893 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO1893 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
1894 if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; // TODO1894 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21050
1895 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/210501895 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21050
1896 if (builtin.cpu.arch.isWasm()) return error.SkipZigTest; // TODO1896 if (builtin.cpu.arch.isWasm()) return error.SkipZigTest; // TODO
1897 try S.doTheTest();1897 try S.doTheTest();
test/behavior/vector.zig+1
...@@ -1450,6 +1450,7 @@ test "store vector with memset" {...@@ -1450,6 +1450,7 @@ test "store vector with memset" {
1450 .mips64el,1450 .mips64el,
1451 .riscv64,1451 .riscv64,
1452 .powerpc,1452 .powerpc,
1453 .powerpc64,
1453 => {1454 => {
1454 // LLVM 16 ERROR: "Converting bits to bytes lost precision"1455 // LLVM 16 ERROR: "Converting bits to bytes lost precision"
1455 // https://github.com/ziglang/zig/issues/161771456 // https://github.com/ziglang/zig/issues/16177
test/tests.zig+24
...@@ -438,6 +438,30 @@ const test_targets = blk: {...@@ -438,6 +438,30 @@ const test_targets = blk: {
438 // .link_libc = true,438 // .link_libc = true,
439 //},439 //},
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 // },
441 .{465 .{
442 .target = .{466 .target = .{
443 .cpu_arch = .powerpc64le,467 .cpu_arch = .powerpc64le,