authorgravatar for dev@sgregoratto.meStephen Gregoratto <dev@sgregoratto.me> 2023-10-01 23:09:14+11:00
committergravatar for ryan@zinascii.comRyan Zezeski <ryan@zinascii.com> 2023-10-02 15:31:49-06:00
log285970982a662ae1882858ab8076b8c20609b9bb
tree5141c17d8bbb44b401bbda3cbbfdf7dc73106a8a
parent51fa7ef1c43c2b159cfba15ee06cd6f3fab3e556

Add illumos OS tag

- Adds `illumos` to the `Target.Os.Tag` enum. A new function, `isSolarish` has been added that returns true if the tag is either Solaris or Illumos. This matches the naming convention found in Rust's `libc` crate[1]. - Add the tag wherever `.solaris` is being checked against. - Check for the C pre-processor macro `__illumos__` in CMake to set the proper target tuple. Illumos distros patch their compilers to have this in the "built-in" set (verified with `echo | cc -dM -E -`). Alternatively you could check the output of `uname -o`. Right now, both Solaris and Illumos import from `c/solaris.zig`. In the future it may be worth putting the shared ABI bits in a base file, and mixing that in with specific `c/solaris.zig`/`c/illumos.zig` files. [1]: https://github.com/rust-lang/libc/tree/6e02a329a2a27f6887ea86952f389ca11e06448c/src/unix/solarish

25 files changed, 86 insertions(+), 54 deletions(-)

CMakeLists.txt+8-3
......@@ -1,4 +1,5 @@
11cmake_minimum_required(VERSION 3.5)
2include(CheckSymbolExists)
23
34if(NOT CMAKE_BUILD_TYPE)
45 set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
......@@ -709,12 +710,17 @@ string(TOLOWER "${CMAKE_HOST_SYSTEM_NAME}" ZIG_HOST_TARGET_OS)
709710if(ZIG_HOST_TARGET_OS STREQUAL "darwin")
710711 set(ZIG_HOST_TARGET_OS "macos")
711712elseif(ZIG_HOST_TARGET_OS STREQUAL "sunos")
712 set(ZIG_HOST_TARGET_OS "solaris")
713 check_symbol_exists(__illumos__ "" ZIG_HOST_TARGET_HAS_ILLUMOS_MACRO)
714 if (ZIG_HOST_TARGET_HAS_ILLUMOS_MACRO)
715 set(ZIG_HOST_TARGET_OS "illumos")
716 else()
717 set(ZIG_HOST_TARGET_OS "solaris")
718 endif()
713719endif()
714720
715721string(TOLOWER "${CMAKE_HOST_SYSTEM_PROCESSOR}" ZIG_HOST_TARGET_ARCH)
716722if(ZIG_HOST_TARGET_ARCH MATCHES "^i[3-9]86$")
717 if (ZIG_HOST_TARGET_OS STREQUAL "solaris")
723 if (ZIG_HOST_TARGET_OS MATCHES "(solaris|illumos)")
718724 set(ZIG_HOST_TARGET_ARCH "x86_64")
719725 else()
720726 set(ZIG_HOST_TARGET_ARCH "x86")
......@@ -730,7 +736,6 @@ elseif(ZIG_HOST_TARGET_ARCH STREQUAL "armv7b")
730736endif()
731737string(REGEX REPLACE "^((arm|thumb)(hf?)?)el$" "\\1" ZIG_HOST_TARGET_ARCH "${ZIG_HOST_TARGET_ARCH}")
732738if(ZIG_HOST_TARGET_ARCH MATCHES "^arm(hf?)?(eb)?$")
733 include(CheckSymbolExists)
734739 check_symbol_exists(__thumb__ "" ZIG_HOST_TARGET_DEFAULTS_TO_THUMB)
735740 if(ZIG_HOST_TARGET_DEFAULTS_TO_THUMB)
736741 string(REGEX REPLACE "^arm" "thumb" ZIG_HOST_TARGET_ARCH "${ZIG_HOST_TARGET_ARCH}")
build.zig+3-3
......@@ -670,9 +670,9 @@ fn addCmakeCfgOptionsToExe(
670670 try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes);
671671 }
672672 },
673 .solaris => {
674 try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes);
675 try addCxxKnownPath(b, cfg, exe, b.fmt("libgcc_eh.{s}", .{lib_suffix}), null, need_cpp_includes);
673 .solaris, .illumos => {
674 try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes);
675 try addCxxKnownPath(b, cfg, exe, b.fmt("libgcc_eh.{s}", .{lib_suffix}), null, need_cpp_includes);
676676 },
677677 else => {},
678678 }
lib/std/Thread.zig+4-4
......@@ -43,7 +43,7 @@ pub const max_name_len = switch (target.os.tag) {
4343 .freebsd => 15,
4444 .openbsd => 23,
4545 .dragonfly => 1023,
46 .solaris => 31,
46 .solaris, .illumos => 31,
4747 else => 0,
4848};
4949
......@@ -123,7 +123,7 @@ pub fn setName(self: Thread, name: []const u8) SetNameError!void {
123123 else => |e| return os.unexpectedErrno(e),
124124 }
125125 },
126 .netbsd, .solaris => if (use_pthreads) {
126 .netbsd, .solaris, .illumos => if (use_pthreads) {
127127 const err = std.c.pthread_setname_np(self.getHandle(), name_with_terminator.ptr, null);
128128 switch (err) {
129129 .SUCCESS => return,
......@@ -229,7 +229,7 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co
229229 else => |e| return os.unexpectedErrno(e),
230230 }
231231 },
232 .netbsd, .solaris => if (use_pthreads) {
232 .netbsd, .solaris, .illumos => if (use_pthreads) {
233233 const err = std.c.pthread_getname_np(self.getHandle(), buffer.ptr, max_name_len + 1);
234234 switch (err) {
235235 .SUCCESS => return std.mem.sliceTo(buffer, 0),
......@@ -636,7 +636,7 @@ const PosixThreadImpl = struct {
636636 };
637637 return @as(usize, @intCast(count));
638638 },
639 .solaris => {
639 .solaris, .illumos => {
640640 // The "proper" way to get the cpu count would be to query
641641 // /dev/kstat via ioctls, and traverse a linked list for each
642642 // cpu.
lib/std/c.zig+1-1
......@@ -49,7 +49,7 @@ pub usingnamespace switch (builtin.os.tag) {
4949 .openbsd => @import("c/openbsd.zig"),
5050 .haiku => @import("c/haiku.zig"),
5151 .hermit => @import("c/hermit.zig"),
52 .solaris => @import("c/solaris.zig"),
52 .solaris, .illumos => @import("c/solaris.zig"),
5353 .fuchsia => @import("c/fuchsia.zig"),
5454 .minix => @import("c/minix.zig"),
5555 .emscripten => @import("c/emscripten.zig"),
lib/std/crypto/Certificate/Bundle.zig+1-1
......@@ -64,7 +64,7 @@ pub fn rescan(cb: *Bundle, gpa: Allocator) RescanError!void {
6464 .netbsd => return rescanBSD(cb, gpa, "/etc/openssl/certs/ca-certificates.crt"),
6565 .dragonfly => return rescanBSD(cb, gpa, "/usr/local/etc/ssl/cert.pem"),
6666 .windows => return rescanWindows(cb, gpa),
67 .solaris => return rescanSolaris(cb, gpa, "/etc/ssl/cacert.pem"),
67 .solaris, .illumos => return rescanSolaris(cb, gpa, "/etc/ssl/cacert.pem"),
6868 else => {},
6969 }
7070}
lib/std/crypto/tlcsprng.zig+1
......@@ -25,6 +25,7 @@ const os_has_fork = switch (builtin.os.tag) {
2525 .netbsd,
2626 .openbsd,
2727 .solaris,
28 .illumos,
2829 .tvos,
2930 .watchos,
3031 .haiku,
lib/std/debug.zig+4-2
......@@ -990,6 +990,7 @@ pub fn openSelfDebugInfo(allocator: mem.Allocator) OpenSelfDebugInfoError!DebugI
990990 .openbsd,
991991 .macos,
992992 .solaris,
993 .illumos,
993994 .windows,
994995 => return try DebugInfo.init(allocator),
995996 else => return error.UnsupportedOperatingSystem,
......@@ -2228,7 +2229,7 @@ pub const ModuleDebugInfo = switch (native_os) {
22282229 };
22292230 }
22302231 },
2231 .linux, .netbsd, .freebsd, .dragonfly, .openbsd, .haiku, .solaris => struct {
2232 .linux, .netbsd, .freebsd, .dragonfly, .openbsd, .haiku, .solaris, .illumos => struct {
22322233 base_address: usize,
22332234 dwarf: DW.DwarfInfo,
22342235 mapped_memory: []align(mem.page_size) const u8,
......@@ -2313,6 +2314,7 @@ pub const have_segfault_handling_support = switch (native_os) {
23132314 .macos,
23142315 .netbsd,
23152316 .solaris,
2317 .illumos,
23162318 .windows,
23172319 => true,
23182320
......@@ -2386,7 +2388,7 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any
23862388 .freebsd, .macos => @intFromPtr(info.addr),
23872389 .netbsd => @intFromPtr(info.info.reason.fault.addr),
23882390 .openbsd => @intFromPtr(info.data.fault.addr),
2389 .solaris => @intFromPtr(info.reason.fault.addr),
2391 .solaris, .illumos => @intFromPtr(info.reason.fault.addr),
23902392 else => unreachable,
23912393 };
23922394
lib/std/dwarf/abi.zig+5-5
......@@ -6,11 +6,11 @@ const mem = std.mem;
66pub fn supportsUnwinding(target: std.Target) bool {
77 return switch (target.cpu.arch) {
88 .x86 => switch (target.os.tag) {
9 .linux, .netbsd, .solaris => true,
9 .linux, .netbsd, .solaris, .illumos => true,
1010 else => false,
1111 },
1212 .x86_64 => switch (target.os.tag) {
13 .linux, .netbsd, .freebsd, .openbsd, .macos, .ios, .solaris => true,
13 .linux, .netbsd, .freebsd, .openbsd, .macos, .ios, .solaris, .illumos => true,
1414 else => false,
1515 },
1616 .arm => switch (target.os.tag) {
......@@ -194,7 +194,7 @@ pub fn regBytes(
194194 const ucontext_ptr = thread_context_ptr;
195195 return switch (builtin.cpu.arch) {
196196 .x86 => switch (builtin.os.tag) {
197 .linux, .netbsd, .solaris => switch (reg_number) {
197 .linux, .netbsd, .solaris, .illumos => switch (reg_number) {
198198 0 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.EAX]),
199199 1 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.ECX]),
200200 2 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.EDX]),
......@@ -229,7 +229,7 @@ pub fn regBytes(
229229 else => error.UnimplementedOs,
230230 },
231231 .x86_64 => switch (builtin.os.tag) {
232 .linux, .solaris => switch (reg_number) {
232 .linux, .solaris, .illumos => switch (reg_number) {
233233 0 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RAX]),
234234 1 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RDX]),
235235 2 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RCX]),
......@@ -247,7 +247,7 @@ pub fn regBytes(
247247 14 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.R14]),
248248 15 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.R15]),
249249 16 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RIP]),
250 17...32 => |i| if (builtin.os.tag == .solaris)
250 17...32 => |i| if (builtin.os.tag.isSolarish())
251251 mem.asBytes(&ucontext_ptr.mcontext.fpregs.chip_state.xmm[i - 17])
252252 else
253253 mem.asBytes(&ucontext_ptr.mcontext.fpregs.xmm[i - 17]),
lib/std/dynamic_library.zig+2-2
......@@ -10,7 +10,7 @@ const system = std.os.system;
1010pub const DynLib = switch (builtin.os.tag) {
1111 .linux => if (builtin.link_libc) DlDynlib else ElfDynLib,
1212 .windows => WindowsDynLib,
13 .macos, .tvos, .watchos, .ios, .freebsd, .netbsd, .openbsd, .dragonfly, .solaris => DlDynlib,
13 .macos, .tvos, .watchos, .ios, .freebsd, .netbsd, .openbsd, .dragonfly, .solaris, .illumos => DlDynlib,
1414 else => void,
1515};
1616
......@@ -388,7 +388,7 @@ pub const DlDynlib = struct {
388388
389389test "dynamic_library" {
390390 const libname = switch (builtin.os.tag) {
391 .linux, .freebsd, .openbsd => "invalid_so.so",
391 .linux, .freebsd, .openbsd, .solaris, .illumos => "invalid_so.so",
392392 .windows => "invalid_dll.dll",
393393 .macos, .tvos, .watchos, .ios => "invalid_dylib.dylib",
394394 else => return error.SkipZigTest,
lib/std/fs.zig+7-6
......@@ -39,7 +39,7 @@ pub const Watch = @import("fs/watch.zig").Watch;
3939/// fit into a UTF-8 encoded array of this length.
4040/// The byte count includes room for a null sentinel byte.
4141pub const MAX_PATH_BYTES = switch (builtin.os.tag) {
42 .linux, .macos, .ios, .freebsd, .openbsd, .netbsd, .dragonfly, .haiku, .solaris, .plan9 => os.PATH_MAX,
42 .linux, .macos, .ios, .freebsd, .openbsd, .netbsd, .dragonfly, .haiku, .solaris, .illumos, .plan9 => os.PATH_MAX,
4343 // Each UTF-16LE character may be expanded to 3 UTF-8 bytes.
4444 // If it would require 4 UTF-8 bytes, then there would be a surrogate
4545 // pair in the UTF-16LE, and we (over)account 3 bytes for it that way.
......@@ -59,7 +59,7 @@ pub const MAX_PATH_BYTES = switch (builtin.os.tag) {
5959/// (depending on the platform) this assumption may not hold for every configuration.
6060/// The byte count does not include a null sentinel byte.
6161pub const MAX_NAME_BYTES = switch (builtin.os.tag) {
62 .linux, .macos, .ios, .freebsd, .openbsd, .netbsd, .dragonfly, .solaris => os.NAME_MAX,
62 .linux, .macos, .ios, .freebsd, .openbsd, .netbsd, .dragonfly, .solaris, .illumos => os.NAME_MAX,
6363 // Haiku's NAME_MAX includes the null terminator, so subtract one.
6464 .haiku => os.NAME_MAX - 1,
6565 // Each UTF-16LE character may be expanded to 3 UTF-8 bytes.
......@@ -325,7 +325,7 @@ pub const IterableDir = struct {
325325 const IteratorError = error{ AccessDenied, SystemResources } || os.UnexpectedError;
326326
327327 pub const Iterator = switch (builtin.os.tag) {
328 .macos, .ios, .freebsd, .netbsd, .dragonfly, .openbsd, .solaris => struct {
328 .macos, .ios, .freebsd, .netbsd, .dragonfly, .openbsd, .solaris, .illumos => struct {
329329 dir: Dir,
330330 seek: i64,
331331 buf: [1024]u8, // TODO align(@alignOf(os.system.dirent)),
......@@ -343,7 +343,7 @@ pub const IterableDir = struct {
343343 switch (builtin.os.tag) {
344344 .macos, .ios => return self.nextDarwin(),
345345 .freebsd, .netbsd, .dragonfly, .openbsd => return self.nextBsd(),
346 .solaris => return self.nextSolaris(),
346 .solaris, .illumos => return self.nextSolaris(),
347347 else => @compileError("unimplemented"),
348348 }
349349 }
......@@ -897,6 +897,7 @@ pub const IterableDir = struct {
897897 .dragonfly,
898898 .openbsd,
899899 .solaris,
900 .illumos,
900901 => return Iterator{
901902 .dir = self.dir,
902903 .seek = 0,
......@@ -1840,7 +1841,7 @@ pub const Dir = struct {
18401841 error.AccessDenied => |e| switch (builtin.os.tag) {
18411842 // non-Linux POSIX systems return EPERM when trying to delete a directory, so
18421843 // we need to handle that case specifically and translate the error
1843 .macos, .ios, .freebsd, .netbsd, .dragonfly, .openbsd, .solaris => {
1844 .macos, .ios, .freebsd, .netbsd, .dragonfly, .openbsd, .solaris, .illumos => {
18441845 // Don't follow symlinks to match unlinkat (which acts on symlinks rather than follows them)
18451846 const fstat = os.fstatatZ(self.fd, sub_path_c, os.AT.SYMLINK_NOFOLLOW) catch return e;
18461847 const is_dir = fstat.mode & os.S.IFMT == os.S.IFDIR;
......@@ -3004,7 +3005,7 @@ pub fn selfExePath(out_buffer: []u8) SelfExePathError![]u8 {
30043005 }
30053006 switch (builtin.os.tag) {
30063007 .linux => return os.readlinkZ("/proc/self/exe", out_buffer),
3007 .solaris => return os.readlinkZ("/proc/self/path/a.out", out_buffer),
3008 .solaris, .illumos => return os.readlinkZ("/proc/self/path/a.out", out_buffer),
30083009 .freebsd, .dragonfly => {
30093010 var mib = [4]c_int{ os.CTL.KERN, os.KERN.PROC, os.KERN.PROC_PATHNAME, -1 };
30103011 var out_len: usize = out_buffer.len;
lib/std/fs/file.zig+2-2
......@@ -359,7 +359,7 @@ pub const File = struct {
359359 os.S.IFSOCK => break :blk .unix_domain_socket,
360360 else => {},
361361 }
362 if (builtin.os.tag == .solaris) switch (m) {
362 if (builtin.os.tag.isSolarish()) switch (m) {
363363 os.S.IFDOOR => break :blk .door,
364364 os.S.IFPORT => break :blk .event_port,
365365 else => {},
......@@ -685,7 +685,7 @@ pub const File = struct {
685685 else => {},
686686 }
687687
688 if (builtin.os.tag == .solaris) switch (m) {
688 if (builtin.os.tag.isSolarish()) switch (m) {
689689 os.S.IFDOOR => return .door,
690690 os.S.IFPORT => return .event_port,
691691 else => {},
lib/std/fs/get_app_data_dir.zig+1-1
......@@ -44,7 +44,7 @@ pub fn getAppDataDir(allocator: mem.Allocator, appname: []const u8) GetAppDataDi
4444 };
4545 return fs.path.join(allocator, &[_][]const u8{ home_dir, "Library", "Application Support", appname });
4646 },
47 .linux, .freebsd, .netbsd, .dragonfly, .openbsd, .solaris => {
47 .linux, .freebsd, .netbsd, .dragonfly, .openbsd, .solaris, .illumos => {
4848 if (os.getenv("XDG_DATA_HOME")) |xdg| {
4949 return fs.path.join(allocator, &[_][]const u8{ xdg, appname });
5050 }
lib/std/os.zig+4-2
......@@ -33,6 +33,7 @@ pub const haiku = std.c;
3333pub const netbsd = std.c;
3434pub const openbsd = std.c;
3535pub const solaris = std.c;
36pub const illumos = std.c;
3637pub const linux = @import("os/linux.zig");
3738pub const plan9 = @import("os/plan9.zig");
3839pub const uefi = @import("os/uefi.zig");
......@@ -1821,7 +1822,7 @@ pub fn execveZ(
18211822 .BADARCH => return error.InvalidExe,
18221823 else => return unexpectedErrno(err),
18231824 },
1824 .linux, .solaris => switch (err) {
1825 .linux => switch (err) {
18251826 .LIBBAD => return error.InvalidExe,
18261827 else => return unexpectedErrno(err),
18271828 },
......@@ -5226,6 +5227,7 @@ pub fn isGetFdPathSupportedOnTarget(os: std.Target.Os) bool {
52265227 .macos, .ios, .watchos, .tvos,
52275228 .linux,
52285229 .solaris,
5230 .illumos,
52295231 .freebsd,
52305232 => true,
52315233 // zig fmt: on
......@@ -5280,7 +5282,7 @@ pub fn getFdPath(fd: fd_t, out_buffer: *[MAX_PATH_BYTES]u8) RealPathError![]u8 {
52805282 };
52815283 return target;
52825284 },
5283 .solaris => {
5285 .solaris, .illumos => {
52845286 var procfs_buf: ["/proc/self/path/-2147483648\x00".len]u8 = undefined;
52855287 const proc_path = std.fmt.bufPrintZ(procfs_buf[0..], "/proc/self/path/{d}", .{fd}) catch unreachable;
52865288
lib/std/os/test.zig+5-5
......@@ -234,7 +234,7 @@ test "link with relative paths" {
234234 if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest;
235235
236236 switch (native_os) {
237 .wasi, .linux, .solaris => {},
237 .wasi, .linux, .solaris, .illumos => {},
238238 else => return error.SkipZigTest,
239239 }
240240 if (true) {
......@@ -277,7 +277,7 @@ test "linkat with different directories" {
277277 if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest;
278278
279279 switch (native_os) {
280 .wasi, .linux, .solaris => {},
280 .wasi, .linux, .solaris, .illumos => {},
281281 else => return error.SkipZigTest,
282282 }
283283 if (true) {
......@@ -706,7 +706,7 @@ test "fcntl" {
706706
707707test "signalfd" {
708708 switch (native_os) {
709 .linux, .solaris => {},
709 .linux, .solaris, .illumos => {},
710710 else => return error.SkipZigTest,
711711 }
712712 _ = &os.signalfd;
......@@ -732,7 +732,7 @@ test "sync" {
732732
733733test "fsync" {
734734 switch (native_os) {
735 .linux, .windows, .solaris => {},
735 .linux, .windows, .solaris, .illumos => {},
736736 else => return error.SkipZigTest,
737737 }
738738
......@@ -870,7 +870,7 @@ test "sigaction" {
870870
871871test "dup & dup2" {
872872 switch (native_os) {
873 .linux, .solaris => {},
873 .linux, .solaris, .illumos => {},
874874 else => return error.SkipZigTest,
875875 }
876876
lib/std/process.zig+12-1
......@@ -959,7 +959,18 @@ pub const UserInfo = struct {
959959/// POSIX function which gets a uid from username.
960960pub fn getUserInfo(name: []const u8) !UserInfo {
961961 return switch (builtin.os.tag) {
962 .linux, .macos, .watchos, .tvos, .ios, .freebsd, .netbsd, .openbsd, .haiku, .solaris => posixGetUserInfo(name),
962 .linux,
963 .macos,
964 .watchos,
965 .tvos,
966 .ios,
967 .freebsd,
968 .netbsd,
969 .openbsd,
970 .haiku,
971 .solaris,
972 .illumos,
973 => posixGetUserInfo(name),
963974 else => @compileError("Unsupported OS"),
964975 };
965976}
lib/std/target.zig+11-2
......@@ -58,6 +58,7 @@ pub const Target = struct {
5858 glsl450,
5959 vulkan,
6060 plan9,
61 illumos,
6162 other,
6263
6364 pub inline fn isDarwin(tag: Tag) bool {
......@@ -74,6 +75,10 @@ pub const Target = struct {
7475 };
7576 }
7677
78 pub inline fn isSolarish(tag: Tag) bool {
79 return tag == .solaris or tag == .illumos;
80 }
81
7782 pub fn dynamicLibSuffix(tag: Tag) [:0]const u8 {
7883 if (tag.isDarwin()) {
7984 return ".dylib";
......@@ -326,7 +331,7 @@ pub const Target = struct {
326331 .max = .{ .major = 6, .minor = 4, .patch = 0 },
327332 },
328333 },
329 .solaris => return .{
334 .solaris, .illumos => return .{
330335 .semver = .{
331336 .min = .{ .major = 5, .minor = 11, .patch = 0 },
332337 .max = .{ .major = 5, .minor = 11, .patch = 0 },
......@@ -376,6 +381,7 @@ pub const Target = struct {
376381 .openbsd,
377382 .dragonfly,
378383 .solaris,
384 .illumos,
379385 => return TaggedVersionRange{ .semver = self.version_range.semver },
380386
381387 else => return .none,
......@@ -409,6 +415,7 @@ pub const Target = struct {
409415 .openbsd,
410416 .haiku,
411417 .solaris,
418 .illumos,
412419 => true,
413420
414421 .linux,
......@@ -569,6 +576,7 @@ pub const Target = struct {
569576 .shadermodel,
570577 .liteos, // TODO: audit this
571578 .solaris,
579 .illumos,
572580 => return .none,
573581 }
574582 }
......@@ -1575,7 +1583,7 @@ pub const Target = struct {
15751583 .netbsd => return copy(&result, "/libexec/ld.elf_so"),
15761584 .openbsd => return copy(&result, "/usr/libexec/ld.so"),
15771585 .dragonfly => return copy(&result, "/libexec/ld-elf.so.2"),
1578 .solaris => return copy(&result, "/usr/lib/amd64/ld.so.1"),
1586 .solaris, .illumos => return copy(&result, "/usr/lib/64/ld.so.1"),
15791587 .linux => switch (self.cpu.arch) {
15801588 .x86,
15811589 .sparc,
......@@ -2115,6 +2123,7 @@ pub const Target = struct {
21152123 .emscripten,
21162124 .plan9,
21172125 .solaris,
2126 .illumos,
21182127 .haiku,
21192128 .ananas,
21202129 .fuchsia,
lib/std/zig/CrossTarget.zig+2
......@@ -111,6 +111,7 @@ fn updateOsVersionRange(self: *CrossTarget, os: Target.Os) void {
111111 .kfreebsd,
112112 .lv2,
113113 .solaris,
114 .illumos,
114115 .zos,
115116 .haiku,
116117 .minix,
......@@ -709,6 +710,7 @@ fn parseOs(result: *CrossTarget, diags: *ParseOptions.Diagnostics, text: []const
709710 .kfreebsd,
710711 .lv2,
711712 .solaris,
713 .illumos,
712714 .zos,
713715 .haiku,
714716 .minix,
lib/std/zig/system/NativePaths.zig+1-1
......@@ -89,7 +89,7 @@ pub fn detect(arena: Allocator, native_info: NativeTargetInfo) !NativePaths {
8989 return self;
9090 }
9191
92 if (builtin.os.tag == .solaris) {
92 if (builtin.os.tag.isSolarish()) {
9393 try self.addLibDir("/usr/lib/64");
9494 try self.addLibDir("/usr/local/lib/64");
9595 try self.addLibDir("/lib/64");
lib/std/zig/system/NativeTargetInfo.zig+3-3
......@@ -51,7 +51,7 @@ pub fn detect(cross_target: CrossTarget) DetectError!NativeTargetInfo {
5151 error.InvalidVersion => {},
5252 }
5353 },
54 .solaris => {
54 .solaris, .illumos => {
5555 const uts = std.os.uname();
5656 const release = mem.sliceTo(&uts.release, 0);
5757 if (std.SemanticVersion.parse(release)) |ver| {
......@@ -257,12 +257,12 @@ fn detectAbiAndDynamicLinker(
257257) DetectError!NativeTargetInfo {
258258 const native_target_has_ld = comptime builtin.target.hasDynamicLinker();
259259 const is_linux = builtin.target.os.tag == .linux;
260 const is_solaris = builtin.target.os.tag == .solaris;
260 const is_solarish = builtin.target.os.tag.isSolarish();
261261 const have_all_info = cross_target.dynamic_linker.get() != null and
262262 cross_target.abi != null and (!is_linux or cross_target.abi.?.isGnu());
263263 const os_is_non_native = cross_target.os_tag != null;
264264 // The Solaris/illumos environment is always the same.
265 if (!native_target_has_ld or have_all_info or os_is_non_native or is_solaris) {
265 if (!native_target_has_ld or have_all_info or os_is_non_native or is_solarish) {
266266 return defaultAbiAndDynamicLinker(cpu, os, cross_target);
267267 }
268268 if (cross_target.abi) |abi| {
src/codegen/llvm.zig+2-2
......@@ -120,7 +120,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {
120120 .lv2 => "lv2",
121121 .netbsd => "netbsd",
122122 .openbsd => "openbsd",
123 .solaris => "solaris",
123 .solaris, .illumos => "solaris",
124124 .windows => "windows",
125125 .zos => "zos",
126126 .haiku => "haiku",
......@@ -231,7 +231,7 @@ pub fn targetOs(os_tag: std.Target.Os.Tag) llvm.OSType {
231231 .macos => .MacOSX,
232232 .netbsd => .NetBSD,
233233 .openbsd => .OpenBSD,
234 .solaris => .Solaris,
234 .solaris, .illumos => .Solaris,
235235 .zos => .ZOS,
236236 .haiku => .Haiku,
237237 .minix => .Minix,
src/crash_report.zig+1-1
......@@ -190,7 +190,7 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any
190190 .freebsd, .macos => @intFromPtr(info.addr),
191191 .netbsd => @intFromPtr(info.info.reason.fault.addr),
192192 .openbsd => @intFromPtr(info.data.fault.addr),
193 .solaris => @intFromPtr(info.reason.fault.addr),
193 .solaris, .illumos => @intFromPtr(info.reason.fault.addr),
194194 else => @compileError("TODO implement handleSegfaultPosix for new POSIX OS"),
195195 };
196196
src/libc_installation.zig+2-3
......@@ -213,9 +213,8 @@ pub const LibCInstallation = struct {
213213 try self.findNativeIncludeDirPosix(args);
214214 try self.findNativeCrtBeginDirHaiku(args);
215215 self.crt_dir = try args.allocator.dupeZ(u8, "/system/develop/lib");
216 } else if (builtin.target.os.tag == .solaris) {
217 // There is only one libc in illumos, and its headers and
218 // libraries are always in the same spot.
216 } else if (builtin.target.os.tag.isSolarish()) {
217 // There is only one libc, and its headers/libraries are always in the same spot.
219218 self.include_dir = try args.allocator.dupeZ(u8, "/usr/include");
220219 self.sys_include_dir = try args.allocator.dupeZ(u8, "/usr/include");
221220 self.crt_dir = try args.allocator.dupeZ(u8, "/usr/lib/64");
src/libcxx.zig+1-1
......@@ -150,7 +150,7 @@ pub fn buildLibCXX(comp: *Compilation, prog_node: *std.Progress.Node) !void {
150150
151151 if (std.mem.startsWith(u8, cxx_src, "src/support/win32/") and target.os.tag != .windows)
152152 continue;
153 if (std.mem.startsWith(u8, cxx_src, "src/support/solaris/") and target.os.tag != .solaris)
153 if (std.mem.startsWith(u8, cxx_src, "src/support/solaris/") and !target.os.tag.isSolarish())
154154 continue;
155155 if (std.mem.startsWith(u8, cxx_src, "src/support/ibm/") and target.os.tag != .zos)
156156 continue;
src/link/Elf.zig+1-1
......@@ -3818,7 +3818,7 @@ const CsuObjects = struct {
38183818 .static_pie => result.set( "start_dyn.o", "crti.o", "crtbeginS.o", "crtendS.o", "crtn.o" ),
38193819 // zig fmt: on
38203820 },
3821 .solaris => switch (mode) {
3821 .solaris, .illumos => switch (mode) {
38223822 // zig fmt: off
38233823 .dynamic_lib => result.set( null, "crti.o", null, null, "crtn.o" ),
38243824 .dynamic_exe,
src/target.zig+2-2
......@@ -218,7 +218,7 @@ pub fn hasValgrindSupport(target: std.Target) bool {
218218 .aarch64_32,
219219 .aarch64_be,
220220 => {
221 return target.os.tag == .linux or target.os.tag == .solaris or
221 return target.os.tag == .linux or target.os.tag == .solaris or target.os.tag == .illumos or
222222 (target.os.tag == .windows and target.abi != .msvc);
223223 },
224224 else => return false,
......@@ -493,7 +493,7 @@ pub fn libcFullLinkFlags(target: std.Target) []const []const u8 {
493493 "-lc",
494494 "-lutil",
495495 },
496 .solaris => &[_][]const u8{
496 .solaris, .illumos => &[_][]const u8{
497497 "-lm",
498498 "-lsocket",
499499 "-lnsl",