| author | |
| committer | |
| log | b23a5b56c2f4fcbba689d86055671fcb6297b7cc |
| tree | a93aa7c9117d4fc4719451106115402135f4bcca |
| parent | 03457755590c73893bce21f551d5664333baf267 |
| parent | 736694b1e60cf63c60756acff3cd074bc9c4e9df |
| signature |
Get module tests passing for `s390x-linux` and add it to CI7 files changed, 70 insertions(+), 2 deletions(-)
lib/std/c.zig+13| ... | @@ -2753,6 +2753,19 @@ pub const Sigaction = switch (native_os) { | ... | @@ -2753,6 +2753,19 @@ pub const Sigaction = switch (native_os) { |
| 2753 | restorer: ?*const fn () callconv(.C) void = null, | 2753 | restorer: ?*const fn () callconv(.C) void = null, |
| 2754 | __resv: [1]c_int = .{0}, | 2754 | __resv: [1]c_int = .{0}, |
| 2755 | }, | 2755 | }, |
| 2756 | .s390x => if (builtin.abi == .gnu) extern struct { | ||
| 2757 | pub const handler_fn = *align(1) const fn (i32) callconv(.C) void; | ||
| 2758 | pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.C) void; | ||
| 2759 | |||
| 2760 | handler: extern union { | ||
| 2761 | handler: ?handler_fn, | ||
| 2762 | sigaction: ?sigaction_fn, | ||
| 2763 | }, | ||
| 2764 | __glibc_reserved0: c_int = 0, | ||
| 2765 | flags: c_uint, | ||
| 2766 | restorer: ?*const fn () callconv(.C) void = null, | ||
| 2767 | mask: sigset_t, | ||
| 2768 | } else linux.Sigaction, | ||
| 2756 | else => linux.Sigaction, | 2769 | else => linux.Sigaction, |
| 2757 | }, | 2770 | }, |
| 2758 | .emscripten => emscripten.Sigaction, | 2771 | .emscripten => emscripten.Sigaction, |
lib/std/debug.zig+1| ... | @@ -61,6 +61,7 @@ pub const sys_can_stack_trace = switch (builtin.cpu.arch) { | ... | @@ -61,6 +61,7 @@ pub const sys_can_stack_trace = switch (builtin.cpu.arch) { |
| 61 | .mipsel, | 61 | .mipsel, |
| 62 | .mips64, | 62 | .mips64, |
| 63 | .mips64el, | 63 | .mips64el, |
| 64 | .s390x, | ||
| 64 | => false, | 65 | => false, |
| 65 | 66 | ||
| 66 | // `@returnAddress()` in LLVM 10 gives | 67 | // `@returnAddress()` in LLVM 10 gives |
lib/std/os/linux.zig+13-1| ... | @@ -904,7 +904,19 @@ pub fn mmap(address: ?[*]u8, length: usize, prot: usize, flags: MAP, fd: i32, of | ... | @@ -904,7 +904,19 @@ pub fn mmap(address: ?[*]u8, length: usize, prot: usize, flags: MAP, fd: i32, of |
| 904 | @truncate(@as(u64, @bitCast(offset)) / MMAP2_UNIT), | 904 | @truncate(@as(u64, @bitCast(offset)) / MMAP2_UNIT), |
| 905 | ); | 905 | ); |
| 906 | } else { | 906 | } else { |
| 907 | return syscall6( | 907 | // The s390x mmap() syscall existed before Linux supported syscalls with 5+ parameters, so |
| 908 | // it takes a single pointer to an array of arguments instead. | ||
| 909 | return if (native_arch == .s390x) syscall1( | ||
| 910 | .mmap, | ||
| 911 | @intFromPtr(&[_]usize{ | ||
| 912 | @intFromPtr(address), | ||
| 913 | length, | ||
| 914 | prot, | ||
| 915 | @as(u32, @bitCast(flags)), | ||
| 916 | @bitCast(@as(isize, fd)), | ||
| 917 | @as(u64, @bitCast(offset)), | ||
| 918 | }), | ||
| 919 | ) else syscall6( | ||
| 908 | .mmap, | 920 | .mmap, |
| 909 | @intFromPtr(address), | 921 | @intFromPtr(address), |
| 910 | length, | 922 | length, |
lib/std/os/linux/tls.zig+13-1| ... | @@ -541,7 +541,19 @@ inline fn mmap(address: ?[*]u8, length: usize, prot: usize, flags: linux.MAP, fd | ... | @@ -541,7 +541,19 @@ inline fn mmap(address: ?[*]u8, length: usize, prot: usize, flags: linux.MAP, fd |
| 541 | @as(usize, @truncate(@as(u64, @bitCast(offset)) / linux.MMAP2_UNIT)), | 541 | @as(usize, @truncate(@as(u64, @bitCast(offset)) / linux.MMAP2_UNIT)), |
| 542 | }); | 542 | }); |
| 543 | } else { | 543 | } else { |
| 544 | return @call(.always_inline, linux.syscall6, .{ | 544 | // The s390x mmap() syscall existed before Linux supported syscalls with 5+ parameters, so |
| 545 | // it takes a single pointer to an array of arguments instead. | ||
| 546 | return if (native_arch == .s390x) @call(.always_inline, linux.syscall1, .{ | ||
| 547 | .mmap, | ||
| 548 | @intFromPtr(&[_]usize{ | ||
| 549 | @intFromPtr(address), | ||
| 550 | length, | ||
| 551 | prot, | ||
| 552 | @as(u32, @bitCast(flags)), | ||
| 553 | @as(usize, @bitCast(@as(isize, fd))), | ||
| 554 | @as(u64, @bitCast(offset)), | ||
| 555 | }), | ||
| 556 | }) else @call(.always_inline, linux.syscall6, .{ | ||
| 545 | .mmap, | 557 | .mmap, |
| 546 | @intFromPtr(address), | 558 | @intFromPtr(address), |
| 547 | length, | 559 | length, |
lib/std/posix/test.zig+5| ... | @@ -368,6 +368,11 @@ test "fstatat" { | ... | @@ -368,6 +368,11 @@ test "fstatat" { |
| 368 | // now repeat but using `fstatat` instead | 368 | // now repeat but using `fstatat` instead |
| 369 | const flags = if (native_os == .wasi) 0x0 else posix.AT.SYMLINK_NOFOLLOW; | 369 | const flags = if (native_os == .wasi) 0x0 else posix.AT.SYMLINK_NOFOLLOW; |
| 370 | const statat = try posix.fstatat(tmp.dir.fd, "file.txt", flags); | 370 | const statat = try posix.fstatat(tmp.dir.fd, "file.txt", flags); |
| 371 | |||
| 372 | // s390x-linux does not have nanosecond precision for fstat(), but it does for fstatat(). As a | ||
| 373 | // result, comparing the two structures is doomed to fail. | ||
| 374 | if (builtin.cpu.arch == .s390x and builtin.os.tag == .linux) return error.SkipZigTest; | ||
| 375 | |||
| 371 | try expectEqual(stat, statat); | 376 | try expectEqual(stat, statat); |
| 372 | } | 377 | } |
| 373 | 378 |
src/codegen/llvm.zig+1| ... | @@ -12241,6 +12241,7 @@ fn ccAbiPromoteInt( | ... | @@ -12241,6 +12241,7 @@ fn ccAbiPromoteInt( |
| 12241 | .sparc64, | 12241 | .sparc64, |
| 12242 | .powerpc64, | 12242 | .powerpc64, |
| 12243 | .powerpc64le, | 12243 | .powerpc64le, |
| 12244 | .s390x, | ||
| 12244 | => switch (int_info.bits) { | 12245 | => switch (int_info.bits) { |
| 12245 | 0...63 => int_info.signedness, | 12246 | 0...63 => int_info.signedness, |
| 12246 | else => null, | 12247 | else => null, |
test/tests.zig+24| ... | @@ -636,6 +636,30 @@ const test_targets = blk: { | ... | @@ -636,6 +636,30 @@ const test_targets = blk: { |
| 636 | .use_lld = false, | 636 | .use_lld = false, |
| 637 | }, | 637 | }, |
| 638 | 638 | ||
| 639 | .{ | ||
| 640 | .target = .{ | ||
| 641 | .cpu_arch = .s390x, | ||
| 642 | .os_tag = .linux, | ||
| 643 | .abi = .none, | ||
| 644 | }, | ||
| 645 | }, | ||
| 646 | .{ | ||
| 647 | .target = .{ | ||
| 648 | .cpu_arch = .s390x, | ||
| 649 | .os_tag = .linux, | ||
| 650 | .abi = .musl, | ||
| 651 | }, | ||
| 652 | .link_libc = true, | ||
| 653 | }, | ||
| 654 | .{ | ||
| 655 | .target = .{ | ||
| 656 | .cpu_arch = .s390x, | ||
| 657 | .os_tag = .linux, | ||
| 658 | .abi = .gnu, | ||
| 659 | }, | ||
| 660 | .link_libc = true, | ||
| 661 | }, | ||
| 662 | |||
| 639 | .{ | 663 | .{ |
| 640 | .target = .{ | 664 | .target = .{ |
| 641 | .cpu_arch = .x86_64, | 665 | .cpu_arch = .x86_64, |