mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
Merge pull request #21578 from alexrp/s390x-porting
Get module tests passing for `s390x-linux` and add it to CI
This commit is contained in:
commit
b23a5b56c2
7 changed files with 70 additions and 2 deletions
|
|
@ -2753,6 +2753,19 @@ pub const Sigaction = switch (native_os) {
|
||||||
restorer: ?*const fn () callconv(.C) void = null,
|
restorer: ?*const fn () callconv(.C) void = null,
|
||||||
__resv: [1]c_int = .{0},
|
__resv: [1]c_int = .{0},
|
||||||
},
|
},
|
||||||
|
.s390x => if (builtin.abi == .gnu) extern struct {
|
||||||
|
pub const handler_fn = *align(1) const fn (i32) callconv(.C) void;
|
||||||
|
pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.C) void;
|
||||||
|
|
||||||
|
handler: extern union {
|
||||||
|
handler: ?handler_fn,
|
||||||
|
sigaction: ?sigaction_fn,
|
||||||
|
},
|
||||||
|
__glibc_reserved0: c_int = 0,
|
||||||
|
flags: c_uint,
|
||||||
|
restorer: ?*const fn () callconv(.C) void = null,
|
||||||
|
mask: sigset_t,
|
||||||
|
} else linux.Sigaction,
|
||||||
else => linux.Sigaction,
|
else => linux.Sigaction,
|
||||||
},
|
},
|
||||||
.emscripten => emscripten.Sigaction,
|
.emscripten => emscripten.Sigaction,
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ pub const sys_can_stack_trace = switch (builtin.cpu.arch) {
|
||||||
.mipsel,
|
.mipsel,
|
||||||
.mips64,
|
.mips64,
|
||||||
.mips64el,
|
.mips64el,
|
||||||
|
.s390x,
|
||||||
=> false,
|
=> false,
|
||||||
|
|
||||||
// `@returnAddress()` in LLVM 10 gives
|
// `@returnAddress()` in LLVM 10 gives
|
||||||
|
|
|
||||||
|
|
@ -904,7 +904,19 @@ pub fn mmap(address: ?[*]u8, length: usize, prot: usize, flags: MAP, fd: i32, of
|
||||||
@truncate(@as(u64, @bitCast(offset)) / MMAP2_UNIT),
|
@truncate(@as(u64, @bitCast(offset)) / MMAP2_UNIT),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return syscall6(
|
// The s390x mmap() syscall existed before Linux supported syscalls with 5+ parameters, so
|
||||||
|
// it takes a single pointer to an array of arguments instead.
|
||||||
|
return if (native_arch == .s390x) syscall1(
|
||||||
|
.mmap,
|
||||||
|
@intFromPtr(&[_]usize{
|
||||||
|
@intFromPtr(address),
|
||||||
|
length,
|
||||||
|
prot,
|
||||||
|
@as(u32, @bitCast(flags)),
|
||||||
|
@bitCast(@as(isize, fd)),
|
||||||
|
@as(u64, @bitCast(offset)),
|
||||||
|
}),
|
||||||
|
) else syscall6(
|
||||||
.mmap,
|
.mmap,
|
||||||
@intFromPtr(address),
|
@intFromPtr(address),
|
||||||
length,
|
length,
|
||||||
|
|
|
||||||
|
|
@ -541,7 +541,19 @@ inline fn mmap(address: ?[*]u8, length: usize, prot: usize, flags: linux.MAP, fd
|
||||||
@as(usize, @truncate(@as(u64, @bitCast(offset)) / linux.MMAP2_UNIT)),
|
@as(usize, @truncate(@as(u64, @bitCast(offset)) / linux.MMAP2_UNIT)),
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return @call(.always_inline, linux.syscall6, .{
|
// The s390x mmap() syscall existed before Linux supported syscalls with 5+ parameters, so
|
||||||
|
// it takes a single pointer to an array of arguments instead.
|
||||||
|
return if (native_arch == .s390x) @call(.always_inline, linux.syscall1, .{
|
||||||
|
.mmap,
|
||||||
|
@intFromPtr(&[_]usize{
|
||||||
|
@intFromPtr(address),
|
||||||
|
length,
|
||||||
|
prot,
|
||||||
|
@as(u32, @bitCast(flags)),
|
||||||
|
@as(usize, @bitCast(@as(isize, fd))),
|
||||||
|
@as(u64, @bitCast(offset)),
|
||||||
|
}),
|
||||||
|
}) else @call(.always_inline, linux.syscall6, .{
|
||||||
.mmap,
|
.mmap,
|
||||||
@intFromPtr(address),
|
@intFromPtr(address),
|
||||||
length,
|
length,
|
||||||
|
|
|
||||||
|
|
@ -368,6 +368,11 @@ test "fstatat" {
|
||||||
// now repeat but using `fstatat` instead
|
// now repeat but using `fstatat` instead
|
||||||
const flags = if (native_os == .wasi) 0x0 else posix.AT.SYMLINK_NOFOLLOW;
|
const flags = if (native_os == .wasi) 0x0 else posix.AT.SYMLINK_NOFOLLOW;
|
||||||
const statat = try posix.fstatat(tmp.dir.fd, "file.txt", flags);
|
const statat = try posix.fstatat(tmp.dir.fd, "file.txt", flags);
|
||||||
|
|
||||||
|
// s390x-linux does not have nanosecond precision for fstat(), but it does for fstatat(). As a
|
||||||
|
// result, comparing the two structures is doomed to fail.
|
||||||
|
if (builtin.cpu.arch == .s390x and builtin.os.tag == .linux) return error.SkipZigTest;
|
||||||
|
|
||||||
try expectEqual(stat, statat);
|
try expectEqual(stat, statat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12241,6 +12241,7 @@ fn ccAbiPromoteInt(
|
||||||
.sparc64,
|
.sparc64,
|
||||||
.powerpc64,
|
.powerpc64,
|
||||||
.powerpc64le,
|
.powerpc64le,
|
||||||
|
.s390x,
|
||||||
=> switch (int_info.bits) {
|
=> switch (int_info.bits) {
|
||||||
0...63 => int_info.signedness,
|
0...63 => int_info.signedness,
|
||||||
else => null,
|
else => null,
|
||||||
|
|
|
||||||
|
|
@ -636,6 +636,30 @@ const test_targets = blk: {
|
||||||
.use_lld = false,
|
.use_lld = false,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
.{
|
||||||
|
.target = .{
|
||||||
|
.cpu_arch = .s390x,
|
||||||
|
.os_tag = .linux,
|
||||||
|
.abi = .none,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
.{
|
||||||
|
.target = .{
|
||||||
|
.cpu_arch = .s390x,
|
||||||
|
.os_tag = .linux,
|
||||||
|
.abi = .musl,
|
||||||
|
},
|
||||||
|
.link_libc = true,
|
||||||
|
},
|
||||||
|
.{
|
||||||
|
.target = .{
|
||||||
|
.cpu_arch = .s390x,
|
||||||
|
.os_tag = .linux,
|
||||||
|
.abi = .gnu,
|
||||||
|
},
|
||||||
|
.link_libc = true,
|
||||||
|
},
|
||||||
|
|
||||||
.{
|
.{
|
||||||
.target = .{
|
.target = .{
|
||||||
.cpu_arch = .x86_64,
|
.cpu_arch = .x86_64,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue