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 @@...@@ -1,4 +1,5 @@
1cmake_minimum_required(VERSION 3.5)1cmake_minimum_required(VERSION 3.5)
2include(CheckSymbolExists)
23
3if(NOT CMAKE_BUILD_TYPE)4if(NOT CMAKE_BUILD_TYPE)
4 set(CMAKE_BUILD_TYPE "Debug" CACHE STRING5 set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
...@@ -709,12 +710,17 @@ string(TOLOWER "${CMAKE_HOST_SYSTEM_NAME}" ZIG_HOST_TARGET_OS)...@@ -709,12 +710,17 @@ string(TOLOWER "${CMAKE_HOST_SYSTEM_NAME}" ZIG_HOST_TARGET_OS)
709if(ZIG_HOST_TARGET_OS STREQUAL "darwin")710if(ZIG_HOST_TARGET_OS STREQUAL "darwin")
710 set(ZIG_HOST_TARGET_OS "macos")711 set(ZIG_HOST_TARGET_OS "macos")
711elseif(ZIG_HOST_TARGET_OS STREQUAL "sunos")712elseif(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()
713endif()719endif()
714720
715string(TOLOWER "${CMAKE_HOST_SYSTEM_PROCESSOR}" ZIG_HOST_TARGET_ARCH)721string(TOLOWER "${CMAKE_HOST_SYSTEM_PROCESSOR}" ZIG_HOST_TARGET_ARCH)
716if(ZIG_HOST_TARGET_ARCH MATCHES "^i[3-9]86$")722if(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)")
718 set(ZIG_HOST_TARGET_ARCH "x86_64")724 set(ZIG_HOST_TARGET_ARCH "x86_64")
719 else()725 else()
720 set(ZIG_HOST_TARGET_ARCH "x86")726 set(ZIG_HOST_TARGET_ARCH "x86")
...@@ -730,7 +736,6 @@ elseif(ZIG_HOST_TARGET_ARCH STREQUAL "armv7b")...@@ -730,7 +736,6 @@ elseif(ZIG_HOST_TARGET_ARCH STREQUAL "armv7b")
730endif()736endif()
731string(REGEX REPLACE "^((arm|thumb)(hf?)?)el$" "\\1" ZIG_HOST_TARGET_ARCH "${ZIG_HOST_TARGET_ARCH}")737string(REGEX REPLACE "^((arm|thumb)(hf?)?)el$" "\\1" ZIG_HOST_TARGET_ARCH "${ZIG_HOST_TARGET_ARCH}")
732if(ZIG_HOST_TARGET_ARCH MATCHES "^arm(hf?)?(eb)?$")738if(ZIG_HOST_TARGET_ARCH MATCHES "^arm(hf?)?(eb)?$")
733 include(CheckSymbolExists)
734 check_symbol_exists(__thumb__ "" ZIG_HOST_TARGET_DEFAULTS_TO_THUMB)739 check_symbol_exists(__thumb__ "" ZIG_HOST_TARGET_DEFAULTS_TO_THUMB)
735 if(ZIG_HOST_TARGET_DEFAULTS_TO_THUMB)740 if(ZIG_HOST_TARGET_DEFAULTS_TO_THUMB)
736 string(REGEX REPLACE "^arm" "thumb" ZIG_HOST_TARGET_ARCH "${ZIG_HOST_TARGET_ARCH}")741 string(REGEX REPLACE "^arm" "thumb" ZIG_HOST_TARGET_ARCH "${ZIG_HOST_TARGET_ARCH}")
build.zig+3-3
...@@ -670,9 +670,9 @@ fn addCmakeCfgOptionsToExe(...@@ -670,9 +670,9 @@ fn addCmakeCfgOptionsToExe(
670 try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes);670 try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes);
671 }671 }
672 },672 },
673 .solaris => {673 .solaris, .illumos => {
674 try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes);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);675 try addCxxKnownPath(b, cfg, exe, b.fmt("libgcc_eh.{s}", .{lib_suffix}), null, need_cpp_includes);
676 },676 },
677 else => {},677 else => {},
678 }678 }
lib/std/Thread.zig+4-4
...@@ -43,7 +43,7 @@ pub const max_name_len = switch (target.os.tag) {...@@ -43,7 +43,7 @@ pub const max_name_len = switch (target.os.tag) {
43 .freebsd => 15,43 .freebsd => 15,
44 .openbsd => 23,44 .openbsd => 23,
45 .dragonfly => 1023,45 .dragonfly => 1023,
46 .solaris => 31,46 .solaris, .illumos => 31,
47 else => 0,47 else => 0,
48};48};
4949
...@@ -123,7 +123,7 @@ pub fn setName(self: Thread, name: []const u8) SetNameError!void {...@@ -123,7 +123,7 @@ pub fn setName(self: Thread, name: []const u8) SetNameError!void {
123 else => |e| return os.unexpectedErrno(e),123 else => |e| return os.unexpectedErrno(e),
124 }124 }
125 },125 },
126 .netbsd, .solaris => if (use_pthreads) {126 .netbsd, .solaris, .illumos => if (use_pthreads) {
127 const err = std.c.pthread_setname_np(self.getHandle(), name_with_terminator.ptr, null);127 const err = std.c.pthread_setname_np(self.getHandle(), name_with_terminator.ptr, null);
128 switch (err) {128 switch (err) {
129 .SUCCESS => return,129 .SUCCESS => return,
...@@ -229,7 +229,7 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co...@@ -229,7 +229,7 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co
229 else => |e| return os.unexpectedErrno(e),229 else => |e| return os.unexpectedErrno(e),
230 }230 }
231 },231 },
232 .netbsd, .solaris => if (use_pthreads) {232 .netbsd, .solaris, .illumos => if (use_pthreads) {
233 const err = std.c.pthread_getname_np(self.getHandle(), buffer.ptr, max_name_len + 1);233 const err = std.c.pthread_getname_np(self.getHandle(), buffer.ptr, max_name_len + 1);
234 switch (err) {234 switch (err) {
235 .SUCCESS => return std.mem.sliceTo(buffer, 0),235 .SUCCESS => return std.mem.sliceTo(buffer, 0),
...@@ -636,7 +636,7 @@ const PosixThreadImpl = struct {...@@ -636,7 +636,7 @@ const PosixThreadImpl = struct {
636 };636 };
637 return @as(usize, @intCast(count));637 return @as(usize, @intCast(count));
638 },638 },
639 .solaris => {639 .solaris, .illumos => {
640 // The "proper" way to get the cpu count would be to query640 // The "proper" way to get the cpu count would be to query
641 // /dev/kstat via ioctls, and traverse a linked list for each641 // /dev/kstat via ioctls, and traverse a linked list for each
642 // cpu.642 // cpu.
lib/std/c.zig+1-1
...@@ -49,7 +49,7 @@ pub usingnamespace switch (builtin.os.tag) {...@@ -49,7 +49,7 @@ pub usingnamespace switch (builtin.os.tag) {
49 .openbsd => @import("c/openbsd.zig"),49 .openbsd => @import("c/openbsd.zig"),
50 .haiku => @import("c/haiku.zig"),50 .haiku => @import("c/haiku.zig"),
51 .hermit => @import("c/hermit.zig"),51 .hermit => @import("c/hermit.zig"),
52 .solaris => @import("c/solaris.zig"),52 .solaris, .illumos => @import("c/solaris.zig"),
53 .fuchsia => @import("c/fuchsia.zig"),53 .fuchsia => @import("c/fuchsia.zig"),
54 .minix => @import("c/minix.zig"),54 .minix => @import("c/minix.zig"),
55 .emscripten => @import("c/emscripten.zig"),55 .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 {...@@ -64,7 +64,7 @@ pub fn rescan(cb: *Bundle, gpa: Allocator) RescanError!void {
64 .netbsd => return rescanBSD(cb, gpa, "/etc/openssl/certs/ca-certificates.crt"),64 .netbsd => return rescanBSD(cb, gpa, "/etc/openssl/certs/ca-certificates.crt"),
65 .dragonfly => return rescanBSD(cb, gpa, "/usr/local/etc/ssl/cert.pem"),65 .dragonfly => return rescanBSD(cb, gpa, "/usr/local/etc/ssl/cert.pem"),
66 .windows => return rescanWindows(cb, gpa),66 .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"),
68 else => {},68 else => {},
69 }69 }
70}70}
lib/std/crypto/tlcsprng.zig+1
...@@ -25,6 +25,7 @@ const os_has_fork = switch (builtin.os.tag) {...@@ -25,6 +25,7 @@ const os_has_fork = switch (builtin.os.tag) {
25 .netbsd,25 .netbsd,
26 .openbsd,26 .openbsd,
27 .solaris,27 .solaris,
28 .illumos,
28 .tvos,29 .tvos,
29 .watchos,30 .watchos,
30 .haiku,31 .haiku,
lib/std/debug.zig+4-2
...@@ -990,6 +990,7 @@ pub fn openSelfDebugInfo(allocator: mem.Allocator) OpenSelfDebugInfoError!DebugI...@@ -990,6 +990,7 @@ pub fn openSelfDebugInfo(allocator: mem.Allocator) OpenSelfDebugInfoError!DebugI
990 .openbsd,990 .openbsd,
991 .macos,991 .macos,
992 .solaris,992 .solaris,
993 .illumos,
993 .windows,994 .windows,
994 => return try DebugInfo.init(allocator),995 => return try DebugInfo.init(allocator),
995 else => return error.UnsupportedOperatingSystem,996 else => return error.UnsupportedOperatingSystem,
...@@ -2228,7 +2229,7 @@ pub const ModuleDebugInfo = switch (native_os) {...@@ -2228,7 +2229,7 @@ pub const ModuleDebugInfo = switch (native_os) {
2228 };2229 };
2229 }2230 }
2230 },2231 },
2231 .linux, .netbsd, .freebsd, .dragonfly, .openbsd, .haiku, .solaris => struct {2232 .linux, .netbsd, .freebsd, .dragonfly, .openbsd, .haiku, .solaris, .illumos => struct {
2232 base_address: usize,2233 base_address: usize,
2233 dwarf: DW.DwarfInfo,2234 dwarf: DW.DwarfInfo,
2234 mapped_memory: []align(mem.page_size) const u8,2235 mapped_memory: []align(mem.page_size) const u8,
...@@ -2313,6 +2314,7 @@ pub const have_segfault_handling_support = switch (native_os) {...@@ -2313,6 +2314,7 @@ pub const have_segfault_handling_support = switch (native_os) {
2313 .macos,2314 .macos,
2314 .netbsd,2315 .netbsd,
2315 .solaris,2316 .solaris,
2317 .illumos,
2316 .windows,2318 .windows,
2317 => true,2319 => true,
23182320
...@@ -2386,7 +2388,7 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any...@@ -2386,7 +2388,7 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any
2386 .freebsd, .macos => @intFromPtr(info.addr),2388 .freebsd, .macos => @intFromPtr(info.addr),
2387 .netbsd => @intFromPtr(info.info.reason.fault.addr),2389 .netbsd => @intFromPtr(info.info.reason.fault.addr),
2388 .openbsd => @intFromPtr(info.data.fault.addr),2390 .openbsd => @intFromPtr(info.data.fault.addr),
2389 .solaris => @intFromPtr(info.reason.fault.addr),2391 .solaris, .illumos => @intFromPtr(info.reason.fault.addr),
2390 else => unreachable,2392 else => unreachable,
2391 };2393 };
23922394
lib/std/dwarf/abi.zig+5-5
...@@ -6,11 +6,11 @@ const mem = std.mem;...@@ -6,11 +6,11 @@ const mem = std.mem;
6pub fn supportsUnwinding(target: std.Target) bool {6pub fn supportsUnwinding(target: std.Target) bool {
7 return switch (target.cpu.arch) {7 return switch (target.cpu.arch) {
8 .x86 => switch (target.os.tag) {8 .x86 => switch (target.os.tag) {
9 .linux, .netbsd, .solaris => true,9 .linux, .netbsd, .solaris, .illumos => true,
10 else => false,10 else => false,
11 },11 },
12 .x86_64 => switch (target.os.tag) {12 .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,
14 else => false,14 else => false,
15 },15 },
16 .arm => switch (target.os.tag) {16 .arm => switch (target.os.tag) {
...@@ -194,7 +194,7 @@ pub fn regBytes(...@@ -194,7 +194,7 @@ pub fn regBytes(
194 const ucontext_ptr = thread_context_ptr;194 const ucontext_ptr = thread_context_ptr;
195 return switch (builtin.cpu.arch) {195 return switch (builtin.cpu.arch) {
196 .x86 => switch (builtin.os.tag) {196 .x86 => switch (builtin.os.tag) {
197 .linux, .netbsd, .solaris => switch (reg_number) {197 .linux, .netbsd, .solaris, .illumos => switch (reg_number) {
198 0 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.EAX]),198 0 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.EAX]),
199 1 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.ECX]),199 1 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.ECX]),
200 2 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.EDX]),200 2 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.EDX]),
...@@ -229,7 +229,7 @@ pub fn regBytes(...@@ -229,7 +229,7 @@ pub fn regBytes(
229 else => error.UnimplementedOs,229 else => error.UnimplementedOs,
230 },230 },
231 .x86_64 => switch (builtin.os.tag) {231 .x86_64 => switch (builtin.os.tag) {
232 .linux, .solaris => switch (reg_number) {232 .linux, .solaris, .illumos => switch (reg_number) {
233 0 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RAX]),233 0 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RAX]),
234 1 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RDX]),234 1 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RDX]),
235 2 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RCX]),235 2 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RCX]),
...@@ -247,7 +247,7 @@ pub fn regBytes(...@@ -247,7 +247,7 @@ pub fn regBytes(
247 14 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.R14]),247 14 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.R14]),
248 15 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.R15]),248 15 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.R15]),
249 16 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RIP]),249 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())
251 mem.asBytes(&ucontext_ptr.mcontext.fpregs.chip_state.xmm[i - 17])251 mem.asBytes(&ucontext_ptr.mcontext.fpregs.chip_state.xmm[i - 17])
252 else252 else
253 mem.asBytes(&ucontext_ptr.mcontext.fpregs.xmm[i - 17]),253 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;...@@ -10,7 +10,7 @@ const system = std.os.system;
10pub const DynLib = switch (builtin.os.tag) {10pub const DynLib = switch (builtin.os.tag) {
11 .linux => if (builtin.link_libc) DlDynlib else ElfDynLib,11 .linux => if (builtin.link_libc) DlDynlib else ElfDynLib,
12 .windows => WindowsDynLib,12 .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,
14 else => void,14 else => void,
15};15};
1616
...@@ -388,7 +388,7 @@ pub const DlDynlib = struct {...@@ -388,7 +388,7 @@ pub const DlDynlib = struct {
388388
389test "dynamic_library" {389test "dynamic_library" {
390 const libname = switch (builtin.os.tag) {390 const libname = switch (builtin.os.tag) {
391 .linux, .freebsd, .openbsd => "invalid_so.so",391 .linux, .freebsd, .openbsd, .solaris, .illumos => "invalid_so.so",
392 .windows => "invalid_dll.dll",392 .windows => "invalid_dll.dll",
393 .macos, .tvos, .watchos, .ios => "invalid_dylib.dylib",393 .macos, .tvos, .watchos, .ios => "invalid_dylib.dylib",
394 else => return error.SkipZigTest,394 else => return error.SkipZigTest,
lib/std/fs.zig+7-6
...@@ -39,7 +39,7 @@ pub const Watch = @import("fs/watch.zig").Watch;...@@ -39,7 +39,7 @@ pub const Watch = @import("fs/watch.zig").Watch;
39/// fit into a UTF-8 encoded array of this length.39/// fit into a UTF-8 encoded array of this length.
40/// The byte count includes room for a null sentinel byte.40/// The byte count includes room for a null sentinel byte.
41pub const MAX_PATH_BYTES = switch (builtin.os.tag) {41pub 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,
43 // Each UTF-16LE character may be expanded to 3 UTF-8 bytes.43 // Each UTF-16LE character may be expanded to 3 UTF-8 bytes.
44 // If it would require 4 UTF-8 bytes, then there would be a surrogate44 // If it would require 4 UTF-8 bytes, then there would be a surrogate
45 // pair in the UTF-16LE, and we (over)account 3 bytes for it that way.45 // 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) {...@@ -59,7 +59,7 @@ pub const MAX_PATH_BYTES = switch (builtin.os.tag) {
59/// (depending on the platform) this assumption may not hold for every configuration.59/// (depending on the platform) this assumption may not hold for every configuration.
60/// The byte count does not include a null sentinel byte.60/// The byte count does not include a null sentinel byte.
61pub const MAX_NAME_BYTES = switch (builtin.os.tag) {61pub 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,
63 // Haiku's NAME_MAX includes the null terminator, so subtract one.63 // Haiku's NAME_MAX includes the null terminator, so subtract one.
64 .haiku => os.NAME_MAX - 1,64 .haiku => os.NAME_MAX - 1,
65 // Each UTF-16LE character may be expanded to 3 UTF-8 bytes.65 // Each UTF-16LE character may be expanded to 3 UTF-8 bytes.
...@@ -325,7 +325,7 @@ pub const IterableDir = struct {...@@ -325,7 +325,7 @@ pub const IterableDir = struct {
325 const IteratorError = error{ AccessDenied, SystemResources } || os.UnexpectedError;325 const IteratorError = error{ AccessDenied, SystemResources } || os.UnexpectedError;
326326
327 pub const Iterator = switch (builtin.os.tag) {327 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 {
329 dir: Dir,329 dir: Dir,
330 seek: i64,330 seek: i64,
331 buf: [1024]u8, // TODO align(@alignOf(os.system.dirent)),331 buf: [1024]u8, // TODO align(@alignOf(os.system.dirent)),
...@@ -343,7 +343,7 @@ pub const IterableDir = struct {...@@ -343,7 +343,7 @@ pub const IterableDir = struct {
343 switch (builtin.os.tag) {343 switch (builtin.os.tag) {
344 .macos, .ios => return self.nextDarwin(),344 .macos, .ios => return self.nextDarwin(),
345 .freebsd, .netbsd, .dragonfly, .openbsd => return self.nextBsd(),345 .freebsd, .netbsd, .dragonfly, .openbsd => return self.nextBsd(),
346 .solaris => return self.nextSolaris(),346 .solaris, .illumos => return self.nextSolaris(),
347 else => @compileError("unimplemented"),347 else => @compileError("unimplemented"),
348 }348 }
349 }349 }
...@@ -897,6 +897,7 @@ pub const IterableDir = struct {...@@ -897,6 +897,7 @@ pub const IterableDir = struct {
897 .dragonfly,897 .dragonfly,
898 .openbsd,898 .openbsd,
899 .solaris,899 .solaris,
900 .illumos,
900 => return Iterator{901 => return Iterator{
901 .dir = self.dir,902 .dir = self.dir,
902 .seek = 0,903 .seek = 0,
...@@ -1840,7 +1841,7 @@ pub const Dir = struct {...@@ -1840,7 +1841,7 @@ pub const Dir = struct {
1840 error.AccessDenied => |e| switch (builtin.os.tag) {1841 error.AccessDenied => |e| switch (builtin.os.tag) {
1841 // non-Linux POSIX systems return EPERM when trying to delete a directory, so1842 // non-Linux POSIX systems return EPERM when trying to delete a directory, so
1842 // we need to handle that case specifically and translate the error1843 // 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 => {
1844 // Don't follow symlinks to match unlinkat (which acts on symlinks rather than follows them)1845 // Don't follow symlinks to match unlinkat (which acts on symlinks rather than follows them)
1845 const fstat = os.fstatatZ(self.fd, sub_path_c, os.AT.SYMLINK_NOFOLLOW) catch return e;1846 const fstat = os.fstatatZ(self.fd, sub_path_c, os.AT.SYMLINK_NOFOLLOW) catch return e;
1846 const is_dir = fstat.mode & os.S.IFMT == os.S.IFDIR;1847 const is_dir = fstat.mode & os.S.IFMT == os.S.IFDIR;
...@@ -3004,7 +3005,7 @@ pub fn selfExePath(out_buffer: []u8) SelfExePathError![]u8 {...@@ -3004,7 +3005,7 @@ pub fn selfExePath(out_buffer: []u8) SelfExePathError![]u8 {
3004 }3005 }
3005 switch (builtin.os.tag) {3006 switch (builtin.os.tag) {
3006 .linux => return os.readlinkZ("/proc/self/exe", out_buffer),3007 .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),
3008 .freebsd, .dragonfly => {3009 .freebsd, .dragonfly => {
3009 var mib = [4]c_int{ os.CTL.KERN, os.KERN.PROC, os.KERN.PROC_PATHNAME, -1 };3010 var mib = [4]c_int{ os.CTL.KERN, os.KERN.PROC, os.KERN.PROC_PATHNAME, -1 };
3010 var out_len: usize = out_buffer.len;3011 var out_len: usize = out_buffer.len;
lib/std/fs/file.zig+2-2
...@@ -359,7 +359,7 @@ pub const File = struct {...@@ -359,7 +359,7 @@ pub const File = struct {
359 os.S.IFSOCK => break :blk .unix_domain_socket,359 os.S.IFSOCK => break :blk .unix_domain_socket,
360 else => {},360 else => {},
361 }361 }
362 if (builtin.os.tag == .solaris) switch (m) {362 if (builtin.os.tag.isSolarish()) switch (m) {
363 os.S.IFDOOR => break :blk .door,363 os.S.IFDOOR => break :blk .door,
364 os.S.IFPORT => break :blk .event_port,364 os.S.IFPORT => break :blk .event_port,
365 else => {},365 else => {},
...@@ -685,7 +685,7 @@ pub const File = struct {...@@ -685,7 +685,7 @@ pub const File = struct {
685 else => {},685 else => {},
686 }686 }
687687
688 if (builtin.os.tag == .solaris) switch (m) {688 if (builtin.os.tag.isSolarish()) switch (m) {
689 os.S.IFDOOR => return .door,689 os.S.IFDOOR => return .door,
690 os.S.IFPORT => return .event_port,690 os.S.IFPORT => return .event_port,
691 else => {},691 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...@@ -44,7 +44,7 @@ pub fn getAppDataDir(allocator: mem.Allocator, appname: []const u8) GetAppDataDi
44 };44 };
45 return fs.path.join(allocator, &[_][]const u8{ home_dir, "Library", "Application Support", appname });45 return fs.path.join(allocator, &[_][]const u8{ home_dir, "Library", "Application Support", appname });
46 },46 },
47 .linux, .freebsd, .netbsd, .dragonfly, .openbsd, .solaris => {47 .linux, .freebsd, .netbsd, .dragonfly, .openbsd, .solaris, .illumos => {
48 if (os.getenv("XDG_DATA_HOME")) |xdg| {48 if (os.getenv("XDG_DATA_HOME")) |xdg| {
49 return fs.path.join(allocator, &[_][]const u8{ xdg, appname });49 return fs.path.join(allocator, &[_][]const u8{ xdg, appname });
50 }50 }
lib/std/os.zig+4-2
...@@ -33,6 +33,7 @@ pub const haiku = std.c;...@@ -33,6 +33,7 @@ pub const haiku = std.c;
33pub const netbsd = std.c;33pub const netbsd = std.c;
34pub const openbsd = std.c;34pub const openbsd = std.c;
35pub const solaris = std.c;35pub const solaris = std.c;
36pub const illumos = std.c;
36pub const linux = @import("os/linux.zig");37pub const linux = @import("os/linux.zig");
37pub const plan9 = @import("os/plan9.zig");38pub const plan9 = @import("os/plan9.zig");
38pub const uefi = @import("os/uefi.zig");39pub const uefi = @import("os/uefi.zig");
...@@ -1821,7 +1822,7 @@ pub fn execveZ(...@@ -1821,7 +1822,7 @@ pub fn execveZ(
1821 .BADARCH => return error.InvalidExe,1822 .BADARCH => return error.InvalidExe,
1822 else => return unexpectedErrno(err),1823 else => return unexpectedErrno(err),
1823 },1824 },
1824 .linux, .solaris => switch (err) {1825 .linux => switch (err) {
1825 .LIBBAD => return error.InvalidExe,1826 .LIBBAD => return error.InvalidExe,
1826 else => return unexpectedErrno(err),1827 else => return unexpectedErrno(err),
1827 },1828 },
...@@ -5226,6 +5227,7 @@ pub fn isGetFdPathSupportedOnTarget(os: std.Target.Os) bool {...@@ -5226,6 +5227,7 @@ pub fn isGetFdPathSupportedOnTarget(os: std.Target.Os) bool {
5226 .macos, .ios, .watchos, .tvos,5227 .macos, .ios, .watchos, .tvos,
5227 .linux,5228 .linux,
5228 .solaris,5229 .solaris,
5230 .illumos,
5229 .freebsd,5231 .freebsd,
5230 => true,5232 => true,
5231 // zig fmt: on5233 // zig fmt: on
...@@ -5280,7 +5282,7 @@ pub fn getFdPath(fd: fd_t, out_buffer: *[MAX_PATH_BYTES]u8) RealPathError![]u8 {...@@ -5280,7 +5282,7 @@ pub fn getFdPath(fd: fd_t, out_buffer: *[MAX_PATH_BYTES]u8) RealPathError![]u8 {
5280 };5282 };
5281 return target;5283 return target;
5282 },5284 },
5283 .solaris => {5285 .solaris, .illumos => {
5284 var procfs_buf: ["/proc/self/path/-2147483648\x00".len]u8 = undefined;5286 var procfs_buf: ["/proc/self/path/-2147483648\x00".len]u8 = undefined;
5285 const proc_path = std.fmt.bufPrintZ(procfs_buf[0..], "/proc/self/path/{d}", .{fd}) catch unreachable;5287 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" {...@@ -234,7 +234,7 @@ test "link with relative paths" {
234 if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest;234 if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest;
235235
236 switch (native_os) {236 switch (native_os) {
237 .wasi, .linux, .solaris => {},237 .wasi, .linux, .solaris, .illumos => {},
238 else => return error.SkipZigTest,238 else => return error.SkipZigTest,
239 }239 }
240 if (true) {240 if (true) {
...@@ -277,7 +277,7 @@ test "linkat with different directories" {...@@ -277,7 +277,7 @@ test "linkat with different directories" {
277 if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest;277 if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest;
278278
279 switch (native_os) {279 switch (native_os) {
280 .wasi, .linux, .solaris => {},280 .wasi, .linux, .solaris, .illumos => {},
281 else => return error.SkipZigTest,281 else => return error.SkipZigTest,
282 }282 }
283 if (true) {283 if (true) {
...@@ -706,7 +706,7 @@ test "fcntl" {...@@ -706,7 +706,7 @@ test "fcntl" {
706706
707test "signalfd" {707test "signalfd" {
708 switch (native_os) {708 switch (native_os) {
709 .linux, .solaris => {},709 .linux, .solaris, .illumos => {},
710 else => return error.SkipZigTest,710 else => return error.SkipZigTest,
711 }711 }
712 _ = &os.signalfd;712 _ = &os.signalfd;
...@@ -732,7 +732,7 @@ test "sync" {...@@ -732,7 +732,7 @@ test "sync" {
732732
733test "fsync" {733test "fsync" {
734 switch (native_os) {734 switch (native_os) {
735 .linux, .windows, .solaris => {},735 .linux, .windows, .solaris, .illumos => {},
736 else => return error.SkipZigTest,736 else => return error.SkipZigTest,
737 }737 }
738738
...@@ -870,7 +870,7 @@ test "sigaction" {...@@ -870,7 +870,7 @@ test "sigaction" {
870870
871test "dup & dup2" {871test "dup & dup2" {
872 switch (native_os) {872 switch (native_os) {
873 .linux, .solaris => {},873 .linux, .solaris, .illumos => {},
874 else => return error.SkipZigTest,874 else => return error.SkipZigTest,
875 }875 }
876876
lib/std/process.zig+12-1
...@@ -959,7 +959,18 @@ pub const UserInfo = struct {...@@ -959,7 +959,18 @@ pub const UserInfo = struct {
959/// POSIX function which gets a uid from username.959/// POSIX function which gets a uid from username.
960pub fn getUserInfo(name: []const u8) !UserInfo {960pub fn getUserInfo(name: []const u8) !UserInfo {
961 return switch (builtin.os.tag) {961 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),
963 else => @compileError("Unsupported OS"),974 else => @compileError("Unsupported OS"),
964 };975 };
965}976}
lib/std/target.zig+11-2
...@@ -58,6 +58,7 @@ pub const Target = struct {...@@ -58,6 +58,7 @@ pub const Target = struct {
58 glsl450,58 glsl450,
59 vulkan,59 vulkan,
60 plan9,60 plan9,
61 illumos,
61 other,62 other,
6263
63 pub inline fn isDarwin(tag: Tag) bool {64 pub inline fn isDarwin(tag: Tag) bool {
...@@ -74,6 +75,10 @@ pub const Target = struct {...@@ -74,6 +75,10 @@ pub const Target = struct {
74 };75 };
75 }76 }
7677
78 pub inline fn isSolarish(tag: Tag) bool {
79 return tag == .solaris or tag == .illumos;
80 }
81
77 pub fn dynamicLibSuffix(tag: Tag) [:0]const u8 {82 pub fn dynamicLibSuffix(tag: Tag) [:0]const u8 {
78 if (tag.isDarwin()) {83 if (tag.isDarwin()) {
79 return ".dylib";84 return ".dylib";
...@@ -326,7 +331,7 @@ pub const Target = struct {...@@ -326,7 +331,7 @@ pub const Target = struct {
326 .max = .{ .major = 6, .minor = 4, .patch = 0 },331 .max = .{ .major = 6, .minor = 4, .patch = 0 },
327 },332 },
328 },333 },
329 .solaris => return .{334 .solaris, .illumos => return .{
330 .semver = .{335 .semver = .{
331 .min = .{ .major = 5, .minor = 11, .patch = 0 },336 .min = .{ .major = 5, .minor = 11, .patch = 0 },
332 .max = .{ .major = 5, .minor = 11, .patch = 0 },337 .max = .{ .major = 5, .minor = 11, .patch = 0 },
...@@ -376,6 +381,7 @@ pub const Target = struct {...@@ -376,6 +381,7 @@ pub const Target = struct {
376 .openbsd,381 .openbsd,
377 .dragonfly,382 .dragonfly,
378 .solaris,383 .solaris,
384 .illumos,
379 => return TaggedVersionRange{ .semver = self.version_range.semver },385 => return TaggedVersionRange{ .semver = self.version_range.semver },
380386
381 else => return .none,387 else => return .none,
...@@ -409,6 +415,7 @@ pub const Target = struct {...@@ -409,6 +415,7 @@ pub const Target = struct {
409 .openbsd,415 .openbsd,
410 .haiku,416 .haiku,
411 .solaris,417 .solaris,
418 .illumos,
412 => true,419 => true,
413420
414 .linux,421 .linux,
...@@ -569,6 +576,7 @@ pub const Target = struct {...@@ -569,6 +576,7 @@ pub const Target = struct {
569 .shadermodel,576 .shadermodel,
570 .liteos, // TODO: audit this577 .liteos, // TODO: audit this
571 .solaris,578 .solaris,
579 .illumos,
572 => return .none,580 => return .none,
573 }581 }
574 }582 }
...@@ -1575,7 +1583,7 @@ pub const Target = struct {...@@ -1575,7 +1583,7 @@ pub const Target = struct {
1575 .netbsd => return copy(&result, "/libexec/ld.elf_so"),1583 .netbsd => return copy(&result, "/libexec/ld.elf_so"),
1576 .openbsd => return copy(&result, "/usr/libexec/ld.so"),1584 .openbsd => return copy(&result, "/usr/libexec/ld.so"),
1577 .dragonfly => return copy(&result, "/libexec/ld-elf.so.2"),1585 .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"),
1579 .linux => switch (self.cpu.arch) {1587 .linux => switch (self.cpu.arch) {
1580 .x86,1588 .x86,
1581 .sparc,1589 .sparc,
...@@ -2115,6 +2123,7 @@ pub const Target = struct {...@@ -2115,6 +2123,7 @@ pub const Target = struct {
2115 .emscripten,2123 .emscripten,
2116 .plan9,2124 .plan9,
2117 .solaris,2125 .solaris,
2126 .illumos,
2118 .haiku,2127 .haiku,
2119 .ananas,2128 .ananas,
2120 .fuchsia,2129 .fuchsia,
lib/std/zig/CrossTarget.zig+2
...@@ -111,6 +111,7 @@ fn updateOsVersionRange(self: *CrossTarget, os: Target.Os) void {...@@ -111,6 +111,7 @@ fn updateOsVersionRange(self: *CrossTarget, os: Target.Os) void {
111 .kfreebsd,111 .kfreebsd,
112 .lv2,112 .lv2,
113 .solaris,113 .solaris,
114 .illumos,
114 .zos,115 .zos,
115 .haiku,116 .haiku,
116 .minix,117 .minix,
...@@ -709,6 +710,7 @@ fn parseOs(result: *CrossTarget, diags: *ParseOptions.Diagnostics, text: []const...@@ -709,6 +710,7 @@ fn parseOs(result: *CrossTarget, diags: *ParseOptions.Diagnostics, text: []const
709 .kfreebsd,710 .kfreebsd,
710 .lv2,711 .lv2,
711 .solaris,712 .solaris,
713 .illumos,
712 .zos,714 .zos,
713 .haiku,715 .haiku,
714 .minix,716 .minix,
lib/std/zig/system/NativePaths.zig+1-1
...@@ -89,7 +89,7 @@ pub fn detect(arena: Allocator, native_info: NativeTargetInfo) !NativePaths {...@@ -89,7 +89,7 @@ pub fn detect(arena: Allocator, native_info: NativeTargetInfo) !NativePaths {
89 return self;89 return self;
90 }90 }
9191
92 if (builtin.os.tag == .solaris) {92 if (builtin.os.tag.isSolarish()) {
93 try self.addLibDir("/usr/lib/64");93 try self.addLibDir("/usr/lib/64");
94 try self.addLibDir("/usr/local/lib/64");94 try self.addLibDir("/usr/local/lib/64");
95 try self.addLibDir("/lib/64");95 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 {...@@ -51,7 +51,7 @@ pub fn detect(cross_target: CrossTarget) DetectError!NativeTargetInfo {
51 error.InvalidVersion => {},51 error.InvalidVersion => {},
52 }52 }
53 },53 },
54 .solaris => {54 .solaris, .illumos => {
55 const uts = std.os.uname();55 const uts = std.os.uname();
56 const release = mem.sliceTo(&uts.release, 0);56 const release = mem.sliceTo(&uts.release, 0);
57 if (std.SemanticVersion.parse(release)) |ver| {57 if (std.SemanticVersion.parse(release)) |ver| {
...@@ -257,12 +257,12 @@ fn detectAbiAndDynamicLinker(...@@ -257,12 +257,12 @@ fn detectAbiAndDynamicLinker(
257) DetectError!NativeTargetInfo {257) DetectError!NativeTargetInfo {
258 const native_target_has_ld = comptime builtin.target.hasDynamicLinker();258 const native_target_has_ld = comptime builtin.target.hasDynamicLinker();
259 const is_linux = builtin.target.os.tag == .linux;259 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();
261 const have_all_info = cross_target.dynamic_linker.get() != null and261 const have_all_info = cross_target.dynamic_linker.get() != null and
262 cross_target.abi != null and (!is_linux or cross_target.abi.?.isGnu());262 cross_target.abi != null and (!is_linux or cross_target.abi.?.isGnu());
263 const os_is_non_native = cross_target.os_tag != null;263 const os_is_non_native = cross_target.os_tag != null;
264 // The Solaris/illumos environment is always the same.264 // 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) {
266 return defaultAbiAndDynamicLinker(cpu, os, cross_target);266 return defaultAbiAndDynamicLinker(cpu, os, cross_target);
267 }267 }
268 if (cross_target.abi) |abi| {268 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 {...@@ -120,7 +120,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {
120 .lv2 => "lv2",120 .lv2 => "lv2",
121 .netbsd => "netbsd",121 .netbsd => "netbsd",
122 .openbsd => "openbsd",122 .openbsd => "openbsd",
123 .solaris => "solaris",123 .solaris, .illumos => "solaris",
124 .windows => "windows",124 .windows => "windows",
125 .zos => "zos",125 .zos => "zos",
126 .haiku => "haiku",126 .haiku => "haiku",
...@@ -231,7 +231,7 @@ pub fn targetOs(os_tag: std.Target.Os.Tag) llvm.OSType {...@@ -231,7 +231,7 @@ pub fn targetOs(os_tag: std.Target.Os.Tag) llvm.OSType {
231 .macos => .MacOSX,231 .macos => .MacOSX,
232 .netbsd => .NetBSD,232 .netbsd => .NetBSD,
233 .openbsd => .OpenBSD,233 .openbsd => .OpenBSD,
234 .solaris => .Solaris,234 .solaris, .illumos => .Solaris,
235 .zos => .ZOS,235 .zos => .ZOS,
236 .haiku => .Haiku,236 .haiku => .Haiku,
237 .minix => .Minix,237 .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...@@ -190,7 +190,7 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any
190 .freebsd, .macos => @intFromPtr(info.addr),190 .freebsd, .macos => @intFromPtr(info.addr),
191 .netbsd => @intFromPtr(info.info.reason.fault.addr),191 .netbsd => @intFromPtr(info.info.reason.fault.addr),
192 .openbsd => @intFromPtr(info.data.fault.addr),192 .openbsd => @intFromPtr(info.data.fault.addr),
193 .solaris => @intFromPtr(info.reason.fault.addr),193 .solaris, .illumos => @intFromPtr(info.reason.fault.addr),
194 else => @compileError("TODO implement handleSegfaultPosix for new POSIX OS"),194 else => @compileError("TODO implement handleSegfaultPosix for new POSIX OS"),
195 };195 };
196196
src/libc_installation.zig+2-3
...@@ -213,9 +213,8 @@ pub const LibCInstallation = struct {...@@ -213,9 +213,8 @@ pub const LibCInstallation = struct {
213 try self.findNativeIncludeDirPosix(args);213 try self.findNativeIncludeDirPosix(args);
214 try self.findNativeCrtBeginDirHaiku(args);214 try self.findNativeCrtBeginDirHaiku(args);
215 self.crt_dir = try args.allocator.dupeZ(u8, "/system/develop/lib");215 self.crt_dir = try args.allocator.dupeZ(u8, "/system/develop/lib");
216 } else if (builtin.target.os.tag == .solaris) {216 } else if (builtin.target.os.tag.isSolarish()) {
217 // There is only one libc in illumos, and its headers and217 // There is only one libc, and its headers/libraries are always in the same spot.
218 // libraries are always in the same spot.
219 self.include_dir = try args.allocator.dupeZ(u8, "/usr/include");218 self.include_dir = try args.allocator.dupeZ(u8, "/usr/include");
220 self.sys_include_dir = try args.allocator.dupeZ(u8, "/usr/include");219 self.sys_include_dir = try args.allocator.dupeZ(u8, "/usr/include");
221 self.crt_dir = try args.allocator.dupeZ(u8, "/usr/lib/64");220 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 {...@@ -150,7 +150,7 @@ pub fn buildLibCXX(comp: *Compilation, prog_node: *std.Progress.Node) !void {
150150
151 if (std.mem.startsWith(u8, cxx_src, "src/support/win32/") and target.os.tag != .windows)151 if (std.mem.startsWith(u8, cxx_src, "src/support/win32/") and target.os.tag != .windows)
152 continue;152 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())
154 continue;154 continue;
155 if (std.mem.startsWith(u8, cxx_src, "src/support/ibm/") and target.os.tag != .zos)155 if (std.mem.startsWith(u8, cxx_src, "src/support/ibm/") and target.os.tag != .zos)
156 continue;156 continue;
src/link/Elf.zig+1-1
...@@ -3818,7 +3818,7 @@ const CsuObjects = struct {...@@ -3818,7 +3818,7 @@ const CsuObjects = struct {
3818 .static_pie => result.set( "start_dyn.o", "crti.o", "crtbeginS.o", "crtendS.o", "crtn.o" ),3818 .static_pie => result.set( "start_dyn.o", "crti.o", "crtbeginS.o", "crtendS.o", "crtn.o" ),
3819 // zig fmt: on3819 // zig fmt: on
3820 },3820 },
3821 .solaris => switch (mode) {3821 .solaris, .illumos => switch (mode) {
3822 // zig fmt: off3822 // zig fmt: off
3823 .dynamic_lib => result.set( null, "crti.o", null, null, "crtn.o" ),3823 .dynamic_lib => result.set( null, "crti.o", null, null, "crtn.o" ),
3824 .dynamic_exe,3824 .dynamic_exe,
src/target.zig+2-2
...@@ -218,7 +218,7 @@ pub fn hasValgrindSupport(target: std.Target) bool {...@@ -218,7 +218,7 @@ pub fn hasValgrindSupport(target: std.Target) bool {
218 .aarch64_32,218 .aarch64_32,
219 .aarch64_be,219 .aarch64_be,
220 => {220 => {
221 return target.os.tag == .linux or target.os.tag == .solaris or221 return target.os.tag == .linux or target.os.tag == .solaris or target.os.tag == .illumos or
222 (target.os.tag == .windows and target.abi != .msvc);222 (target.os.tag == .windows and target.abi != .msvc);
223 },223 },
224 else => return false,224 else => return false,
...@@ -493,7 +493,7 @@ pub fn libcFullLinkFlags(target: std.Target) []const []const u8 {...@@ -493,7 +493,7 @@ pub fn libcFullLinkFlags(target: std.Target) []const []const u8 {
493 "-lc",493 "-lc",
494 "-lutil",494 "-lutil",
495 },495 },
496 .solaris => &[_][]const u8{496 .solaris, .illumos => &[_][]const u8{
497 "-lm",497 "-lm",
498 "-lsocket",498 "-lsocket",
499 "-lnsl",499 "-lnsl",