diff --git a/lib/std/c.zig b/lib/std/c.zig index 9d9c7c5708ef..cc7bd17cb06d 100644 --- a/lib/std/c.zig +++ b/lib/std/c.zig @@ -2528,6 +2528,8 @@ pub const _SC = if (builtin.abi.isAndroid()) enum(c_int) { .solaris, .illumos => enum(c_int) { PAGESIZE = 11, NPROCESSORS_ONLN = 15, + SIGRT_MIN = 40, + SIGRT_MAX = 41, }, // https://github.com/SerenityOS/serenity/blob/1dfc9e2df39dd23f1de92530677c845aae4345f2/Kernel/API/POSIX/unistd.h#L36-L52 .serenity => enum(c_int) { @@ -5776,6 +5778,20 @@ pub const MSG = switch (native_os) { pub const FBLOCKING = 0x10000; pub const FNONBLOCKING = 0x20000; }, + .solaris, .illumos => struct { + pub const OOB = 0x0001; + pub const PEEK = 0x0002; + pub const DONTROUTE = 0x0004; + pub const EOR = 0x0008; + pub const CTRUNC = 0x0010; + pub const TRUNC = 0x0020; + pub const WAITALL = 0x0040; + pub const DONTWAIT = 0x0080; + pub const NOTIFICATION = 0x0100; + pub const NOSIGNAL = 0x0200; + pub const CMSG_CLOEXEC = 0x1000; + pub const CMSG_CLOFORK = 0x2000; + }, else => void, }; pub const SOCK = switch (native_os) { @@ -10298,7 +10314,7 @@ pub extern "c" fn setrlimit64(resource: rlimit_resource, rlim: *const rlimit) c_ pub const arc4random_buf = switch (native_os) { .linux => if (builtin.abi.isAndroid()) private.arc4random_buf else {}, - .dragonfly, .netbsd, .freebsd, .solaris, .openbsd, .serenity, .macos, .ios, .tvos, .watchos, .visionos => private.arc4random_buf, + .dragonfly, .netbsd, .freebsd, .solaris, .illumos, .openbsd, .serenity, .macos, .ios, .tvos, .watchos, .visionos => private.arc4random_buf, else => {}, }; pub const getentropy = switch (native_os) { @@ -10475,6 +10491,7 @@ pub fn sigrtmin() u8 { return switch (native_os) { .freebsd => 65, .netbsd => 33, + .solaris, .illumos => @truncate(sysconf(@intFromEnum(_SC.SIGRT_MIN))), else => @truncate(@as(c_uint, @bitCast(private.__libc_current_sigrtmin()))), }; } @@ -10484,6 +10501,7 @@ pub fn sigrtmax() u8 { return switch (native_os) { .freebsd => 126, .netbsd => 63, + .solaris, .illumos => @truncate(sysconf(@intFromEnum(_SC.SIGRT_MAX))), else => @truncate(@as(c_uint, @bitCast(private.__libc_current_sigrtmax()))), }; } diff --git a/lib/std/debug/cpu_context.zig b/lib/std/debug/cpu_context.zig index 1ff61ee2a25e..bf1edd83c84a 100644 --- a/lib/std/debug/cpu_context.zig +++ b/lib/std/debug/cpu_context.zig @@ -1963,6 +1963,9 @@ const signal_ucontext_t = switch (native_os) { _trapno: i64, _err: i64, rip: u64, + _cs: i64, + _rflags: i64, + rsp: u64, }, }, else => unreachable, @@ -2012,6 +2015,9 @@ const signal_ucontext_t = switch (native_os) { _trapno: i64, _err: i64, rip: u64, + _cs: i64, + _rflags: i64, + rsp: u64, }, else => unreachable, }, diff --git a/src/target.zig b/src/target.zig index f878f8e6bc31..79e647e641b4 100644 --- a/src/target.zig +++ b/src/target.zig @@ -257,6 +257,10 @@ pub fn hasNewLinkerSupport(ofmt: std.Target.ObjectFormat, backend: std.builtin.C pub fn selfHostedBackendIsAsRobustAsLlvm(target: *const std.Target) bool { if (target.cpu.arch.isSpirV()) return true; if (target.cpu.arch == .x86_64 and target.ptrBitWidth() == 64) { + if (target.os.tag.isSolarish()) { + // https://github.com/ziglang/zig/issues/25699 + return false; + } if (target.os.tag.isBSD()) { // Self-hosted linker needs work: https://github.com/ziglang/zig/issues/24341 return false; diff --git a/test/src/ErrorTrace.zig b/test/src/ErrorTrace.zig index 4644661205be..3c781e3a3a88 100644 --- a/test/src/ErrorTrace.zig +++ b/test/src/ErrorTrace.zig @@ -41,7 +41,7 @@ pub fn addCase(self: *ErrorTrace, case: Case) void { fn shouldTestNonLlvm(target: *const std.Target) bool { return switch (target.cpu.arch) { .x86_64 => switch (target.ofmt) { - .elf => !target.os.tag.isBSD(), + .elf => !target.os.tag.isBSD() and !target.os.tag.isSolarish(), else => false, }, else => false, diff --git a/test/src/StackTrace.zig b/test/src/StackTrace.zig index f6198935fdce..721db139c2d4 100644 --- a/test/src/StackTrace.zig +++ b/test/src/StackTrace.zig @@ -46,7 +46,7 @@ fn addCaseTarget( ) void { const both_backends = switch (target.result.cpu.arch) { .x86_64 => switch (target.result.ofmt) { - .elf => !target.result.os.tag.isBSD(), + .elf => !target.result.os.tag.isBSD() and !target.result.os.tag.isSolarish(), else => false, }, else => false, diff --git a/test/tests.zig b/test/tests.zig index c7fe8a7e7885..d83c95956a45 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -2493,7 +2493,7 @@ pub fn wouldUseLlvm(use_llvm: ?bool, query: std.Target.Query, optimize_mode: Opt const cpu_arch = query.cpu_arch orelse builtin.cpu.arch; const os_tag = query.os_tag orelse builtin.os.tag; switch (cpu_arch) { - .x86_64 => if (os_tag.isBSD() or std.Target.ptrBitWidth_arch_abi(cpu_arch, query.abi orelse .none) != 64) return true, + .x86_64 => if (os_tag.isBSD() or os_tag.isSolarish() or std.Target.ptrBitWidth_arch_abi(cpu_arch, query.abi orelse .none) != 64) return true, .spirv32, .spirv64 => return false, else => return true, }