Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion lib/std/c.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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()))),
};
}
Expand All @@ -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()))),
};
}
Expand Down
6 changes: 6 additions & 0 deletions lib/std/debug/cpu_context.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
},
Expand Down
4 changes: 4 additions & 0 deletions src/target.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion test/src/ErrorTrace.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion test/src/StackTrace.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion test/tests.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
Loading