authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-10-17 10:48:35+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2025-10-17 10:48:35+02:00
log54b508776050470b5124ff4d7aee9be0ef113bca
tree162e15774d4f2ebdb46b240343e1fff026a6aedd
parentf785e4745d85f7056ab670989c5739b62b0df265
parent92b555a4ed4e3c4aa90886b97105b407ea87c000
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #25607 from alexrp/hexagon

Some `hexagon-linux` fixes + enable std tests in CI

6 files changed, 33 insertions(+), 31 deletions(-)

lib/std/meta.zig+11-8
...@@ -1,3 +1,4 @@...@@ -1,3 +1,4 @@
1const builtin = @import("builtin");
1const std = @import("std.zig");2const std = @import("std.zig");
2const debug = std.debug;3const debug = std.debug;
3const mem = std.mem;4const mem = std.mem;
...@@ -810,14 +811,6 @@ test eql {...@@ -810,14 +811,6 @@ test eql {
810 try testing.expect(eql(EU.tst(false), EU.tst(false)));811 try testing.expect(eql(EU.tst(false), EU.tst(false)));
811 try testing.expect(!eql(EU.tst(false), EU.tst(true)));812 try testing.expect(!eql(EU.tst(false), EU.tst(true)));
812813
813 const V = @Vector(4, u32);
814 const v1: V = @splat(1);
815 const v2: V = @splat(1);
816 const v3: V = @splat(2);
817
818 try testing.expect(eql(v1, v2));
819 try testing.expect(!eql(v1, v3));
820
821 const CU = union(enum) {814 const CU = union(enum) {
822 a: void,815 a: void,
823 b: void,816 b: void,
...@@ -826,6 +819,16 @@ test eql {...@@ -826,6 +819,16 @@ test eql {
826819
827 try testing.expect(eql(CU{ .a = {} }, .a));820 try testing.expect(eql(CU{ .a = {} }, .a));
828 try testing.expect(!eql(CU{ .a = {} }, .b));821 try testing.expect(!eql(CU{ .a = {} }, .b));
822
823 if (builtin.cpu.arch == .hexagon) return error.SkipZigTest;
824
825 const V = @Vector(4, u32);
826 const v1: V = @splat(1);
827 const v2: V = @splat(1);
828 const v3: V = @splat(2);
829
830 try testing.expect(eql(v1, v2));
831 try testing.expect(!eql(v1, v3));
829}832}
830833
831/// Deprecated: use `std.enums.fromInt` instead and handle null.834/// Deprecated: use `std.enums.fromInt` instead and handle null.
lib/std/os/linux.zig+17-16
...@@ -533,9 +533,10 @@ fn getauxvalImpl(index: usize) callconv(.c) usize {...@@ -533,9 +533,10 @@ fn getauxvalImpl(index: usize) callconv(.c) usize {
533// Some architectures (and some syscalls) require 64bit parameters to be passed533// Some architectures (and some syscalls) require 64bit parameters to be passed
534// in a even-aligned register pair.534// in a even-aligned register pair.
535const require_aligned_register_pair =535const require_aligned_register_pair =
536 builtin.cpu.arch.isPowerPC32() or536 builtin.cpu.arch.isArm() or
537 builtin.cpu.arch == .hexagon or
537 builtin.cpu.arch.isMIPS32() or538 builtin.cpu.arch.isMIPS32() or
538 builtin.cpu.arch.isArm();539 builtin.cpu.arch.isPowerPC32();
539540
540// Split a 64bit value into a {LSB,MSB} pair.541// Split a 64bit value into a {LSB,MSB} pair.
541// The LE/BE variants specify the endianness to assume.542// The LE/BE variants specify the endianness to assume.
...@@ -640,7 +641,7 @@ pub fn futimens(fd: i32, times: ?*const [2]timespec) usize {...@@ -640,7 +641,7 @@ pub fn futimens(fd: i32, times: ?*const [2]timespec) usize {
640641
641pub fn utimensat(dirfd: i32, path: ?[*:0]const u8, times: ?*const [2]timespec, flags: u32) usize {642pub fn utimensat(dirfd: i32, path: ?[*:0]const u8, times: ?*const [2]timespec, flags: u32) usize {
642 return syscall4(643 return syscall4(
643 if (@hasField(SYS, "utimensat")) .utimensat else .utimensat_time64,644 if (@hasField(SYS, "utimensat") and native_arch != .hexagon) .utimensat else .utimensat_time64,
644 @as(usize, @bitCast(@as(isize, dirfd))),645 @as(usize, @bitCast(@as(isize, dirfd))),
645 @intFromPtr(path),646 @intFromPtr(path),
646 @intFromPtr(times),647 @intFromPtr(times),
...@@ -688,7 +689,7 @@ pub const futex_param4 = extern union {...@@ -688,7 +689,7 @@ pub const futex_param4 = extern union {
688/// defines which of the subsequent paramters are relevant.689/// defines which of the subsequent paramters are relevant.
689pub fn futex(uaddr: *const anyopaque, futex_op: FUTEX_OP, val: u32, val2timeout: futex_param4, uaddr2: ?*const anyopaque, val3: u32) usize {690pub fn futex(uaddr: *const anyopaque, futex_op: FUTEX_OP, val: u32, val2timeout: futex_param4, uaddr2: ?*const anyopaque, val3: u32) usize {
690 return syscall6(691 return syscall6(
691 if (@hasField(SYS, "futex")) .futex else .futex_time64,692 if (@hasField(SYS, "futex") and native_arch != .hexagon) .futex else .futex_time64,
692 @intFromPtr(uaddr),693 @intFromPtr(uaddr),
693 @as(u32, @bitCast(futex_op)),694 @as(u32, @bitCast(futex_op)),
694 val,695 val,
...@@ -702,7 +703,7 @@ pub fn futex(uaddr: *const anyopaque, futex_op: FUTEX_OP, val: u32, val2timeout:...@@ -702,7 +703,7 @@ pub fn futex(uaddr: *const anyopaque, futex_op: FUTEX_OP, val: u32, val2timeout:
702/// futex_op that ignores the remaining arguments (e.g., FUTUX_OP.WAKE).703/// futex_op that ignores the remaining arguments (e.g., FUTUX_OP.WAKE).
703pub fn futex_3arg(uaddr: *const anyopaque, futex_op: FUTEX_OP, val: u32) usize {704pub fn futex_3arg(uaddr: *const anyopaque, futex_op: FUTEX_OP, val: u32) usize {
704 return syscall3(705 return syscall3(
705 if (@hasField(SYS, "futex")) .futex else .futex_time64,706 if (@hasField(SYS, "futex") and native_arch != .hexagon) .futex else .futex_time64,
706 @intFromPtr(uaddr),707 @intFromPtr(uaddr),
707 @as(u32, @bitCast(futex_op)),708 @as(u32, @bitCast(futex_op)),
708 val,709 val,
...@@ -713,7 +714,7 @@ pub fn futex_3arg(uaddr: *const anyopaque, futex_op: FUTEX_OP, val: u32) usize {...@@ -713,7 +714,7 @@ pub fn futex_3arg(uaddr: *const anyopaque, futex_op: FUTEX_OP, val: u32) usize {
713/// futex_op that ignores the remaining arguments (e.g., FUTEX_OP.WAIT).714/// futex_op that ignores the remaining arguments (e.g., FUTEX_OP.WAIT).
714pub fn futex_4arg(uaddr: *const anyopaque, futex_op: FUTEX_OP, val: u32, timeout: ?*const timespec) usize {715pub fn futex_4arg(uaddr: *const anyopaque, futex_op: FUTEX_OP, val: u32, timeout: ?*const timespec) usize {
715 return syscall4(716 return syscall4(
716 if (@hasField(SYS, "futex")) .futex else .futex_time64,717 if (@hasField(SYS, "futex") and native_arch != .hexagon) .futex else .futex_time64,
717 @intFromPtr(uaddr),718 @intFromPtr(uaddr),
718 @as(u32, @bitCast(futex_op)),719 @as(u32, @bitCast(futex_op)),
719 val,720 val,
...@@ -1093,7 +1094,7 @@ pub fn poll(fds: [*]pollfd, n: nfds_t, timeout: i32) usize {...@@ -1093,7 +1094,7 @@ pub fn poll(fds: [*]pollfd, n: nfds_t, timeout: i32) usize {
10931094
1094pub fn ppoll(fds: [*]pollfd, n: nfds_t, timeout: ?*timespec, sigmask: ?*const sigset_t) usize {1095pub fn ppoll(fds: [*]pollfd, n: nfds_t, timeout: ?*timespec, sigmask: ?*const sigset_t) usize {
1095 return syscall5(1096 return syscall5(
1096 if (@hasField(SYS, "ppoll")) .ppoll else .ppoll_time64,1097 if (@hasField(SYS, "ppoll") and native_arch != .hexagon) .ppoll else .ppoll_time64,
1097 @intFromPtr(fds),1098 @intFromPtr(fds),
1098 n,1099 n,
1099 @intFromPtr(timeout),1100 @intFromPtr(timeout),
...@@ -1627,7 +1628,7 @@ pub fn clock_gettime(clk_id: clockid_t, tp: *timespec) usize {...@@ -1627,7 +1628,7 @@ pub fn clock_gettime(clk_id: clockid_t, tp: *timespec) usize {
1627 }1628 }
1628 }1629 }
1629 return syscall2(1630 return syscall2(
1630 if (@hasField(SYS, "clock_gettime")) .clock_gettime else .clock_gettime64,1631 if (@hasField(SYS, "clock_gettime") and native_arch != .hexagon) .clock_gettime else .clock_gettime64,
1631 @intFromEnum(clk_id),1632 @intFromEnum(clk_id),
1632 @intFromPtr(tp),1633 @intFromPtr(tp),
1633 );1634 );
...@@ -1645,7 +1646,7 @@ fn init_vdso_clock_gettime(clk: clockid_t, ts: *timespec) callconv(.c) usize {...@@ -1645,7 +1646,7 @@ fn init_vdso_clock_gettime(clk: clockid_t, ts: *timespec) callconv(.c) usize {
16451646
1646pub fn clock_getres(clk_id: i32, tp: *timespec) usize {1647pub fn clock_getres(clk_id: i32, tp: *timespec) usize {
1647 return syscall2(1648 return syscall2(
1648 if (@hasField(SYS, "clock_getres")) .clock_getres else .clock_getres_time64,1649 if (@hasField(SYS, "clock_getres") and native_arch != .hexagon) .clock_getres else .clock_getres_time64,
1649 @as(usize, @bitCast(@as(isize, clk_id))),1650 @as(usize, @bitCast(@as(isize, clk_id))),
1650 @intFromPtr(tp),1651 @intFromPtr(tp),
1651 );1652 );
...@@ -1653,7 +1654,7 @@ pub fn clock_getres(clk_id: i32, tp: *timespec) usize {...@@ -1653,7 +1654,7 @@ pub fn clock_getres(clk_id: i32, tp: *timespec) usize {
16531654
1654pub fn clock_settime(clk_id: i32, tp: *const timespec) usize {1655pub fn clock_settime(clk_id: i32, tp: *const timespec) usize {
1655 return syscall2(1656 return syscall2(
1656 if (@hasField(SYS, "clock_settime")) .clock_settime else .clock_settime64,1657 if (@hasField(SYS, "clock_settime") and native_arch != .hexagon) .clock_settime else .clock_settime64,
1657 @as(usize, @bitCast(@as(isize, clk_id))),1658 @as(usize, @bitCast(@as(isize, clk_id))),
1658 @intFromPtr(tp),1659 @intFromPtr(tp),
1659 );1660 );
...@@ -1661,7 +1662,7 @@ pub fn clock_settime(clk_id: i32, tp: *const timespec) usize {...@@ -1661,7 +1662,7 @@ pub fn clock_settime(clk_id: i32, tp: *const timespec) usize {
16611662
1662pub fn clock_nanosleep(clockid: clockid_t, flags: TIMER, request: *const timespec, remain: ?*timespec) usize {1663pub fn clock_nanosleep(clockid: clockid_t, flags: TIMER, request: *const timespec, remain: ?*timespec) usize {
1663 return syscall4(1664 return syscall4(
1664 if (@hasField(SYS, "clock_nanosleep")) .clock_nanosleep else .clock_nanosleep_time64,1665 if (@hasField(SYS, "clock_nanosleep") and native_arch != .hexagon) .clock_nanosleep else .clock_nanosleep_time64,
1665 @intFromEnum(clockid),1666 @intFromEnum(clockid),
1666 @as(u32, @bitCast(flags)),1667 @as(u32, @bitCast(flags)),
1667 @intFromPtr(request),1668 @intFromPtr(request),
...@@ -2071,7 +2072,7 @@ pub fn recvmsg(fd: i32, msg: *msghdr, flags: u32) usize {...@@ -2071,7 +2072,7 @@ pub fn recvmsg(fd: i32, msg: *msghdr, flags: u32) usize {
20712072
2072pub fn recvmmsg(fd: i32, msgvec: ?[*]mmsghdr, vlen: u32, flags: u32, timeout: ?*timespec) usize {2073pub fn recvmmsg(fd: i32, msgvec: ?[*]mmsghdr, vlen: u32, flags: u32, timeout: ?*timespec) usize {
2073 return syscall5(2074 return syscall5(
2074 if (@hasField(SYS, "recvmmsg")) .recvmmsg else .recvmmsg_time64,2075 if (@hasField(SYS, "recvmmsg") and native_arch != .hexagon) .recvmmsg else .recvmmsg_time64,
2075 @as(usize, @bitCast(@as(isize, fd))),2076 @as(usize, @bitCast(@as(isize, fd))),
2076 @intFromPtr(msgvec),2077 @intFromPtr(msgvec),
2077 vlen,2078 vlen,
...@@ -2421,7 +2422,7 @@ pub const itimerspec = extern struct {...@@ -2421,7 +2422,7 @@ pub const itimerspec = extern struct {
24212422
2422pub fn timerfd_gettime(fd: i32, curr_value: *itimerspec) usize {2423pub fn timerfd_gettime(fd: i32, curr_value: *itimerspec) usize {
2423 return syscall2(2424 return syscall2(
2424 if (@hasField(SYS, "timerfd_gettime")) .timerfd_gettime else .timerfd_gettime64,2425 if (@hasField(SYS, "timerfd_gettime") and native_arch != .hexagon) .timerfd_gettime else .timerfd_gettime64,
2425 @bitCast(@as(isize, fd)),2426 @bitCast(@as(isize, fd)),
2426 @intFromPtr(curr_value),2427 @intFromPtr(curr_value),
2427 );2428 );
...@@ -2429,7 +2430,7 @@ pub fn timerfd_gettime(fd: i32, curr_value: *itimerspec) usize {...@@ -2429,7 +2430,7 @@ pub fn timerfd_gettime(fd: i32, curr_value: *itimerspec) usize {
24292430
2430pub fn timerfd_settime(fd: i32, flags: TFD.TIMER, new_value: *const itimerspec, old_value: ?*itimerspec) usize {2431pub fn timerfd_settime(fd: i32, flags: TFD.TIMER, new_value: *const itimerspec, old_value: ?*itimerspec) usize {
2431 return syscall4(2432 return syscall4(
2432 if (@hasField(SYS, "timerfd_settime")) .timerfd_settime else .timerfd_settime64,2433 if (@hasField(SYS, "timerfd_settime") and native_arch != .hexagon) .timerfd_settime else .timerfd_settime64,
2433 @bitCast(@as(isize, fd)),2434 @bitCast(@as(isize, fd)),
2434 @as(u32, @bitCast(flags)),2435 @as(u32, @bitCast(flags)),
2435 @intFromPtr(new_value),2436 @intFromPtr(new_value),
...@@ -2632,7 +2633,7 @@ pub fn process_vm_writev(pid: pid_t, local: []const iovec_const, remote: []const...@@ -2632,7 +2633,7 @@ pub fn process_vm_writev(pid: pid_t, local: []const iovec_const, remote: []const
2632}2633}
26332634
2634pub fn fadvise(fd: fd_t, offset: i64, len: i64, advice: usize) usize {2635pub fn fadvise(fd: fd_t, offset: i64, len: i64, advice: usize) usize {
2635 if (comptime native_arch.isArm() or native_arch.isPowerPC32()) {2636 if (comptime native_arch.isArm() or native_arch == .hexagon or native_arch.isPowerPC32()) {
2636 // These architectures reorder the arguments so that a register is not skipped to align the2637 // These architectures reorder the arguments so that a register is not skipped to align the
2637 // register number that `offset` is passed in.2638 // register number that `offset` is passed in.
26382639
...@@ -8367,7 +8368,7 @@ pub const kernel_timespec = extern struct {...@@ -8367,7 +8368,7 @@ pub const kernel_timespec = extern struct {
8367};8368};
83688369
8369// https://github.com/ziglang/zig/issues/4726#issuecomment-21903378778370// https://github.com/ziglang/zig/issues/4726#issuecomment-2190337877
8370pub const timespec = if (native_arch == .riscv32) kernel_timespec else extern struct {8371pub const timespec = if (native_arch == .hexagon or native_arch == .riscv32) kernel_timespec else extern struct {
8371 sec: isize,8372 sec: isize,
8372 nsec: isize,8373 nsec: isize,
8373};8374};
lib/std/os/linux/hexagon.zig+1-1
...@@ -170,7 +170,7 @@ pub const Flock = extern struct {...@@ -170,7 +170,7 @@ pub const Flock = extern struct {
170170
171pub const blksize_t = i32;171pub const blksize_t = i32;
172pub const nlink_t = u32;172pub const nlink_t = u32;
173pub const time_t = i32;173pub const time_t = i64;
174pub const mode_t = u32;174pub const mode_t = u32;
175pub const off_t = i64;175pub const off_t = i64;
176pub const ino_t = u64;176pub const ino_t = u64;
lib/std/posix/test.zig+2
...@@ -495,6 +495,8 @@ test "mmap" {...@@ -495,6 +495,8 @@ test "mmap" {
495 }495 }
496 }496 }
497497
498 if (builtin.cpu.arch == .hexagon) return error.SkipZigTest;
499
498 // Map the upper half of the file500 // Map the upper half of the file
499 {501 {
500 const file = try tmp.dir.openFile(test_out_file, .{});502 const file = try tmp.dir.openFile(test_out_file, .{});
lib/std/simd.zig+2
...@@ -228,6 +228,8 @@ pub fn extract(...@@ -228,6 +228,8 @@ pub fn extract(
228}228}
229229
230test "vector patterns" {230test "vector patterns" {
231 if (builtin.cpu.arch == .hexagon) return error.SkipZigTest;
232
231 const base = @Vector(4, u32){ 10, 20, 30, 40 };233 const base = @Vector(4, u32){ 10, 20, 30, 40 };
232 const other_base = @Vector(4, u32){ 55, 66, 77, 88 };234 const other_base = @Vector(4, u32){ 55, 66, 77, 88 };
233235
test/tests.zig-6
...@@ -388,8 +388,6 @@ const test_targets = blk: {...@@ -388,8 +388,6 @@ const test_targets = blk: {
388 .arch_os_abi = "hexagon-linux-none",388 .arch_os_abi = "hexagon-linux-none",
389 .cpu_features = "baseline+long_calls",389 .cpu_features = "baseline+long_calls",
390 }) catch unreachable,390 }) catch unreachable,
391 // https://github.com/llvm/llvm-project/pull/111217
392 .skip_modules = &.{"std"},
393 },391 },
394 .{392 .{
395 .target = std.Target.Query.parse(.{393 .target = std.Target.Query.parse(.{
...@@ -397,8 +395,6 @@ const test_targets = blk: {...@@ -397,8 +395,6 @@ const test_targets = blk: {
397 .cpu_features = "baseline+long_calls",395 .cpu_features = "baseline+long_calls",
398 }) catch unreachable,396 }) catch unreachable,
399 .link_libc = true,397 .link_libc = true,
400 // https://github.com/llvm/llvm-project/pull/111217
401 .skip_modules = &.{"std"},
402 },398 },
403 // Currently crashes in qemu-hexagon.399 // Currently crashes in qemu-hexagon.
404 // .{400 // .{
...@@ -408,8 +404,6 @@ const test_targets = blk: {...@@ -408,8 +404,6 @@ const test_targets = blk: {
408 // }) catch unreachable,404 // }) catch unreachable,
409 // .linkage = .dynamic,405 // .linkage = .dynamic,
410 // .link_libc = true,406 // .link_libc = true,
411 // // https://github.com/llvm/llvm-project/pull/111217
412 // .skip_modules = &.{"std"},
413 // .extra_target = true,407 // .extra_target = true,
414 // },408 // },
415409