Merge pull request #21310 from alexrp/ppc64-tests

Force ELFv2 for PPC64 and add `powerpc64-linux-(none,musl)` to CI
This commit is contained in:
Andrew Kelley
2024-09-06 10:48:21 -07:00
committed by GitHub
4 changed files with 34 additions and 2 deletions

View File

@@ -381,6 +381,14 @@ pub fn addrSpaceCastIsValid(
}
pub fn llvmMachineAbi(target: std.Target) ?[:0]const u8 {
// LLD does not support ELFv1. Rather than having LLVM produce ELFv1 code and then linking it
// into a broken ELFv2 binary, just force LLVM to use ELFv2 as well. This will break when glibc
// is linked as glibc only supports ELFv2 for little endian, but there's nothing we can do about
// that. With this hack, `powerpc64-linux-none` will at least work.
//
// Once our self-hosted linker can handle both ABIs, this hack should go away.
if (target.cpu.arch == .powerpc64) return "elfv2";
const have_float = switch (target.abi) {
.gnueabihf, .musleabihf, .eabihf => true,
else => false,
@@ -409,7 +417,6 @@ pub fn llvmMachineAbi(target: std.Target) ?[:0]const u8 {
return "ilp32";
}
},
//TODO add ARM, Mips, and PowerPC
else => return null,
}
}

View File

@@ -1891,7 +1891,7 @@ test "reinterpret packed union" {
try comptime S.doTheTest();
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; // TODO
if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21050
if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21050
if (builtin.cpu.arch.isWasm()) return error.SkipZigTest; // TODO
try S.doTheTest();

View File

@@ -1450,6 +1450,7 @@ test "store vector with memset" {
.mips64el,
.riscv64,
.powerpc,
.powerpc64,
=> {
// LLVM 16 ERROR: "Converting bits to bytes lost precision"
// https://github.com/ziglang/zig/issues/16177

View File

@@ -438,6 +438,30 @@ const test_targets = blk: {
// .link_libc = true,
//},
.{
.target = .{
.cpu_arch = .powerpc64,
.os_tag = .linux,
.abi = .none,
},
},
.{
.target = .{
.cpu_arch = .powerpc64,
.os_tag = .linux,
.abi = .musl,
},
.link_libc = true,
},
// Requires ELFv1 linker support.
// .{
// .target = .{
// .cpu_arch = .powerpc64,
// .os_tag = .linux,
// .abi = .gnu,
// },
// .link_libc = true,
// },
.{
.target = .{
.cpu_arch = .powerpc64le,