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) {...@@ -2528,6 +2528,8 @@ pub const _SC = if (builtin.abi.isAndroid()) enum(c_int) {
2528 .solaris, .illumos => enum(c_int) {2528 .solaris, .illumos => enum(c_int) {
2529 PAGESIZE = 11,2529 PAGESIZE = 11,
2530 NPROCESSORS_ONLN = 15,2530 NPROCESSORS_ONLN = 15,
2531 SIGRT_MIN = 40,
2532 SIGRT_MAX = 41,
2531 },2533 },
2532 // https://github.com/SerenityOS/serenity/blob/1dfc9e2df39dd23f1de92530677c845aae4345f2/Kernel/API/POSIX/unistd.h#L36-L522534 // https://github.com/SerenityOS/serenity/blob/1dfc9e2df39dd23f1de92530677c845aae4345f2/Kernel/API/POSIX/unistd.h#L36-L52
2533 .serenity => enum(c_int) {2535 .serenity => enum(c_int) {
...@@ -5776,6 +5778,20 @@ pub const MSG = switch (native_os) {...@@ -5776,6 +5778,20 @@ pub const MSG = switch (native_os) {
5776 pub const FBLOCKING = 0x10000;5778 pub const FBLOCKING = 0x10000;
5777 pub const FNONBLOCKING = 0x20000;5779 pub const FNONBLOCKING = 0x20000;
5778 },5780 },
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 },
5779 else => void,5795 else => void,
5780};5796};
5781pub const SOCK = switch (native_os) {5797pub const SOCK = switch (native_os) {
...@@ -10298,7 +10314,7 @@ pub extern "c" fn setrlimit64(resource: rlimit_resource, rlim: *const rlimit) c_...@@ -10298,7 +10314,7 @@ pub extern "c" fn setrlimit64(resource: rlimit_resource, rlim: *const rlimit) c_
1029810314
10299pub const arc4random_buf = switch (native_os) {10315pub const arc4random_buf = switch (native_os) {
10300 .linux => if (builtin.abi.isAndroid()) private.arc4random_buf else {},10316 .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,
10302 else => {},10318 else => {},
10303};10319};
10304pub const getentropy = switch (native_os) {10320pub const getentropy = switch (native_os) {
...@@ -10475,6 +10491,7 @@ pub fn sigrtmin() u8 {...@@ -10475,6 +10491,7 @@ pub fn sigrtmin() u8 {
10475 return switch (native_os) {10491 return switch (native_os) {
10476 .freebsd => 65,10492 .freebsd => 65,
10477 .netbsd => 33,10493 .netbsd => 33,
10494 .solaris, .illumos => @truncate(sysconf(@intFromEnum(_SC.SIGRT_MIN))),
10478 else => @truncate(@as(c_uint, @bitCast(private.__libc_current_sigrtmin()))),10495 else => @truncate(@as(c_uint, @bitCast(private.__libc_current_sigrtmin()))),
10479 };10496 };
10480}10497}
...@@ -10484,6 +10501,7 @@ pub fn sigrtmax() u8 {...@@ -10484,6 +10501,7 @@ pub fn sigrtmax() u8 {
10484 return switch (native_os) {10501 return switch (native_os) {
10485 .freebsd => 126,10502 .freebsd => 126,
10486 .netbsd => 63,10503 .netbsd => 63,
10504 .solaris, .illumos => @truncate(sysconf(@intFromEnum(_SC.SIGRT_MAX))),
10487 else => @truncate(@as(c_uint, @bitCast(private.__libc_current_sigrtmax()))),10505 else => @truncate(@as(c_uint, @bitCast(private.__libc_current_sigrtmax()))),
10488 };10506 };
10489}10507}
lib/std/debug/cpu_context.zig+6
...@@ -1963,6 +1963,9 @@ const signal_ucontext_t = switch (native_os) {...@@ -1963,6 +1963,9 @@ const signal_ucontext_t = switch (native_os) {
1963 _trapno: i64,1963 _trapno: i64,
1964 _err: i64,1964 _err: i64,
1965 rip: u64,1965 rip: u64,
1966 _cs: i64,
1967 _rflags: i64,
1968 rsp: u64,
1966 },1969 },
1967 },1970 },
1968 else => unreachable,1971 else => unreachable,
...@@ -2012,6 +2015,9 @@ const signal_ucontext_t = switch (native_os) {...@@ -2012,6 +2015,9 @@ const signal_ucontext_t = switch (native_os) {
2012 _trapno: i64,2015 _trapno: i64,
2013 _err: i64,2016 _err: i64,
2014 rip: u64,2017 rip: u64,
2018 _cs: i64,
2019 _rflags: i64,
2020 rsp: u64,
2015 },2021 },
2016 else => unreachable,2022 else => unreachable,
2017 },2023 },
src/target.zig+4
...@@ -257,6 +257,10 @@ pub fn hasNewLinkerSupport(ofmt: std.Target.ObjectFormat, backend: std.builtin.C...@@ -257,6 +257,10 @@ pub fn hasNewLinkerSupport(ofmt: std.Target.ObjectFormat, backend: std.builtin.C
257pub fn selfHostedBackendIsAsRobustAsLlvm(target: *const std.Target) bool {257pub fn selfHostedBackendIsAsRobustAsLlvm(target: *const std.Target) bool {
258 if (target.cpu.arch.isSpirV()) return true;258 if (target.cpu.arch.isSpirV()) return true;
259 if (target.cpu.arch == .x86_64 and target.ptrBitWidth() == 64) {259 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 }
260 if (target.os.tag.isBSD()) {264 if (target.os.tag.isBSD()) {
261 // Self-hosted linker needs work: https://github.com/ziglang/zig/issues/24341265 // Self-hosted linker needs work: https://github.com/ziglang/zig/issues/24341
262 return false;266 return false;
test/src/ErrorTrace.zig+1-1
...@@ -41,7 +41,7 @@ pub fn addCase(self: *ErrorTrace, case: Case) void {...@@ -41,7 +41,7 @@ pub fn addCase(self: *ErrorTrace, case: Case) void {
41fn shouldTestNonLlvm(target: *const std.Target) bool {41fn shouldTestNonLlvm(target: *const std.Target) bool {
42 return switch (target.cpu.arch) {42 return switch (target.cpu.arch) {
43 .x86_64 => switch (target.ofmt) {43 .x86_64 => switch (target.ofmt) {
44 .elf => !target.os.tag.isBSD(),44 .elf => !target.os.tag.isBSD() and !target.os.tag.isSolarish(),
45 else => false,45 else => false,
46 },46 },
47 else => false,47 else => false,
test/src/StackTrace.zig+1-1
...@@ -46,7 +46,7 @@ fn addCaseTarget(...@@ -46,7 +46,7 @@ fn addCaseTarget(
46) void {46) void {
47 const both_backends = switch (target.result.cpu.arch) {47 const both_backends = switch (target.result.cpu.arch) {
48 .x86_64 => switch (target.result.ofmt) {48 .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(),
50 else => false,50 else => false,
51 },51 },
52 else => false,52 else => false,
test/tests.zig+1-1
...@@ -2493,7 +2493,7 @@ pub fn wouldUseLlvm(use_llvm: ?bool, query: std.Target.Query, optimize_mode: Opt...@@ -2493,7 +2493,7 @@ pub fn wouldUseLlvm(use_llvm: ?bool, query: std.Target.Query, optimize_mode: Opt
2493 const cpu_arch = query.cpu_arch orelse builtin.cpu.arch;2493 const cpu_arch = query.cpu_arch orelse builtin.cpu.arch;
2494 const os_tag = query.os_tag orelse builtin.os.tag;2494 const os_tag = query.os_tag orelse builtin.os.tag;
2495 switch (cpu_arch) {2495 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,
2497 .spirv32, .spirv64 => return false,2497 .spirv32, .spirv64 => return false,
2498 else => return true,2498 else => return true,
2499 }2499 }