From f0724229d6e39931e0cd6aad1b060608a2879fc3 Mon Sep 17 00:00:00 2001 From: Ryan Zezeski Date: Tue, 26 Sep 2023 15:49:55 -0600 Subject: [PATCH 01/11] solaris: add missing registers --- lib/std/c/solaris.zig | 14 ++++++++++++++ lib/std/dwarf/abi.zig | 5 ++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/std/c/solaris.zig b/lib/std/c/solaris.zig index 58d02416cb..b7549e4441 100644 --- a/lib/std/c/solaris.zig +++ b/lib/std/c/solaris.zig @@ -1069,7 +1069,21 @@ pub const mcontext_t = extern struct { }; pub const REG = struct { + pub const R15 = 0; + pub const R14 = 1; + pub const R13 = 2; + pub const R12 = 3; + pub const R11 = 4; + pub const R10 = 5; + pub const R9 = 6; + pub const R8 = 7; + pub const RDI = 8; + pub const RSI = 9; pub const RBP = 10; + pub const RBX = 11; + pub const RDX = 12; + pub const RCX = 13; + pub const RAX = 14; pub const RIP = 17; pub const RSP = 20; }; diff --git a/lib/std/dwarf/abi.zig b/lib/std/dwarf/abi.zig index b097fd8b15..e1784b2b28 100644 --- a/lib/std/dwarf/abi.zig +++ b/lib/std/dwarf/abi.zig @@ -247,7 +247,10 @@ pub fn regBytes( 14 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.R14]), 15 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.R15]), 16 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RIP]), - 17...32 => |i| mem.asBytes(&ucontext_ptr.mcontext.fpregs.xmm[i - 17]), + 17...32 => |i| if (builtin.os.tag == .solaris) + mem.asBytes(&ucontext_ptr.mcontext.fpregs.chip_state.xmm[i - 17]) + else + mem.asBytes(&ucontext_ptr.mcontext.fpregs.xmm[i - 17]), else => error.InvalidRegister, }, .freebsd => switch (reg_number) { From ea92789c62869b49a9b884adcfb24f44ad626f7c Mon Sep 17 00:00:00 2001 From: Ryan Zezeski Date: Tue, 26 Sep 2023 15:52:35 -0600 Subject: [PATCH 02/11] solaris: ld does not have stack-size option --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e692feb421..b8bb6825f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -758,6 +758,9 @@ else() set(ZIG2_LINK_FLAGS "-Wl,-stack_size,0x10000000") elseif(MINGW) set(ZIG2_LINK_FLAGS "-Wl,--stack,0x10000000") + # Solaris/illumos ld(1) does not provide a --stack-size option. + elseif(CMAKE_HOST_SOLARIS) + unset(ZIG2_LINK_FLAGS) else() set(ZIG2_LINK_FLAGS "-Wl,-z,stack-size=0x10000000") endif() @@ -830,7 +833,7 @@ add_custom_command( add_executable(zig2 ${ZIG2_C_SOURCE} ${ZIG_COMPILER_RT_C_SOURCE}) set_target_properties(zig2 PROPERTIES COMPILE_FLAGS ${ZIG2_COMPILE_FLAGS} - LINK_FLAGS ${ZIG2_LINK_FLAGS} + LINK_FLAGS "${ZIG2_LINK_FLAGS}" ) target_include_directories(zig2 PUBLIC "${CMAKE_SOURCE_DIR}/stage1") target_link_libraries(zig2 LINK_PUBLIC zigcpp) From b447441a916f8d64f560994504de3552707b32be Mon Sep 17 00:00:00 2001 From: Ryan Zezeski Date: Tue, 26 Sep 2023 15:59:24 -0600 Subject: [PATCH 03/11] solaris: link libstdc++ --- build.zig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.zig b/build.zig index 8777060a89..be96b78435 100644 --- a/build.zig +++ b/build.zig @@ -670,6 +670,10 @@ fn addCmakeCfgOptionsToExe( try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes); } }, + .solaris => { + try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes); + try addCxxKnownPath(b, cfg, exe, b.fmt("libgcc_eh.{s}", .{lib_suffix}), null, need_cpp_includes); + }, else => {}, } } From a0ed2c69b06a55d86b9ca98314f31bd70058e3f8 Mon Sep 17 00:00:00 2001 From: Ryan Zezeski Date: Tue, 26 Sep 2023 16:02:04 -0600 Subject: [PATCH 04/11] solaris: hard-code native libc paths On illumos (and Solaris) there is, by design, only one libc. --- src/libc_installation.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libc_installation.zig b/src/libc_installation.zig index c13de5a8e2..b8855e73d2 100644 --- a/src/libc_installation.zig +++ b/src/libc_installation.zig @@ -213,11 +213,16 @@ pub const LibCInstallation = struct { try self.findNativeIncludeDirPosix(args); try self.findNativeCrtBeginDirHaiku(args); self.crt_dir = try args.allocator.dupeZ(u8, "/system/develop/lib"); + } else if (builtin.target.os.tag == .solaris) { + // There is only one libc in illumos, and its headers and + // libraries are always in the same spot. + self.include_dir = try args.allocator.dupeZ(u8, "/usr/include"); + self.sys_include_dir = try args.allocator.dupeZ(u8, "/usr/include"); + self.crt_dir = try args.allocator.dupeZ(u8, "/usr/lib/64"); } else if (std.process.can_spawn) { try self.findNativeIncludeDirPosix(args); switch (builtin.target.os.tag) { .freebsd, .netbsd, .openbsd, .dragonfly => self.crt_dir = try args.allocator.dupeZ(u8, "/usr/lib"), - .solaris => self.crt_dir = try args.allocator.dupeZ(u8, "/usr/lib/64"), .linux => try self.findNativeCrtDirPosix(args), else => {}, } From c17ebdca6afef9523a69caeaea090cd537d71945 Mon Sep 17 00:00:00 2001 From: Ryan Zezeski Date: Tue, 26 Sep 2023 16:03:21 -0600 Subject: [PATCH 05/11] solaris: fix path component max --- lib/std/c/solaris.zig | 1 + lib/std/fs.zig | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/std/c/solaris.zig b/lib/std/c/solaris.zig index b7549e4441..3ec8c3aa97 100644 --- a/lib/std/c/solaris.zig +++ b/lib/std/c/solaris.zig @@ -498,6 +498,7 @@ pub const NI = struct { pub const MAXSERV = 32; }; +pub const NAME_MAX = 255; pub const PATH_MAX = 1024; pub const IOV_MAX = 1024; diff --git a/lib/std/fs.zig b/lib/std/fs.zig index 2429243dda..ab887251fb 100644 --- a/lib/std/fs.zig +++ b/lib/std/fs.zig @@ -59,10 +59,9 @@ pub const MAX_PATH_BYTES = switch (builtin.os.tag) { /// (depending on the platform) this assumption may not hold for every configuration. /// The byte count does not include a null sentinel byte. pub const MAX_NAME_BYTES = switch (builtin.os.tag) { - .linux, .macos, .ios, .freebsd, .openbsd, .netbsd, .dragonfly => os.NAME_MAX, + .linux, .macos, .ios, .freebsd, .openbsd, .netbsd, .dragonfly, .solaris => os.NAME_MAX, // Haiku's NAME_MAX includes the null terminator, so subtract one. .haiku => os.NAME_MAX - 1, - .solaris => os.system.MAXNAMLEN, // Each UTF-16LE character may be expanded to 3 UTF-8 bytes. // If it would require 4 UTF-8 bytes, then there would be a surrogate // pair in the UTF-16LE, and we (over)account 3 bytes for it that way. From 68bcd7ddd44422b228852cd36158048becfbeea8 Mon Sep 17 00:00:00 2001 From: Ryan Zezeski Date: Tue, 26 Sep 2023 16:05:24 -0600 Subject: [PATCH 06/11] solaris: load CA certs file --- lib/std/crypto/Certificate/Bundle.zig | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/std/crypto/Certificate/Bundle.zig b/lib/std/crypto/Certificate/Bundle.zig index 3e28d12d06..ad08f9ad19 100644 --- a/lib/std/crypto/Certificate/Bundle.zig +++ b/lib/std/crypto/Certificate/Bundle.zig @@ -64,6 +64,7 @@ pub fn rescan(cb: *Bundle, gpa: Allocator) RescanError!void { .netbsd => return rescanBSD(cb, gpa, "/etc/openssl/certs/ca-certificates.crt"), .dragonfly => return rescanBSD(cb, gpa, "/usr/local/etc/ssl/cert.pem"), .windows => return rescanWindows(cb, gpa), + .solaris => return rescanSolaris(cb, gpa, "/etc/ssl/cacert.pem"), else => {}, } } @@ -151,6 +152,15 @@ fn rescanWindows(cb: *Bundle, gpa: Allocator) RescanWindowsError!void { cb.bytes.shrinkAndFree(gpa, cb.bytes.items.len); } +const RescanSolarisError = AddCertsFromFilePathError; + +fn rescanSolaris(cb: *Bundle, gpa: Allocator, cert_file_path: []const u8) RescanSolarisError!void { + cb.bytes.clearRetainingCapacity(); + cb.map.clearRetainingCapacity(); + try addCertsFromFilePathAbsolute(cb, gpa, cert_file_path); + cb.bytes.shrinkAndFree(gpa, cb.bytes.items.len); +} + pub const AddCertsFromDirPathError = fs.File.OpenError || AddCertsFromDirError; pub fn addCertsFromDirPath( From 54ad5f31c6efd150406111620a14e56cf1bae1cd Mon Sep 17 00:00:00 2001 From: Ryan Zezeski Date: Tue, 26 Sep 2023 16:15:00 -0600 Subject: [PATCH 07/11] solaris: hard-code ABI and dynamic linker Solaris/illumos is multi-lib, so you can't rely on an arbitrary executable to give you the correct dynamic linker. Besides, it's always the same path. --- lib/std/target.zig | 4 ++-- lib/std/zig/system/NativeTargetInfo.zig | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/std/target.zig b/lib/std/target.zig index d17ec332e4..cf5a03d03d 100644 --- a/lib/std/target.zig +++ b/lib/std/target.zig @@ -526,7 +526,6 @@ pub const Target = struct { .cloudabi, .dragonfly, .lv2, - .solaris, .zos, .minix, .rtems, @@ -569,6 +568,7 @@ pub const Target = struct { .driverkit, .shadermodel, .liteos, // TODO: audit this + .solaris, => return .none, } } @@ -1575,7 +1575,7 @@ pub const Target = struct { .netbsd => return copy(&result, "/libexec/ld.elf_so"), .openbsd => return copy(&result, "/usr/libexec/ld.so"), .dragonfly => return copy(&result, "/libexec/ld-elf.so.2"), - .solaris => return copy(&result, "/lib/64/ld.so.1"), + .solaris => return copy(&result, "/usr/lib/amd64/ld.so.1"), .linux => switch (self.cpu.arch) { .x86, .sparc, diff --git a/lib/std/zig/system/NativeTargetInfo.zig b/lib/std/zig/system/NativeTargetInfo.zig index 9f0892c800..221f43b5bf 100644 --- a/lib/std/zig/system/NativeTargetInfo.zig +++ b/lib/std/zig/system/NativeTargetInfo.zig @@ -257,10 +257,12 @@ fn detectAbiAndDynamicLinker( ) DetectError!NativeTargetInfo { const native_target_has_ld = comptime builtin.target.hasDynamicLinker(); const is_linux = builtin.target.os.tag == .linux; + const is_solaris = builtin.target.os.tag == .solaris; const have_all_info = cross_target.dynamic_linker.get() != null and cross_target.abi != null and (!is_linux or cross_target.abi.?.isGnu()); const os_is_non_native = cross_target.os_tag != null; - if (!native_target_has_ld or have_all_info or os_is_non_native) { + // The Solaris/illumos environment is always the same. + if (!native_target_has_ld or have_all_info or os_is_non_native or is_solaris) { return defaultAbiAndDynamicLinker(cpu, os, cross_target); } if (cross_target.abi) |abi| { From 51fa7ef1c43c2b159cfba15ee06cd6f3fab3e556 Mon Sep 17 00:00:00 2001 From: Stephen Gregoratto Date: Sat, 30 Sep 2023 19:33:37 +1000 Subject: [PATCH 08/11] solaris: set correct target tuple in CMake --- CMakeLists.txt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b8bb6825f2..b57bc8ea23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -705,9 +705,20 @@ target_link_libraries(zigcpp LINK_PUBLIC ${CMAKE_THREAD_LIBS_INIT} ) +string(TOLOWER "${CMAKE_HOST_SYSTEM_NAME}" ZIG_HOST_TARGET_OS) +if(ZIG_HOST_TARGET_OS STREQUAL "darwin") + set(ZIG_HOST_TARGET_OS "macos") +elseif(ZIG_HOST_TARGET_OS STREQUAL "sunos") + set(ZIG_HOST_TARGET_OS "solaris") +endif() + string(TOLOWER "${CMAKE_HOST_SYSTEM_PROCESSOR}" ZIG_HOST_TARGET_ARCH) if(ZIG_HOST_TARGET_ARCH MATCHES "^i[3-9]86$") - set(ZIG_HOST_TARGET_ARCH "x86") + if (ZIG_HOST_TARGET_OS STREQUAL "solaris") + set(ZIG_HOST_TARGET_ARCH "x86_64") + else() + set(ZIG_HOST_TARGET_ARCH "x86") + endif() elseif(ZIG_HOST_TARGET_ARCH STREQUAL "amd64") set(ZIG_HOST_TARGET_ARCH "x86_64") elseif(ZIG_HOST_TARGET_ARCH STREQUAL "arm64") @@ -727,11 +738,6 @@ if(ZIG_HOST_TARGET_ARCH MATCHES "^arm(hf?)?(eb)?$") endif() string(REGEX REPLACE "^ppc((64)?(le)?)$" "powerpc\\1" ZIG_HOST_TARGET_ARCH "${ZIG_HOST_TARGET_ARCH}") -string(TOLOWER "${CMAKE_HOST_SYSTEM_NAME}" ZIG_HOST_TARGET_OS) -if(ZIG_HOST_TARGET_OS STREQUAL "darwin") - set(ZIG_HOST_TARGET_OS "macos") -endif() - if(MSVC) set(ZIG_HOST_TARGET_ABI "-msvc") elseif(MINGW) From 285970982a662ae1882858ab8076b8c20609b9bb Mon Sep 17 00:00:00 2001 From: Stephen Gregoratto Date: Sun, 1 Oct 2023 23:09:14 +1100 Subject: [PATCH 09/11] 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 --- CMakeLists.txt | 11 ++++++++--- build.zig | 6 +++--- lib/std/Thread.zig | 8 ++++---- lib/std/c.zig | 2 +- lib/std/crypto/Certificate/Bundle.zig | 2 +- lib/std/crypto/tlcsprng.zig | 1 + lib/std/debug.zig | 6 ++++-- lib/std/dwarf/abi.zig | 10 +++++----- lib/std/dynamic_library.zig | 4 ++-- lib/std/fs.zig | 13 +++++++------ lib/std/fs/file.zig | 4 ++-- lib/std/fs/get_app_data_dir.zig | 2 +- lib/std/os.zig | 6 ++++-- lib/std/os/test.zig | 10 +++++----- lib/std/process.zig | 13 ++++++++++++- lib/std/target.zig | 13 +++++++++++-- lib/std/zig/CrossTarget.zig | 2 ++ lib/std/zig/system/NativePaths.zig | 2 +- lib/std/zig/system/NativeTargetInfo.zig | 6 +++--- src/codegen/llvm.zig | 4 ++-- src/crash_report.zig | 2 +- src/libc_installation.zig | 5 ++--- src/libcxx.zig | 2 +- src/link/Elf.zig | 2 +- src/target.zig | 4 ++-- 25 files changed, 86 insertions(+), 54 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b57bc8ea23..d71d8f2d3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 3.5) +include(CheckSymbolExists) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING @@ -709,12 +710,17 @@ string(TOLOWER "${CMAKE_HOST_SYSTEM_NAME}" ZIG_HOST_TARGET_OS) if(ZIG_HOST_TARGET_OS STREQUAL "darwin") set(ZIG_HOST_TARGET_OS "macos") elseif(ZIG_HOST_TARGET_OS STREQUAL "sunos") - set(ZIG_HOST_TARGET_OS "solaris") + check_symbol_exists(__illumos__ "" ZIG_HOST_TARGET_HAS_ILLUMOS_MACRO) + if (ZIG_HOST_TARGET_HAS_ILLUMOS_MACRO) + set(ZIG_HOST_TARGET_OS "illumos") + else() + set(ZIG_HOST_TARGET_OS "solaris") + endif() endif() string(TOLOWER "${CMAKE_HOST_SYSTEM_PROCESSOR}" ZIG_HOST_TARGET_ARCH) if(ZIG_HOST_TARGET_ARCH MATCHES "^i[3-9]86$") - if (ZIG_HOST_TARGET_OS STREQUAL "solaris") + if (ZIG_HOST_TARGET_OS MATCHES "(solaris|illumos)") set(ZIG_HOST_TARGET_ARCH "x86_64") else() set(ZIG_HOST_TARGET_ARCH "x86") @@ -730,7 +736,6 @@ elseif(ZIG_HOST_TARGET_ARCH STREQUAL "armv7b") endif() string(REGEX REPLACE "^((arm|thumb)(hf?)?)el$" "\\1" ZIG_HOST_TARGET_ARCH "${ZIG_HOST_TARGET_ARCH}") if(ZIG_HOST_TARGET_ARCH MATCHES "^arm(hf?)?(eb)?$") - include(CheckSymbolExists) check_symbol_exists(__thumb__ "" ZIG_HOST_TARGET_DEFAULTS_TO_THUMB) if(ZIG_HOST_TARGET_DEFAULTS_TO_THUMB) string(REGEX REPLACE "^arm" "thumb" ZIG_HOST_TARGET_ARCH "${ZIG_HOST_TARGET_ARCH}") diff --git a/build.zig b/build.zig index be96b78435..6fa5665c19 100644 --- a/build.zig +++ b/build.zig @@ -670,9 +670,9 @@ fn addCmakeCfgOptionsToExe( try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes); } }, - .solaris => { - try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes); - try addCxxKnownPath(b, cfg, exe, b.fmt("libgcc_eh.{s}", .{lib_suffix}), null, need_cpp_includes); + .solaris, .illumos => { + try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes); + try addCxxKnownPath(b, cfg, exe, b.fmt("libgcc_eh.{s}", .{lib_suffix}), null, need_cpp_includes); }, else => {}, } diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig index 74f8e98df4..5ede51022d 100644 --- a/lib/std/Thread.zig +++ b/lib/std/Thread.zig @@ -43,7 +43,7 @@ pub const max_name_len = switch (target.os.tag) { .freebsd => 15, .openbsd => 23, .dragonfly => 1023, - .solaris => 31, + .solaris, .illumos => 31, else => 0, }; @@ -123,7 +123,7 @@ pub fn setName(self: Thread, name: []const u8) SetNameError!void { else => |e| return os.unexpectedErrno(e), } }, - .netbsd, .solaris => if (use_pthreads) { + .netbsd, .solaris, .illumos => if (use_pthreads) { const err = std.c.pthread_setname_np(self.getHandle(), name_with_terminator.ptr, null); switch (err) { .SUCCESS => return, @@ -229,7 +229,7 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co else => |e| return os.unexpectedErrno(e), } }, - .netbsd, .solaris => if (use_pthreads) { + .netbsd, .solaris, .illumos => if (use_pthreads) { const err = std.c.pthread_getname_np(self.getHandle(), buffer.ptr, max_name_len + 1); switch (err) { .SUCCESS => return std.mem.sliceTo(buffer, 0), @@ -636,7 +636,7 @@ const PosixThreadImpl = struct { }; return @as(usize, @intCast(count)); }, - .solaris => { + .solaris, .illumos => { // The "proper" way to get the cpu count would be to query // /dev/kstat via ioctls, and traverse a linked list for each // cpu. diff --git a/lib/std/c.zig b/lib/std/c.zig index bbfbc51633..7d4a9b782f 100644 --- a/lib/std/c.zig +++ b/lib/std/c.zig @@ -49,7 +49,7 @@ pub usingnamespace switch (builtin.os.tag) { .openbsd => @import("c/openbsd.zig"), .haiku => @import("c/haiku.zig"), .hermit => @import("c/hermit.zig"), - .solaris => @import("c/solaris.zig"), + .solaris, .illumos => @import("c/solaris.zig"), .fuchsia => @import("c/fuchsia.zig"), .minix => @import("c/minix.zig"), .emscripten => @import("c/emscripten.zig"), diff --git a/lib/std/crypto/Certificate/Bundle.zig b/lib/std/crypto/Certificate/Bundle.zig index ad08f9ad19..152c5c28cc 100644 --- a/lib/std/crypto/Certificate/Bundle.zig +++ b/lib/std/crypto/Certificate/Bundle.zig @@ -64,7 +64,7 @@ pub fn rescan(cb: *Bundle, gpa: Allocator) RescanError!void { .netbsd => return rescanBSD(cb, gpa, "/etc/openssl/certs/ca-certificates.crt"), .dragonfly => return rescanBSD(cb, gpa, "/usr/local/etc/ssl/cert.pem"), .windows => return rescanWindows(cb, gpa), - .solaris => return rescanSolaris(cb, gpa, "/etc/ssl/cacert.pem"), + .solaris, .illumos => return rescanSolaris(cb, gpa, "/etc/ssl/cacert.pem"), else => {}, } } diff --git a/lib/std/crypto/tlcsprng.zig b/lib/std/crypto/tlcsprng.zig index 344da9745d..e6c6b56f13 100644 --- a/lib/std/crypto/tlcsprng.zig +++ b/lib/std/crypto/tlcsprng.zig @@ -25,6 +25,7 @@ const os_has_fork = switch (builtin.os.tag) { .netbsd, .openbsd, .solaris, + .illumos, .tvos, .watchos, .haiku, diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 38a4631711..95bc8d0eaf 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -990,6 +990,7 @@ pub fn openSelfDebugInfo(allocator: mem.Allocator) OpenSelfDebugInfoError!DebugI .openbsd, .macos, .solaris, + .illumos, .windows, => return try DebugInfo.init(allocator), else => return error.UnsupportedOperatingSystem, @@ -2228,7 +2229,7 @@ pub const ModuleDebugInfo = switch (native_os) { }; } }, - .linux, .netbsd, .freebsd, .dragonfly, .openbsd, .haiku, .solaris => struct { + .linux, .netbsd, .freebsd, .dragonfly, .openbsd, .haiku, .solaris, .illumos => struct { base_address: usize, dwarf: DW.DwarfInfo, mapped_memory: []align(mem.page_size) const u8, @@ -2313,6 +2314,7 @@ pub const have_segfault_handling_support = switch (native_os) { .macos, .netbsd, .solaris, + .illumos, .windows, => true, @@ -2386,7 +2388,7 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any .freebsd, .macos => @intFromPtr(info.addr), .netbsd => @intFromPtr(info.info.reason.fault.addr), .openbsd => @intFromPtr(info.data.fault.addr), - .solaris => @intFromPtr(info.reason.fault.addr), + .solaris, .illumos => @intFromPtr(info.reason.fault.addr), else => unreachable, }; diff --git a/lib/std/dwarf/abi.zig b/lib/std/dwarf/abi.zig index e1784b2b28..a5319bfa6e 100644 --- a/lib/std/dwarf/abi.zig +++ b/lib/std/dwarf/abi.zig @@ -6,11 +6,11 @@ const mem = std.mem; pub fn supportsUnwinding(target: std.Target) bool { return switch (target.cpu.arch) { .x86 => switch (target.os.tag) { - .linux, .netbsd, .solaris => true, + .linux, .netbsd, .solaris, .illumos => true, else => false, }, .x86_64 => switch (target.os.tag) { - .linux, .netbsd, .freebsd, .openbsd, .macos, .ios, .solaris => true, + .linux, .netbsd, .freebsd, .openbsd, .macos, .ios, .solaris, .illumos => true, else => false, }, .arm => switch (target.os.tag) { @@ -194,7 +194,7 @@ pub fn regBytes( const ucontext_ptr = thread_context_ptr; return switch (builtin.cpu.arch) { .x86 => switch (builtin.os.tag) { - .linux, .netbsd, .solaris => switch (reg_number) { + .linux, .netbsd, .solaris, .illumos => switch (reg_number) { 0 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.EAX]), 1 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.ECX]), 2 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.EDX]), @@ -229,7 +229,7 @@ pub fn regBytes( else => error.UnimplementedOs, }, .x86_64 => switch (builtin.os.tag) { - .linux, .solaris => switch (reg_number) { + .linux, .solaris, .illumos => switch (reg_number) { 0 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RAX]), 1 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RDX]), 2 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RCX]), @@ -247,7 +247,7 @@ pub fn regBytes( 14 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.R14]), 15 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.R15]), 16 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RIP]), - 17...32 => |i| if (builtin.os.tag == .solaris) + 17...32 => |i| if (builtin.os.tag.isSolarish()) mem.asBytes(&ucontext_ptr.mcontext.fpregs.chip_state.xmm[i - 17]) else mem.asBytes(&ucontext_ptr.mcontext.fpregs.xmm[i - 17]), diff --git a/lib/std/dynamic_library.zig b/lib/std/dynamic_library.zig index 9b061fa92b..50421997fb 100644 --- a/lib/std/dynamic_library.zig +++ b/lib/std/dynamic_library.zig @@ -10,7 +10,7 @@ const system = std.os.system; pub const DynLib = switch (builtin.os.tag) { .linux => if (builtin.link_libc) DlDynlib else ElfDynLib, .windows => WindowsDynLib, - .macos, .tvos, .watchos, .ios, .freebsd, .netbsd, .openbsd, .dragonfly, .solaris => DlDynlib, + .macos, .tvos, .watchos, .ios, .freebsd, .netbsd, .openbsd, .dragonfly, .solaris, .illumos => DlDynlib, else => void, }; @@ -388,7 +388,7 @@ pub const DlDynlib = struct { test "dynamic_library" { const libname = switch (builtin.os.tag) { - .linux, .freebsd, .openbsd => "invalid_so.so", + .linux, .freebsd, .openbsd, .solaris, .illumos => "invalid_so.so", .windows => "invalid_dll.dll", .macos, .tvos, .watchos, .ios => "invalid_dylib.dylib", else => return error.SkipZigTest, diff --git a/lib/std/fs.zig b/lib/std/fs.zig index ab887251fb..77af754ff5 100644 --- a/lib/std/fs.zig +++ b/lib/std/fs.zig @@ -39,7 +39,7 @@ pub const Watch = @import("fs/watch.zig").Watch; /// fit into a UTF-8 encoded array of this length. /// The byte count includes room for a null sentinel byte. pub const MAX_PATH_BYTES = switch (builtin.os.tag) { - .linux, .macos, .ios, .freebsd, .openbsd, .netbsd, .dragonfly, .haiku, .solaris, .plan9 => os.PATH_MAX, + .linux, .macos, .ios, .freebsd, .openbsd, .netbsd, .dragonfly, .haiku, .solaris, .illumos, .plan9 => os.PATH_MAX, // Each UTF-16LE character may be expanded to 3 UTF-8 bytes. // If it would require 4 UTF-8 bytes, then there would be a surrogate // 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) { /// (depending on the platform) this assumption may not hold for every configuration. /// The byte count does not include a null sentinel byte. pub const MAX_NAME_BYTES = switch (builtin.os.tag) { - .linux, .macos, .ios, .freebsd, .openbsd, .netbsd, .dragonfly, .solaris => os.NAME_MAX, + .linux, .macos, .ios, .freebsd, .openbsd, .netbsd, .dragonfly, .solaris, .illumos => os.NAME_MAX, // Haiku's NAME_MAX includes the null terminator, so subtract one. .haiku => os.NAME_MAX - 1, // Each UTF-16LE character may be expanded to 3 UTF-8 bytes. @@ -325,7 +325,7 @@ pub const IterableDir = struct { const IteratorError = error{ AccessDenied, SystemResources } || os.UnexpectedError; pub const Iterator = switch (builtin.os.tag) { - .macos, .ios, .freebsd, .netbsd, .dragonfly, .openbsd, .solaris => struct { + .macos, .ios, .freebsd, .netbsd, .dragonfly, .openbsd, .solaris, .illumos => struct { dir: Dir, seek: i64, buf: [1024]u8, // TODO align(@alignOf(os.system.dirent)), @@ -343,7 +343,7 @@ pub const IterableDir = struct { switch (builtin.os.tag) { .macos, .ios => return self.nextDarwin(), .freebsd, .netbsd, .dragonfly, .openbsd => return self.nextBsd(), - .solaris => return self.nextSolaris(), + .solaris, .illumos => return self.nextSolaris(), else => @compileError("unimplemented"), } } @@ -897,6 +897,7 @@ pub const IterableDir = struct { .dragonfly, .openbsd, .solaris, + .illumos, => return Iterator{ .dir = self.dir, .seek = 0, @@ -1840,7 +1841,7 @@ pub const Dir = struct { error.AccessDenied => |e| switch (builtin.os.tag) { // non-Linux POSIX systems return EPERM when trying to delete a directory, so // we need to handle that case specifically and translate the error - .macos, .ios, .freebsd, .netbsd, .dragonfly, .openbsd, .solaris => { + .macos, .ios, .freebsd, .netbsd, .dragonfly, .openbsd, .solaris, .illumos => { // Don't follow symlinks to match unlinkat (which acts on symlinks rather than follows them) const fstat = os.fstatatZ(self.fd, sub_path_c, os.AT.SYMLINK_NOFOLLOW) catch return e; const is_dir = fstat.mode & os.S.IFMT == os.S.IFDIR; @@ -3004,7 +3005,7 @@ pub fn selfExePath(out_buffer: []u8) SelfExePathError![]u8 { } switch (builtin.os.tag) { .linux => return os.readlinkZ("/proc/self/exe", out_buffer), - .solaris => return os.readlinkZ("/proc/self/path/a.out", out_buffer), + .solaris, .illumos => return os.readlinkZ("/proc/self/path/a.out", out_buffer), .freebsd, .dragonfly => { var mib = [4]c_int{ os.CTL.KERN, os.KERN.PROC, os.KERN.PROC_PATHNAME, -1 }; var out_len: usize = out_buffer.len; diff --git a/lib/std/fs/file.zig b/lib/std/fs/file.zig index 99946f2fae..c19a19a3d3 100644 --- a/lib/std/fs/file.zig +++ b/lib/std/fs/file.zig @@ -359,7 +359,7 @@ pub const File = struct { os.S.IFSOCK => break :blk .unix_domain_socket, else => {}, } - if (builtin.os.tag == .solaris) switch (m) { + if (builtin.os.tag.isSolarish()) switch (m) { os.S.IFDOOR => break :blk .door, os.S.IFPORT => break :blk .event_port, else => {}, @@ -685,7 +685,7 @@ pub const File = struct { else => {}, } - if (builtin.os.tag == .solaris) switch (m) { + if (builtin.os.tag.isSolarish()) switch (m) { os.S.IFDOOR => return .door, os.S.IFPORT => return .event_port, else => {}, diff --git a/lib/std/fs/get_app_data_dir.zig b/lib/std/fs/get_app_data_dir.zig index 2f599c3213..c35a97d84e 100644 --- a/lib/std/fs/get_app_data_dir.zig +++ b/lib/std/fs/get_app_data_dir.zig @@ -44,7 +44,7 @@ pub fn getAppDataDir(allocator: mem.Allocator, appname: []const u8) GetAppDataDi }; return fs.path.join(allocator, &[_][]const u8{ home_dir, "Library", "Application Support", appname }); }, - .linux, .freebsd, .netbsd, .dragonfly, .openbsd, .solaris => { + .linux, .freebsd, .netbsd, .dragonfly, .openbsd, .solaris, .illumos => { if (os.getenv("XDG_DATA_HOME")) |xdg| { return fs.path.join(allocator, &[_][]const u8{ xdg, appname }); } diff --git a/lib/std/os.zig b/lib/std/os.zig index 565546c281..b0c37b7c64 100644 --- a/lib/std/os.zig +++ b/lib/std/os.zig @@ -33,6 +33,7 @@ pub const haiku = std.c; pub const netbsd = std.c; pub const openbsd = std.c; pub const solaris = std.c; +pub const illumos = std.c; pub const linux = @import("os/linux.zig"); pub const plan9 = @import("os/plan9.zig"); pub const uefi = @import("os/uefi.zig"); @@ -1821,7 +1822,7 @@ pub fn execveZ( .BADARCH => return error.InvalidExe, else => return unexpectedErrno(err), }, - .linux, .solaris => switch (err) { + .linux => switch (err) { .LIBBAD => return error.InvalidExe, else => return unexpectedErrno(err), }, @@ -5226,6 +5227,7 @@ pub fn isGetFdPathSupportedOnTarget(os: std.Target.Os) bool { .macos, .ios, .watchos, .tvos, .linux, .solaris, + .illumos, .freebsd, => true, // zig fmt: on @@ -5280,7 +5282,7 @@ pub fn getFdPath(fd: fd_t, out_buffer: *[MAX_PATH_BYTES]u8) RealPathError![]u8 { }; return target; }, - .solaris => { + .solaris, .illumos => { var procfs_buf: ["/proc/self/path/-2147483648\x00".len]u8 = undefined; const proc_path = std.fmt.bufPrintZ(procfs_buf[0..], "/proc/self/path/{d}", .{fd}) catch unreachable; diff --git a/lib/std/os/test.zig b/lib/std/os/test.zig index 58acb33de5..c74733cd93 100644 --- a/lib/std/os/test.zig +++ b/lib/std/os/test.zig @@ -234,7 +234,7 @@ test "link with relative paths" { if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest; switch (native_os) { - .wasi, .linux, .solaris => {}, + .wasi, .linux, .solaris, .illumos => {}, else => return error.SkipZigTest, } if (true) { @@ -277,7 +277,7 @@ test "linkat with different directories" { if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest; switch (native_os) { - .wasi, .linux, .solaris => {}, + .wasi, .linux, .solaris, .illumos => {}, else => return error.SkipZigTest, } if (true) { @@ -706,7 +706,7 @@ test "fcntl" { test "signalfd" { switch (native_os) { - .linux, .solaris => {}, + .linux, .solaris, .illumos => {}, else => return error.SkipZigTest, } _ = &os.signalfd; @@ -732,7 +732,7 @@ test "sync" { test "fsync" { switch (native_os) { - .linux, .windows, .solaris => {}, + .linux, .windows, .solaris, .illumos => {}, else => return error.SkipZigTest, } @@ -870,7 +870,7 @@ test "sigaction" { test "dup & dup2" { switch (native_os) { - .linux, .solaris => {}, + .linux, .solaris, .illumos => {}, else => return error.SkipZigTest, } diff --git a/lib/std/process.zig b/lib/std/process.zig index fe5a44d3ad..a7f9d8d9d8 100644 --- a/lib/std/process.zig +++ b/lib/std/process.zig @@ -959,7 +959,18 @@ pub const UserInfo = struct { /// POSIX function which gets a uid from username. pub fn getUserInfo(name: []const u8) !UserInfo { return switch (builtin.os.tag) { - .linux, .macos, .watchos, .tvos, .ios, .freebsd, .netbsd, .openbsd, .haiku, .solaris => posixGetUserInfo(name), + .linux, + .macos, + .watchos, + .tvos, + .ios, + .freebsd, + .netbsd, + .openbsd, + .haiku, + .solaris, + .illumos, + => posixGetUserInfo(name), else => @compileError("Unsupported OS"), }; } diff --git a/lib/std/target.zig b/lib/std/target.zig index cf5a03d03d..de3055af69 100644 --- a/lib/std/target.zig +++ b/lib/std/target.zig @@ -58,6 +58,7 @@ pub const Target = struct { glsl450, vulkan, plan9, + illumos, other, pub inline fn isDarwin(tag: Tag) bool { @@ -74,6 +75,10 @@ pub const Target = struct { }; } + pub inline fn isSolarish(tag: Tag) bool { + return tag == .solaris or tag == .illumos; + } + pub fn dynamicLibSuffix(tag: Tag) [:0]const u8 { if (tag.isDarwin()) { return ".dylib"; @@ -326,7 +331,7 @@ pub const Target = struct { .max = .{ .major = 6, .minor = 4, .patch = 0 }, }, }, - .solaris => return .{ + .solaris, .illumos => return .{ .semver = .{ .min = .{ .major = 5, .minor = 11, .patch = 0 }, .max = .{ .major = 5, .minor = 11, .patch = 0 }, @@ -376,6 +381,7 @@ pub const Target = struct { .openbsd, .dragonfly, .solaris, + .illumos, => return TaggedVersionRange{ .semver = self.version_range.semver }, else => return .none, @@ -409,6 +415,7 @@ pub const Target = struct { .openbsd, .haiku, .solaris, + .illumos, => true, .linux, @@ -569,6 +576,7 @@ pub const Target = struct { .shadermodel, .liteos, // TODO: audit this .solaris, + .illumos, => return .none, } } @@ -1575,7 +1583,7 @@ pub const Target = struct { .netbsd => return copy(&result, "/libexec/ld.elf_so"), .openbsd => return copy(&result, "/usr/libexec/ld.so"), .dragonfly => return copy(&result, "/libexec/ld-elf.so.2"), - .solaris => return copy(&result, "/usr/lib/amd64/ld.so.1"), + .solaris, .illumos => return copy(&result, "/usr/lib/64/ld.so.1"), .linux => switch (self.cpu.arch) { .x86, .sparc, @@ -2115,6 +2123,7 @@ pub const Target = struct { .emscripten, .plan9, .solaris, + .illumos, .haiku, .ananas, .fuchsia, diff --git a/lib/std/zig/CrossTarget.zig b/lib/std/zig/CrossTarget.zig index 61195758ce..cf3d109edb 100644 --- a/lib/std/zig/CrossTarget.zig +++ b/lib/std/zig/CrossTarget.zig @@ -111,6 +111,7 @@ fn updateOsVersionRange(self: *CrossTarget, os: Target.Os) void { .kfreebsd, .lv2, .solaris, + .illumos, .zos, .haiku, .minix, @@ -709,6 +710,7 @@ fn parseOs(result: *CrossTarget, diags: *ParseOptions.Diagnostics, text: []const .kfreebsd, .lv2, .solaris, + .illumos, .zos, .haiku, .minix, diff --git a/lib/std/zig/system/NativePaths.zig b/lib/std/zig/system/NativePaths.zig index b2608a2c5e..af3243fc10 100644 --- a/lib/std/zig/system/NativePaths.zig +++ b/lib/std/zig/system/NativePaths.zig @@ -89,7 +89,7 @@ pub fn detect(arena: Allocator, native_info: NativeTargetInfo) !NativePaths { return self; } - if (builtin.os.tag == .solaris) { + if (builtin.os.tag.isSolarish()) { try self.addLibDir("/usr/lib/64"); try self.addLibDir("/usr/local/lib/64"); try self.addLibDir("/lib/64"); diff --git a/lib/std/zig/system/NativeTargetInfo.zig b/lib/std/zig/system/NativeTargetInfo.zig index 221f43b5bf..6691e0f3cb 100644 --- a/lib/std/zig/system/NativeTargetInfo.zig +++ b/lib/std/zig/system/NativeTargetInfo.zig @@ -51,7 +51,7 @@ pub fn detect(cross_target: CrossTarget) DetectError!NativeTargetInfo { error.InvalidVersion => {}, } }, - .solaris => { + .solaris, .illumos => { const uts = std.os.uname(); const release = mem.sliceTo(&uts.release, 0); if (std.SemanticVersion.parse(release)) |ver| { @@ -257,12 +257,12 @@ fn detectAbiAndDynamicLinker( ) DetectError!NativeTargetInfo { const native_target_has_ld = comptime builtin.target.hasDynamicLinker(); const is_linux = builtin.target.os.tag == .linux; - const is_solaris = builtin.target.os.tag == .solaris; + const is_solarish = builtin.target.os.tag.isSolarish(); const have_all_info = cross_target.dynamic_linker.get() != null and cross_target.abi != null and (!is_linux or cross_target.abi.?.isGnu()); const os_is_non_native = cross_target.os_tag != null; // The Solaris/illumos environment is always the same. - if (!native_target_has_ld or have_all_info or os_is_non_native or is_solaris) { + if (!native_target_has_ld or have_all_info or os_is_non_native or is_solarish) { return defaultAbiAndDynamicLinker(cpu, os, cross_target); } if (cross_target.abi) |abi| { diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 4e6f7733fe..79bab6b4bc 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -120,7 +120,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 { .lv2 => "lv2", .netbsd => "netbsd", .openbsd => "openbsd", - .solaris => "solaris", + .solaris, .illumos => "solaris", .windows => "windows", .zos => "zos", .haiku => "haiku", @@ -231,7 +231,7 @@ pub fn targetOs(os_tag: std.Target.Os.Tag) llvm.OSType { .macos => .MacOSX, .netbsd => .NetBSD, .openbsd => .OpenBSD, - .solaris => .Solaris, + .solaris, .illumos => .Solaris, .zos => .ZOS, .haiku => .Haiku, .minix => .Minix, diff --git a/src/crash_report.zig b/src/crash_report.zig index 82be4211c7..d4e4b46a53 100644 --- a/src/crash_report.zig +++ b/src/crash_report.zig @@ -190,7 +190,7 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any .freebsd, .macos => @intFromPtr(info.addr), .netbsd => @intFromPtr(info.info.reason.fault.addr), .openbsd => @intFromPtr(info.data.fault.addr), - .solaris => @intFromPtr(info.reason.fault.addr), + .solaris, .illumos => @intFromPtr(info.reason.fault.addr), else => @compileError("TODO implement handleSegfaultPosix for new POSIX OS"), }; diff --git a/src/libc_installation.zig b/src/libc_installation.zig index b8855e73d2..c93377c321 100644 --- a/src/libc_installation.zig +++ b/src/libc_installation.zig @@ -213,9 +213,8 @@ pub const LibCInstallation = struct { try self.findNativeIncludeDirPosix(args); try self.findNativeCrtBeginDirHaiku(args); self.crt_dir = try args.allocator.dupeZ(u8, "/system/develop/lib"); - } else if (builtin.target.os.tag == .solaris) { - // There is only one libc in illumos, and its headers and - // libraries are always in the same spot. + } else if (builtin.target.os.tag.isSolarish()) { + // There is only one libc, and its headers/libraries are always in the same spot. self.include_dir = try args.allocator.dupeZ(u8, "/usr/include"); self.sys_include_dir = try args.allocator.dupeZ(u8, "/usr/include"); self.crt_dir = try args.allocator.dupeZ(u8, "/usr/lib/64"); diff --git a/src/libcxx.zig b/src/libcxx.zig index a75a4098b2..0c39469b69 100644 --- a/src/libcxx.zig +++ b/src/libcxx.zig @@ -150,7 +150,7 @@ pub fn buildLibCXX(comp: *Compilation, prog_node: *std.Progress.Node) !void { if (std.mem.startsWith(u8, cxx_src, "src/support/win32/") and target.os.tag != .windows) continue; - if (std.mem.startsWith(u8, cxx_src, "src/support/solaris/") and target.os.tag != .solaris) + if (std.mem.startsWith(u8, cxx_src, "src/support/solaris/") and !target.os.tag.isSolarish()) continue; if (std.mem.startsWith(u8, cxx_src, "src/support/ibm/") and target.os.tag != .zos) continue; diff --git a/src/link/Elf.zig b/src/link/Elf.zig index 4e43a20433..8e214da1bc 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -3818,7 +3818,7 @@ const CsuObjects = struct { .static_pie => result.set( "start_dyn.o", "crti.o", "crtbeginS.o", "crtendS.o", "crtn.o" ), // zig fmt: on }, - .solaris => switch (mode) { + .solaris, .illumos => switch (mode) { // zig fmt: off .dynamic_lib => result.set( null, "crti.o", null, null, "crtn.o" ), .dynamic_exe, diff --git a/src/target.zig b/src/target.zig index 59a7a48cf9..c137166543 100644 --- a/src/target.zig +++ b/src/target.zig @@ -218,7 +218,7 @@ pub fn hasValgrindSupport(target: std.Target) bool { .aarch64_32, .aarch64_be, => { - return target.os.tag == .linux or target.os.tag == .solaris or + return target.os.tag == .linux or target.os.tag == .solaris or target.os.tag == .illumos or (target.os.tag == .windows and target.abi != .msvc); }, else => return false, @@ -493,7 +493,7 @@ pub fn libcFullLinkFlags(target: std.Target) []const []const u8 { "-lc", "-lutil", }, - .solaris => &[_][]const u8{ + .solaris, .illumos => &[_][]const u8{ "-lm", "-lsocket", "-lnsl", From 42ad3e265ca8befd1d509c94c3a937e0c8402280 Mon Sep 17 00:00:00 2001 From: Ryan Zezeski Date: Mon, 2 Oct 2023 16:20:08 -0600 Subject: [PATCH 10/11] illumos does not have versions The 5.11 in uname is not something that is ever updated. There is no versioning of the illumos system in general. Illumos prefers to rely on feature detection. I can't say what Solaris does these days as I do not work at Oracle; so I left it alone. --- lib/std/target.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/std/target.zig b/lib/std/target.zig index de3055af69..af7679010f 100644 --- a/lib/std/target.zig +++ b/lib/std/target.zig @@ -271,6 +271,7 @@ pub const Target = struct { .glsl450, // TODO: GLSL versions .vulkan, .plan9, + .illumos, .other, => return .{ .none = {} }, @@ -331,7 +332,7 @@ pub const Target = struct { .max = .{ .major = 6, .minor = 4, .patch = 0 }, }, }, - .solaris, .illumos => return .{ + .solaris => return .{ .semver = .{ .min = .{ .major = 5, .minor = 11, .patch = 0 }, .max = .{ .major = 5, .minor = 11, .patch = 0 }, @@ -381,7 +382,6 @@ pub const Target = struct { .openbsd, .dragonfly, .solaris, - .illumos, => return TaggedVersionRange{ .semver = self.version_range.semver }, else => return .none, From dd026588d081c639f59696bb1e2f0998f0f10f11 Mon Sep 17 00:00:00 2001 From: Ryan Zezeski Date: Mon, 2 Oct 2023 16:37:37 -0600 Subject: [PATCH 11/11] illumos: fix dynamic linker path --- lib/std/target.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/target.zig b/lib/std/target.zig index af7679010f..45681c1ac2 100644 --- a/lib/std/target.zig +++ b/lib/std/target.zig @@ -1583,7 +1583,7 @@ pub const Target = struct { .netbsd => return copy(&result, "/libexec/ld.elf_so"), .openbsd => return copy(&result, "/usr/libexec/ld.so"), .dragonfly => return copy(&result, "/libexec/ld-elf.so.2"), - .solaris, .illumos => return copy(&result, "/usr/lib/64/ld.so.1"), + .solaris, .illumos => return copy(&result, "/lib/64/ld.so.1"), .linux => switch (self.cpu.arch) { .x86, .sparc,