authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-10-26 00:59:33+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2025-10-26 00:59:33+02:00
log433846100b9ab17aa390e3912dd41c6c7265bccb
treef121863b59c55113ae179ea7a2089d612984f798
parentbebfdc3661359bbf681de2676085432698363f16
parentece9640a3ed44b0e174f3620fc40511ef86e1903
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #25700 from alexrp/solaris-illumos-stuff

Some Solaris/illumos fixes

6 files changed, 32 insertions(+), 4 deletions(-)

lib/std/c.zig+19-1
......@@ -2528,6 +2528,8 @@ pub const _SC = if (builtin.abi.isAndroid()) enum(c_int) {
25282528 .solaris, .illumos => enum(c_int) {
25292529 PAGESIZE = 11,
25302530 NPROCESSORS_ONLN = 15,
2531 SIGRT_MIN = 40,
2532 SIGRT_MAX = 41,
25312533 },
25322534 // https://github.com/SerenityOS/serenity/blob/1dfc9e2df39dd23f1de92530677c845aae4345f2/Kernel/API/POSIX/unistd.h#L36-L52
25332535 .serenity => enum(c_int) {
......@@ -5776,6 +5778,20 @@ pub const MSG = switch (native_os) {
57765778 pub const FBLOCKING = 0x10000;
57775779 pub const FNONBLOCKING = 0x20000;
57785780 },
5781 .solaris, .illumos => struct {
5782 pub const OOB = 0x0001;
5783 pub const PEEK = 0x0002;
5784 pub const DONTROUTE = 0x0004;
5785 pub const EOR = 0x0008;
5786 pub const CTRUNC = 0x0010;
5787 pub const TRUNC = 0x0020;
5788 pub const WAITALL = 0x0040;
5789 pub const DONTWAIT = 0x0080;
5790 pub const NOTIFICATION = 0x0100;
5791 pub const NOSIGNAL = 0x0200;
5792 pub const CMSG_CLOEXEC = 0x1000;
5793 pub const CMSG_CLOFORK = 0x2000;
5794 },
57795795 else => void,
57805796};
57815797pub const SOCK = switch (native_os) {
......@@ -10298,7 +10314,7 @@ pub extern "c" fn setrlimit64(resource: rlimit_resource, rlim: *const rlimit) c_
1029810314
1029910315pub const arc4random_buf = switch (native_os) {
1030010316 .linux => if (builtin.abi.isAndroid()) private.arc4random_buf else {},
10301 .dragonfly, .netbsd, .freebsd, .solaris, .openbsd, .serenity, .macos, .ios, .tvos, .watchos, .visionos => private.arc4random_buf,
10317 .dragonfly, .netbsd, .freebsd, .solaris, .illumos, .openbsd, .serenity, .macos, .ios, .tvos, .watchos, .visionos => private.arc4random_buf,
1030210318 else => {},
1030310319};
1030410320pub const getentropy = switch (native_os) {
......@@ -10475,6 +10491,7 @@ pub fn sigrtmin() u8 {
1047510491 return switch (native_os) {
1047610492 .freebsd => 65,
1047710493 .netbsd => 33,
10494 .solaris, .illumos => @truncate(sysconf(@intFromEnum(_SC.SIGRT_MIN))),
1047810495 else => @truncate(@as(c_uint, @bitCast(private.__libc_current_sigrtmin()))),
1047910496 };
1048010497}
......@@ -10484,6 +10501,7 @@ pub fn sigrtmax() u8 {
1048410501 return switch (native_os) {
1048510502 .freebsd => 126,
1048610503 .netbsd => 63,
10504 .solaris, .illumos => @truncate(sysconf(@intFromEnum(_SC.SIGRT_MAX))),
1048710505 else => @truncate(@as(c_uint, @bitCast(private.__libc_current_sigrtmax()))),
1048810506 };
1048910507}
lib/std/debug/cpu_context.zig+6
......@@ -1963,6 +1963,9 @@ const signal_ucontext_t = switch (native_os) {
19631963 _trapno: i64,
19641964 _err: i64,
19651965 rip: u64,
1966 _cs: i64,
1967 _rflags: i64,
1968 rsp: u64,
19661969 },
19671970 },
19681971 else => unreachable,
......@@ -2012,6 +2015,9 @@ const signal_ucontext_t = switch (native_os) {
20122015 _trapno: i64,
20132016 _err: i64,
20142017 rip: u64,
2018 _cs: i64,
2019 _rflags: i64,
2020 rsp: u64,
20152021 },
20162022 else => unreachable,
20172023 },
src/target.zig+4
......@@ -257,6 +257,10 @@ pub fn hasNewLinkerSupport(ofmt: std.Target.ObjectFormat, backend: std.builtin.C
257257pub fn selfHostedBackendIsAsRobustAsLlvm(target: *const std.Target) bool {
258258 if (target.cpu.arch.isSpirV()) return true;
259259 if (target.cpu.arch == .x86_64 and target.ptrBitWidth() == 64) {
260 if (target.os.tag.isSolarish()) {
261 // https://github.com/ziglang/zig/issues/25699
262 return false;
263 }
260264 if (target.os.tag.isBSD()) {
261265 // Self-hosted linker needs work: https://github.com/ziglang/zig/issues/24341
262266 return false;
test/src/ErrorTrace.zig+1-1
......@@ -41,7 +41,7 @@ pub fn addCase(self: *ErrorTrace, case: Case) void {
4141fn shouldTestNonLlvm(target: *const std.Target) bool {
4242 return switch (target.cpu.arch) {
4343 .x86_64 => switch (target.ofmt) {
44 .elf => !target.os.tag.isBSD(),
44 .elf => !target.os.tag.isBSD() and !target.os.tag.isSolarish(),
4545 else => false,
4646 },
4747 else => false,
test/src/StackTrace.zig+1-1
......@@ -46,7 +46,7 @@ fn addCaseTarget(
4646) void {
4747 const both_backends = switch (target.result.cpu.arch) {
4848 .x86_64 => switch (target.result.ofmt) {
49 .elf => !target.result.os.tag.isBSD(),
49 .elf => !target.result.os.tag.isBSD() and !target.result.os.tag.isSolarish(),
5050 else => false,
5151 },
5252 else => false,
test/tests.zig+1-1
......@@ -2493,7 +2493,7 @@ pub fn wouldUseLlvm(use_llvm: ?bool, query: std.Target.Query, optimize_mode: Opt
24932493 const cpu_arch = query.cpu_arch orelse builtin.cpu.arch;
24942494 const os_tag = query.os_tag orelse builtin.os.tag;
24952495 switch (cpu_arch) {
2496 .x86_64 => if (os_tag.isBSD() or std.Target.ptrBitWidth_arch_abi(cpu_arch, query.abi orelse .none) != 64) return true,
2496 .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,
24972497 .spirv32, .spirv64 => return false,
24982498 else => return true,
24992499 }