mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
Merge pull request #17341 from rzezeski/illumos-updates
Illumos/Solaris updates
This commit is contained in:
commit
7733894761
@ -1,4 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.5)
|
||||||
|
include(CheckSymbolExists)
|
||||||
|
|
||||||
if(NOT CMAKE_BUILD_TYPE)
|
if(NOT CMAKE_BUILD_TYPE)
|
||||||
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
|
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
|
||||||
@ -706,9 +707,25 @@ target_link_libraries(zigcpp LINK_PUBLIC
|
|||||||
${CMAKE_THREAD_LIBS_INIT}
|
${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")
|
||||||
|
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)
|
string(TOLOWER "${CMAKE_HOST_SYSTEM_PROCESSOR}" ZIG_HOST_TARGET_ARCH)
|
||||||
if(ZIG_HOST_TARGET_ARCH MATCHES "^i[3-9]86$")
|
if(ZIG_HOST_TARGET_ARCH MATCHES "^i[3-9]86$")
|
||||||
set(ZIG_HOST_TARGET_ARCH "x86")
|
if (ZIG_HOST_TARGET_OS MATCHES "(solaris|illumos)")
|
||||||
|
set(ZIG_HOST_TARGET_ARCH "x86_64")
|
||||||
|
else()
|
||||||
|
set(ZIG_HOST_TARGET_ARCH "x86")
|
||||||
|
endif()
|
||||||
elseif(ZIG_HOST_TARGET_ARCH STREQUAL "amd64")
|
elseif(ZIG_HOST_TARGET_ARCH STREQUAL "amd64")
|
||||||
set(ZIG_HOST_TARGET_ARCH "x86_64")
|
set(ZIG_HOST_TARGET_ARCH "x86_64")
|
||||||
elseif(ZIG_HOST_TARGET_ARCH STREQUAL "arm64")
|
elseif(ZIG_HOST_TARGET_ARCH STREQUAL "arm64")
|
||||||
@ -720,7 +737,6 @@ elseif(ZIG_HOST_TARGET_ARCH STREQUAL "armv7b")
|
|||||||
endif()
|
endif()
|
||||||
string(REGEX REPLACE "^((arm|thumb)(hf?)?)el$" "\\1" ZIG_HOST_TARGET_ARCH "${ZIG_HOST_TARGET_ARCH}")
|
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)?$")
|
if(ZIG_HOST_TARGET_ARCH MATCHES "^arm(hf?)?(eb)?$")
|
||||||
include(CheckSymbolExists)
|
|
||||||
check_symbol_exists(__thumb__ "" ZIG_HOST_TARGET_DEFAULTS_TO_THUMB)
|
check_symbol_exists(__thumb__ "" ZIG_HOST_TARGET_DEFAULTS_TO_THUMB)
|
||||||
if(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}")
|
string(REGEX REPLACE "^arm" "thumb" ZIG_HOST_TARGET_ARCH "${ZIG_HOST_TARGET_ARCH}")
|
||||||
@ -728,11 +744,6 @@ if(ZIG_HOST_TARGET_ARCH MATCHES "^arm(hf?)?(eb)?$")
|
|||||||
endif()
|
endif()
|
||||||
string(REGEX REPLACE "^ppc((64)?(le)?)$" "powerpc\\1" ZIG_HOST_TARGET_ARCH "${ZIG_HOST_TARGET_ARCH}")
|
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)
|
if(MSVC)
|
||||||
set(ZIG_HOST_TARGET_ABI "-msvc")
|
set(ZIG_HOST_TARGET_ABI "-msvc")
|
||||||
elseif(MINGW)
|
elseif(MINGW)
|
||||||
@ -759,6 +770,9 @@ else()
|
|||||||
set(ZIG2_LINK_FLAGS "-Wl,-stack_size,0x10000000")
|
set(ZIG2_LINK_FLAGS "-Wl,-stack_size,0x10000000")
|
||||||
elseif(MINGW)
|
elseif(MINGW)
|
||||||
set(ZIG2_LINK_FLAGS "-Wl,--stack,0x10000000")
|
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()
|
else()
|
||||||
set(ZIG2_LINK_FLAGS "-Wl,-z,stack-size=0x10000000")
|
set(ZIG2_LINK_FLAGS "-Wl,-z,stack-size=0x10000000")
|
||||||
endif()
|
endif()
|
||||||
@ -832,7 +846,7 @@ add_custom_command(
|
|||||||
add_executable(zig2 ${ZIG2_C_SOURCE} ${ZIG_COMPILER_RT_C_SOURCE})
|
add_executable(zig2 ${ZIG2_C_SOURCE} ${ZIG_COMPILER_RT_C_SOURCE})
|
||||||
set_target_properties(zig2 PROPERTIES
|
set_target_properties(zig2 PROPERTIES
|
||||||
COMPILE_FLAGS ${ZIG2_COMPILE_FLAGS}
|
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_include_directories(zig2 PUBLIC "${CMAKE_SOURCE_DIR}/stage1")
|
||||||
target_link_libraries(zig2 LINK_PUBLIC zigcpp)
|
target_link_libraries(zig2 LINK_PUBLIC zigcpp)
|
||||||
|
|||||||
@ -673,6 +673,10 @@ fn addCmakeCfgOptionsToExe(
|
|||||||
try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes);
|
try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{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 => {},
|
else => {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,7 +43,7 @@ pub const max_name_len = switch (target.os.tag) {
|
|||||||
.freebsd => 15,
|
.freebsd => 15,
|
||||||
.openbsd => 23,
|
.openbsd => 23,
|
||||||
.dragonfly => 1023,
|
.dragonfly => 1023,
|
||||||
.solaris => 31,
|
.solaris, .illumos => 31,
|
||||||
else => 0,
|
else => 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ pub fn setName(self: Thread, name: []const u8) SetNameError!void {
|
|||||||
else => |e| return os.unexpectedErrno(e),
|
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);
|
const err = std.c.pthread_setname_np(self.getHandle(), name_with_terminator.ptr, null);
|
||||||
switch (err) {
|
switch (err) {
|
||||||
.SUCCESS => return,
|
.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),
|
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);
|
const err = std.c.pthread_getname_np(self.getHandle(), buffer.ptr, max_name_len + 1);
|
||||||
switch (err) {
|
switch (err) {
|
||||||
.SUCCESS => return std.mem.sliceTo(buffer, 0),
|
.SUCCESS => return std.mem.sliceTo(buffer, 0),
|
||||||
@ -636,7 +636,7 @@ const PosixThreadImpl = struct {
|
|||||||
};
|
};
|
||||||
return @as(usize, @intCast(count));
|
return @as(usize, @intCast(count));
|
||||||
},
|
},
|
||||||
.solaris => {
|
.solaris, .illumos => {
|
||||||
// The "proper" way to get the cpu count would be to query
|
// The "proper" way to get the cpu count would be to query
|
||||||
// /dev/kstat via ioctls, and traverse a linked list for each
|
// /dev/kstat via ioctls, and traverse a linked list for each
|
||||||
// cpu.
|
// cpu.
|
||||||
|
|||||||
@ -49,7 +49,7 @@ pub usingnamespace switch (builtin.os.tag) {
|
|||||||
.openbsd => @import("c/openbsd.zig"),
|
.openbsd => @import("c/openbsd.zig"),
|
||||||
.haiku => @import("c/haiku.zig"),
|
.haiku => @import("c/haiku.zig"),
|
||||||
.hermit => @import("c/hermit.zig"),
|
.hermit => @import("c/hermit.zig"),
|
||||||
.solaris => @import("c/solaris.zig"),
|
.solaris, .illumos => @import("c/solaris.zig"),
|
||||||
.fuchsia => @import("c/fuchsia.zig"),
|
.fuchsia => @import("c/fuchsia.zig"),
|
||||||
.minix => @import("c/minix.zig"),
|
.minix => @import("c/minix.zig"),
|
||||||
.emscripten => @import("c/emscripten.zig"),
|
.emscripten => @import("c/emscripten.zig"),
|
||||||
|
|||||||
@ -498,6 +498,7 @@ pub const NI = struct {
|
|||||||
pub const MAXSERV = 32;
|
pub const MAXSERV = 32;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pub const NAME_MAX = 255;
|
||||||
pub const PATH_MAX = 1024;
|
pub const PATH_MAX = 1024;
|
||||||
pub const IOV_MAX = 1024;
|
pub const IOV_MAX = 1024;
|
||||||
|
|
||||||
@ -1069,7 +1070,21 @@ pub const mcontext_t = extern struct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
pub const REG = 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 RBP = 10;
|
||||||
|
pub const RBX = 11;
|
||||||
|
pub const RDX = 12;
|
||||||
|
pub const RCX = 13;
|
||||||
|
pub const RAX = 14;
|
||||||
pub const RIP = 17;
|
pub const RIP = 17;
|
||||||
pub const RSP = 20;
|
pub const RSP = 20;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -64,6 +64,7 @@ pub fn rescan(cb: *Bundle, gpa: Allocator) RescanError!void {
|
|||||||
.netbsd => return rescanBSD(cb, gpa, "/etc/openssl/certs/ca-certificates.crt"),
|
.netbsd => return rescanBSD(cb, gpa, "/etc/openssl/certs/ca-certificates.crt"),
|
||||||
.dragonfly => return rescanBSD(cb, gpa, "/usr/local/etc/ssl/cert.pem"),
|
.dragonfly => return rescanBSD(cb, gpa, "/usr/local/etc/ssl/cert.pem"),
|
||||||
.windows => return rescanWindows(cb, gpa),
|
.windows => return rescanWindows(cb, gpa),
|
||||||
|
.solaris, .illumos => return rescanSolaris(cb, gpa, "/etc/ssl/cacert.pem"),
|
||||||
else => {},
|
else => {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -151,6 +152,15 @@ fn rescanWindows(cb: *Bundle, gpa: Allocator) RescanWindowsError!void {
|
|||||||
cb.bytes.shrinkAndFree(gpa, cb.bytes.items.len);
|
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 const AddCertsFromDirPathError = fs.File.OpenError || AddCertsFromDirError;
|
||||||
|
|
||||||
pub fn addCertsFromDirPath(
|
pub fn addCertsFromDirPath(
|
||||||
|
|||||||
@ -25,6 +25,7 @@ const os_has_fork = switch (builtin.os.tag) {
|
|||||||
.netbsd,
|
.netbsd,
|
||||||
.openbsd,
|
.openbsd,
|
||||||
.solaris,
|
.solaris,
|
||||||
|
.illumos,
|
||||||
.tvos,
|
.tvos,
|
||||||
.watchos,
|
.watchos,
|
||||||
.haiku,
|
.haiku,
|
||||||
|
|||||||
@ -990,6 +990,7 @@ pub fn openSelfDebugInfo(allocator: mem.Allocator) OpenSelfDebugInfoError!DebugI
|
|||||||
.openbsd,
|
.openbsd,
|
||||||
.macos,
|
.macos,
|
||||||
.solaris,
|
.solaris,
|
||||||
|
.illumos,
|
||||||
.windows,
|
.windows,
|
||||||
=> return try DebugInfo.init(allocator),
|
=> return try DebugInfo.init(allocator),
|
||||||
else => return error.UnsupportedOperatingSystem,
|
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,
|
base_address: usize,
|
||||||
dwarf: DW.DwarfInfo,
|
dwarf: DW.DwarfInfo,
|
||||||
mapped_memory: []align(mem.page_size) const u8,
|
mapped_memory: []align(mem.page_size) const u8,
|
||||||
@ -2313,6 +2314,7 @@ pub const have_segfault_handling_support = switch (native_os) {
|
|||||||
.macos,
|
.macos,
|
||||||
.netbsd,
|
.netbsd,
|
||||||
.solaris,
|
.solaris,
|
||||||
|
.illumos,
|
||||||
.windows,
|
.windows,
|
||||||
=> true,
|
=> true,
|
||||||
|
|
||||||
@ -2386,7 +2388,7 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any
|
|||||||
.freebsd, .macos => @intFromPtr(info.addr),
|
.freebsd, .macos => @intFromPtr(info.addr),
|
||||||
.netbsd => @intFromPtr(info.info.reason.fault.addr),
|
.netbsd => @intFromPtr(info.info.reason.fault.addr),
|
||||||
.openbsd => @intFromPtr(info.data.fault.addr),
|
.openbsd => @intFromPtr(info.data.fault.addr),
|
||||||
.solaris => @intFromPtr(info.reason.fault.addr),
|
.solaris, .illumos => @intFromPtr(info.reason.fault.addr),
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -6,11 +6,11 @@ const mem = std.mem;
|
|||||||
pub fn supportsUnwinding(target: std.Target) bool {
|
pub fn supportsUnwinding(target: std.Target) bool {
|
||||||
return switch (target.cpu.arch) {
|
return switch (target.cpu.arch) {
|
||||||
.x86 => switch (target.os.tag) {
|
.x86 => switch (target.os.tag) {
|
||||||
.linux, .netbsd, .solaris => true,
|
.linux, .netbsd, .solaris, .illumos => true,
|
||||||
else => false,
|
else => false,
|
||||||
},
|
},
|
||||||
.x86_64 => switch (target.os.tag) {
|
.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,
|
else => false,
|
||||||
},
|
},
|
||||||
.arm => switch (target.os.tag) {
|
.arm => switch (target.os.tag) {
|
||||||
@ -194,7 +194,7 @@ pub fn regBytes(
|
|||||||
const ucontext_ptr = thread_context_ptr;
|
const ucontext_ptr = thread_context_ptr;
|
||||||
return switch (builtin.cpu.arch) {
|
return switch (builtin.cpu.arch) {
|
||||||
.x86 => switch (builtin.os.tag) {
|
.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]),
|
0 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.EAX]),
|
||||||
1 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.ECX]),
|
1 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.ECX]),
|
||||||
2 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.EDX]),
|
2 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.EDX]),
|
||||||
@ -229,7 +229,7 @@ pub fn regBytes(
|
|||||||
else => error.UnimplementedOs,
|
else => error.UnimplementedOs,
|
||||||
},
|
},
|
||||||
.x86_64 => switch (builtin.os.tag) {
|
.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]),
|
0 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RAX]),
|
||||||
1 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RDX]),
|
1 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RDX]),
|
||||||
2 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RCX]),
|
2 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RCX]),
|
||||||
@ -247,7 +247,10 @@ pub fn regBytes(
|
|||||||
14 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.R14]),
|
14 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.R14]),
|
||||||
15 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.R15]),
|
15 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.R15]),
|
||||||
16 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RIP]),
|
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.isSolarish())
|
||||||
|
mem.asBytes(&ucontext_ptr.mcontext.fpregs.chip_state.xmm[i - 17])
|
||||||
|
else
|
||||||
|
mem.asBytes(&ucontext_ptr.mcontext.fpregs.xmm[i - 17]),
|
||||||
else => error.InvalidRegister,
|
else => error.InvalidRegister,
|
||||||
},
|
},
|
||||||
.freebsd => switch (reg_number) {
|
.freebsd => switch (reg_number) {
|
||||||
|
|||||||
@ -10,7 +10,7 @@ const system = std.os.system;
|
|||||||
pub const DynLib = switch (builtin.os.tag) {
|
pub const DynLib = switch (builtin.os.tag) {
|
||||||
.linux => if (builtin.link_libc) DlDynlib else ElfDynLib,
|
.linux => if (builtin.link_libc) DlDynlib else ElfDynLib,
|
||||||
.windows => WindowsDynLib,
|
.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,
|
else => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -388,7 +388,7 @@ pub const DlDynlib = struct {
|
|||||||
|
|
||||||
test "dynamic_library" {
|
test "dynamic_library" {
|
||||||
const libname = switch (builtin.os.tag) {
|
const libname = switch (builtin.os.tag) {
|
||||||
.linux, .freebsd, .openbsd => "invalid_so.so",
|
.linux, .freebsd, .openbsd, .solaris, .illumos => "invalid_so.so",
|
||||||
.windows => "invalid_dll.dll",
|
.windows => "invalid_dll.dll",
|
||||||
.macos, .tvos, .watchos, .ios => "invalid_dylib.dylib",
|
.macos, .tvos, .watchos, .ios => "invalid_dylib.dylib",
|
||||||
else => return error.SkipZigTest,
|
else => return error.SkipZigTest,
|
||||||
|
|||||||
@ -39,7 +39,7 @@ pub const Watch = @import("fs/watch.zig").Watch;
|
|||||||
/// fit into a UTF-8 encoded array of this length.
|
/// fit into a UTF-8 encoded array of this length.
|
||||||
/// The byte count includes room for a null sentinel byte.
|
/// The byte count includes room for a null sentinel byte.
|
||||||
pub const MAX_PATH_BYTES = switch (builtin.os.tag) {
|
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.
|
// 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
|
// 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.
|
// pair in the UTF-16LE, and we (over)account 3 bytes for it that way.
|
||||||
@ -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.
|
/// (depending on the platform) this assumption may not hold for every configuration.
|
||||||
/// The byte count does not include a null sentinel byte.
|
/// The byte count does not include a null sentinel byte.
|
||||||
pub const MAX_NAME_BYTES = switch (builtin.os.tag) {
|
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, .illumos => os.NAME_MAX,
|
||||||
// Haiku's NAME_MAX includes the null terminator, so subtract one.
|
// Haiku's NAME_MAX includes the null terminator, so subtract one.
|
||||||
.haiku => os.NAME_MAX - 1,
|
.haiku => os.NAME_MAX - 1,
|
||||||
.solaris => os.system.MAXNAMLEN,
|
|
||||||
// Each UTF-16LE character may be expanded to 3 UTF-8 bytes.
|
// 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
|
// 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.
|
// pair in the UTF-16LE, and we (over)account 3 bytes for it that way.
|
||||||
@ -326,7 +325,7 @@ pub const IterableDir = struct {
|
|||||||
const IteratorError = error{ AccessDenied, SystemResources } || os.UnexpectedError;
|
const IteratorError = error{ AccessDenied, SystemResources } || os.UnexpectedError;
|
||||||
|
|
||||||
pub const Iterator = switch (builtin.os.tag) {
|
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,
|
dir: Dir,
|
||||||
seek: i64,
|
seek: i64,
|
||||||
buf: [1024]u8, // TODO align(@alignOf(os.system.dirent)),
|
buf: [1024]u8, // TODO align(@alignOf(os.system.dirent)),
|
||||||
@ -344,7 +343,7 @@ pub const IterableDir = struct {
|
|||||||
switch (builtin.os.tag) {
|
switch (builtin.os.tag) {
|
||||||
.macos, .ios => return self.nextDarwin(),
|
.macos, .ios => return self.nextDarwin(),
|
||||||
.freebsd, .netbsd, .dragonfly, .openbsd => return self.nextBsd(),
|
.freebsd, .netbsd, .dragonfly, .openbsd => return self.nextBsd(),
|
||||||
.solaris => return self.nextSolaris(),
|
.solaris, .illumos => return self.nextSolaris(),
|
||||||
else => @compileError("unimplemented"),
|
else => @compileError("unimplemented"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -898,6 +897,7 @@ pub const IterableDir = struct {
|
|||||||
.dragonfly,
|
.dragonfly,
|
||||||
.openbsd,
|
.openbsd,
|
||||||
.solaris,
|
.solaris,
|
||||||
|
.illumos,
|
||||||
=> return Iterator{
|
=> return Iterator{
|
||||||
.dir = self.dir,
|
.dir = self.dir,
|
||||||
.seek = 0,
|
.seek = 0,
|
||||||
@ -1841,7 +1841,7 @@ pub const Dir = struct {
|
|||||||
error.AccessDenied => |e| switch (builtin.os.tag) {
|
error.AccessDenied => |e| switch (builtin.os.tag) {
|
||||||
// non-Linux POSIX systems return EPERM when trying to delete a directory, so
|
// non-Linux POSIX systems return EPERM when trying to delete a directory, so
|
||||||
// we need to handle that case specifically and translate the error
|
// 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)
|
// 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 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;
|
const is_dir = fstat.mode & os.S.IFMT == os.S.IFDIR;
|
||||||
@ -3007,7 +3007,7 @@ pub fn selfExePath(out_buffer: []u8) SelfExePathError![]u8 {
|
|||||||
}
|
}
|
||||||
switch (builtin.os.tag) {
|
switch (builtin.os.tag) {
|
||||||
.linux => return os.readlinkZ("/proc/self/exe", out_buffer),
|
.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 => {
|
.freebsd, .dragonfly => {
|
||||||
var mib = [4]c_int{ os.CTL.KERN, os.KERN.PROC, os.KERN.PROC_PATHNAME, -1 };
|
var mib = [4]c_int{ os.CTL.KERN, os.KERN.PROC, os.KERN.PROC_PATHNAME, -1 };
|
||||||
var out_len: usize = out_buffer.len;
|
var out_len: usize = out_buffer.len;
|
||||||
|
|||||||
@ -359,7 +359,7 @@ pub const File = struct {
|
|||||||
os.S.IFSOCK => break :blk .unix_domain_socket,
|
os.S.IFSOCK => break :blk .unix_domain_socket,
|
||||||
else => {},
|
else => {},
|
||||||
}
|
}
|
||||||
if (builtin.os.tag == .solaris) switch (m) {
|
if (builtin.os.tag.isSolarish()) switch (m) {
|
||||||
os.S.IFDOOR => break :blk .door,
|
os.S.IFDOOR => break :blk .door,
|
||||||
os.S.IFPORT => break :blk .event_port,
|
os.S.IFPORT => break :blk .event_port,
|
||||||
else => {},
|
else => {},
|
||||||
@ -685,7 +685,7 @@ pub const File = struct {
|
|||||||
else => {},
|
else => {},
|
||||||
}
|
}
|
||||||
|
|
||||||
if (builtin.os.tag == .solaris) switch (m) {
|
if (builtin.os.tag.isSolarish()) switch (m) {
|
||||||
os.S.IFDOOR => return .door,
|
os.S.IFDOOR => return .door,
|
||||||
os.S.IFPORT => return .event_port,
|
os.S.IFPORT => return .event_port,
|
||||||
else => {},
|
else => {},
|
||||||
|
|||||||
@ -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 });
|
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| {
|
if (os.getenv("XDG_DATA_HOME")) |xdg| {
|
||||||
return fs.path.join(allocator, &[_][]const u8{ xdg, appname });
|
return fs.path.join(allocator, &[_][]const u8{ xdg, appname });
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,6 +33,7 @@ pub const haiku = std.c;
|
|||||||
pub const netbsd = std.c;
|
pub const netbsd = std.c;
|
||||||
pub const openbsd = std.c;
|
pub const openbsd = std.c;
|
||||||
pub const solaris = std.c;
|
pub const solaris = std.c;
|
||||||
|
pub const illumos = std.c;
|
||||||
pub const linux = @import("os/linux.zig");
|
pub const linux = @import("os/linux.zig");
|
||||||
pub const plan9 = @import("os/plan9.zig");
|
pub const plan9 = @import("os/plan9.zig");
|
||||||
pub const uefi = @import("os/uefi.zig");
|
pub const uefi = @import("os/uefi.zig");
|
||||||
@ -1821,7 +1822,7 @@ pub fn execveZ(
|
|||||||
.BADARCH => return error.InvalidExe,
|
.BADARCH => return error.InvalidExe,
|
||||||
else => return unexpectedErrno(err),
|
else => return unexpectedErrno(err),
|
||||||
},
|
},
|
||||||
.linux, .solaris => switch (err) {
|
.linux => switch (err) {
|
||||||
.LIBBAD => return error.InvalidExe,
|
.LIBBAD => return error.InvalidExe,
|
||||||
else => return unexpectedErrno(err),
|
else => return unexpectedErrno(err),
|
||||||
},
|
},
|
||||||
@ -5226,6 +5227,7 @@ pub fn isGetFdPathSupportedOnTarget(os: std.Target.Os) bool {
|
|||||||
.macos, .ios, .watchos, .tvos,
|
.macos, .ios, .watchos, .tvos,
|
||||||
.linux,
|
.linux,
|
||||||
.solaris,
|
.solaris,
|
||||||
|
.illumos,
|
||||||
.freebsd,
|
.freebsd,
|
||||||
=> true,
|
=> true,
|
||||||
// zig fmt: on
|
// zig fmt: on
|
||||||
@ -5280,7 +5282,7 @@ pub fn getFdPath(fd: fd_t, out_buffer: *[MAX_PATH_BYTES]u8) RealPathError![]u8 {
|
|||||||
};
|
};
|
||||||
return target;
|
return target;
|
||||||
},
|
},
|
||||||
.solaris => {
|
.solaris, .illumos => {
|
||||||
var procfs_buf: ["/proc/self/path/-2147483648\x00".len]u8 = undefined;
|
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;
|
const proc_path = std.fmt.bufPrintZ(procfs_buf[0..], "/proc/self/path/{d}", .{fd}) catch unreachable;
|
||||||
|
|
||||||
|
|||||||
@ -234,7 +234,7 @@ test "link with relative paths" {
|
|||||||
if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest;
|
if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest;
|
||||||
|
|
||||||
switch (native_os) {
|
switch (native_os) {
|
||||||
.wasi, .linux, .solaris => {},
|
.wasi, .linux, .solaris, .illumos => {},
|
||||||
else => return error.SkipZigTest,
|
else => return error.SkipZigTest,
|
||||||
}
|
}
|
||||||
if (true) {
|
if (true) {
|
||||||
@ -277,7 +277,7 @@ test "linkat with different directories" {
|
|||||||
if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest;
|
if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest;
|
||||||
|
|
||||||
switch (native_os) {
|
switch (native_os) {
|
||||||
.wasi, .linux, .solaris => {},
|
.wasi, .linux, .solaris, .illumos => {},
|
||||||
else => return error.SkipZigTest,
|
else => return error.SkipZigTest,
|
||||||
}
|
}
|
||||||
if (true) {
|
if (true) {
|
||||||
@ -706,7 +706,7 @@ test "fcntl" {
|
|||||||
|
|
||||||
test "signalfd" {
|
test "signalfd" {
|
||||||
switch (native_os) {
|
switch (native_os) {
|
||||||
.linux, .solaris => {},
|
.linux, .solaris, .illumos => {},
|
||||||
else => return error.SkipZigTest,
|
else => return error.SkipZigTest,
|
||||||
}
|
}
|
||||||
_ = &os.signalfd;
|
_ = &os.signalfd;
|
||||||
@ -732,7 +732,7 @@ test "sync" {
|
|||||||
|
|
||||||
test "fsync" {
|
test "fsync" {
|
||||||
switch (native_os) {
|
switch (native_os) {
|
||||||
.linux, .windows, .solaris => {},
|
.linux, .windows, .solaris, .illumos => {},
|
||||||
else => return error.SkipZigTest,
|
else => return error.SkipZigTest,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -870,7 +870,7 @@ test "sigaction" {
|
|||||||
|
|
||||||
test "dup & dup2" {
|
test "dup & dup2" {
|
||||||
switch (native_os) {
|
switch (native_os) {
|
||||||
.linux, .solaris => {},
|
.linux, .solaris, .illumos => {},
|
||||||
else => return error.SkipZigTest,
|
else => return error.SkipZigTest,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -959,7 +959,18 @@ pub const UserInfo = struct {
|
|||||||
/// POSIX function which gets a uid from username.
|
/// POSIX function which gets a uid from username.
|
||||||
pub fn getUserInfo(name: []const u8) !UserInfo {
|
pub fn getUserInfo(name: []const u8) !UserInfo {
|
||||||
return switch (builtin.os.tag) {
|
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"),
|
else => @compileError("Unsupported OS"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,6 +58,7 @@ pub const Target = struct {
|
|||||||
glsl450,
|
glsl450,
|
||||||
vulkan,
|
vulkan,
|
||||||
plan9,
|
plan9,
|
||||||
|
illumos,
|
||||||
other,
|
other,
|
||||||
|
|
||||||
pub inline fn isDarwin(tag: Tag) bool {
|
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 {
|
pub fn dynamicLibSuffix(tag: Tag) [:0]const u8 {
|
||||||
if (tag.isDarwin()) {
|
if (tag.isDarwin()) {
|
||||||
return ".dylib";
|
return ".dylib";
|
||||||
@ -266,6 +271,7 @@ pub const Target = struct {
|
|||||||
.glsl450, // TODO: GLSL versions
|
.glsl450, // TODO: GLSL versions
|
||||||
.vulkan,
|
.vulkan,
|
||||||
.plan9,
|
.plan9,
|
||||||
|
.illumos,
|
||||||
.other,
|
.other,
|
||||||
=> return .{ .none = {} },
|
=> return .{ .none = {} },
|
||||||
|
|
||||||
@ -409,6 +415,7 @@ pub const Target = struct {
|
|||||||
.openbsd,
|
.openbsd,
|
||||||
.haiku,
|
.haiku,
|
||||||
.solaris,
|
.solaris,
|
||||||
|
.illumos,
|
||||||
=> true,
|
=> true,
|
||||||
|
|
||||||
.linux,
|
.linux,
|
||||||
@ -526,7 +533,6 @@ pub const Target = struct {
|
|||||||
.cloudabi,
|
.cloudabi,
|
||||||
.dragonfly,
|
.dragonfly,
|
||||||
.lv2,
|
.lv2,
|
||||||
.solaris,
|
|
||||||
.zos,
|
.zos,
|
||||||
.minix,
|
.minix,
|
||||||
.rtems,
|
.rtems,
|
||||||
@ -569,6 +575,8 @@ pub const Target = struct {
|
|||||||
.driverkit,
|
.driverkit,
|
||||||
.shadermodel,
|
.shadermodel,
|
||||||
.liteos, // TODO: audit this
|
.liteos, // TODO: audit this
|
||||||
|
.solaris,
|
||||||
|
.illumos,
|
||||||
=> return .none,
|
=> return .none,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1575,7 +1583,7 @@ pub const Target = struct {
|
|||||||
.netbsd => return copy(&result, "/libexec/ld.elf_so"),
|
.netbsd => return copy(&result, "/libexec/ld.elf_so"),
|
||||||
.openbsd => return copy(&result, "/usr/libexec/ld.so"),
|
.openbsd => return copy(&result, "/usr/libexec/ld.so"),
|
||||||
.dragonfly => return copy(&result, "/libexec/ld-elf.so.2"),
|
.dragonfly => return copy(&result, "/libexec/ld-elf.so.2"),
|
||||||
.solaris => return copy(&result, "/lib/64/ld.so.1"),
|
.solaris, .illumos => return copy(&result, "/lib/64/ld.so.1"),
|
||||||
.linux => switch (self.cpu.arch) {
|
.linux => switch (self.cpu.arch) {
|
||||||
.x86,
|
.x86,
|
||||||
.sparc,
|
.sparc,
|
||||||
@ -2115,6 +2123,7 @@ pub const Target = struct {
|
|||||||
.emscripten,
|
.emscripten,
|
||||||
.plan9,
|
.plan9,
|
||||||
.solaris,
|
.solaris,
|
||||||
|
.illumos,
|
||||||
.haiku,
|
.haiku,
|
||||||
.ananas,
|
.ananas,
|
||||||
.fuchsia,
|
.fuchsia,
|
||||||
|
|||||||
@ -111,6 +111,7 @@ fn updateOsVersionRange(self: *CrossTarget, os: Target.Os) void {
|
|||||||
.kfreebsd,
|
.kfreebsd,
|
||||||
.lv2,
|
.lv2,
|
||||||
.solaris,
|
.solaris,
|
||||||
|
.illumos,
|
||||||
.zos,
|
.zos,
|
||||||
.haiku,
|
.haiku,
|
||||||
.minix,
|
.minix,
|
||||||
@ -709,6 +710,7 @@ fn parseOs(result: *CrossTarget, diags: *ParseOptions.Diagnostics, text: []const
|
|||||||
.kfreebsd,
|
.kfreebsd,
|
||||||
.lv2,
|
.lv2,
|
||||||
.solaris,
|
.solaris,
|
||||||
|
.illumos,
|
||||||
.zos,
|
.zos,
|
||||||
.haiku,
|
.haiku,
|
||||||
.minix,
|
.minix,
|
||||||
|
|||||||
@ -89,7 +89,7 @@ pub fn detect(arena: Allocator, native_info: NativeTargetInfo) !NativePaths {
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (builtin.os.tag == .solaris) {
|
if (builtin.os.tag.isSolarish()) {
|
||||||
try self.addLibDir("/usr/lib/64");
|
try self.addLibDir("/usr/lib/64");
|
||||||
try self.addLibDir("/usr/local/lib/64");
|
try self.addLibDir("/usr/local/lib/64");
|
||||||
try self.addLibDir("/lib/64");
|
try self.addLibDir("/lib/64");
|
||||||
|
|||||||
@ -51,7 +51,7 @@ pub fn detect(cross_target: CrossTarget) DetectError!NativeTargetInfo {
|
|||||||
error.InvalidVersion => {},
|
error.InvalidVersion => {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
.solaris => {
|
.solaris, .illumos => {
|
||||||
const uts = std.os.uname();
|
const uts = std.os.uname();
|
||||||
const release = mem.sliceTo(&uts.release, 0);
|
const release = mem.sliceTo(&uts.release, 0);
|
||||||
if (std.SemanticVersion.parse(release)) |ver| {
|
if (std.SemanticVersion.parse(release)) |ver| {
|
||||||
@ -257,10 +257,12 @@ fn detectAbiAndDynamicLinker(
|
|||||||
) DetectError!NativeTargetInfo {
|
) DetectError!NativeTargetInfo {
|
||||||
const native_target_has_ld = comptime builtin.target.hasDynamicLinker();
|
const native_target_has_ld = comptime builtin.target.hasDynamicLinker();
|
||||||
const is_linux = builtin.target.os.tag == .linux;
|
const is_linux = builtin.target.os.tag == .linux;
|
||||||
|
const is_solarish = builtin.target.os.tag.isSolarish();
|
||||||
const have_all_info = cross_target.dynamic_linker.get() != null and
|
const have_all_info = cross_target.dynamic_linker.get() != null and
|
||||||
cross_target.abi != null and (!is_linux or cross_target.abi.?.isGnu());
|
cross_target.abi != null and (!is_linux or cross_target.abi.?.isGnu());
|
||||||
const os_is_non_native = cross_target.os_tag != null;
|
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_solarish) {
|
||||||
return defaultAbiAndDynamicLinker(cpu, os, cross_target);
|
return defaultAbiAndDynamicLinker(cpu, os, cross_target);
|
||||||
}
|
}
|
||||||
if (cross_target.abi) |abi| {
|
if (cross_target.abi) |abi| {
|
||||||
|
|||||||
@ -120,7 +120,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {
|
|||||||
.lv2 => "lv2",
|
.lv2 => "lv2",
|
||||||
.netbsd => "netbsd",
|
.netbsd => "netbsd",
|
||||||
.openbsd => "openbsd",
|
.openbsd => "openbsd",
|
||||||
.solaris => "solaris",
|
.solaris, .illumos => "solaris",
|
||||||
.windows => "windows",
|
.windows => "windows",
|
||||||
.zos => "zos",
|
.zos => "zos",
|
||||||
.haiku => "haiku",
|
.haiku => "haiku",
|
||||||
@ -231,7 +231,7 @@ pub fn targetOs(os_tag: std.Target.Os.Tag) llvm.OSType {
|
|||||||
.macos => .MacOSX,
|
.macos => .MacOSX,
|
||||||
.netbsd => .NetBSD,
|
.netbsd => .NetBSD,
|
||||||
.openbsd => .OpenBSD,
|
.openbsd => .OpenBSD,
|
||||||
.solaris => .Solaris,
|
.solaris, .illumos => .Solaris,
|
||||||
.zos => .ZOS,
|
.zos => .ZOS,
|
||||||
.haiku => .Haiku,
|
.haiku => .Haiku,
|
||||||
.minix => .Minix,
|
.minix => .Minix,
|
||||||
|
|||||||
@ -190,7 +190,7 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any
|
|||||||
.freebsd, .macos => @intFromPtr(info.addr),
|
.freebsd, .macos => @intFromPtr(info.addr),
|
||||||
.netbsd => @intFromPtr(info.info.reason.fault.addr),
|
.netbsd => @intFromPtr(info.info.reason.fault.addr),
|
||||||
.openbsd => @intFromPtr(info.data.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"),
|
else => @compileError("TODO implement handleSegfaultPosix for new POSIX OS"),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -213,11 +213,15 @@ pub const LibCInstallation = struct {
|
|||||||
try self.findNativeIncludeDirPosix(args);
|
try self.findNativeIncludeDirPosix(args);
|
||||||
try self.findNativeCrtBeginDirHaiku(args);
|
try self.findNativeCrtBeginDirHaiku(args);
|
||||||
self.crt_dir = try args.allocator.dupeZ(u8, "/system/develop/lib");
|
self.crt_dir = try args.allocator.dupeZ(u8, "/system/develop/lib");
|
||||||
|
} 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");
|
||||||
} else if (std.process.can_spawn) {
|
} else if (std.process.can_spawn) {
|
||||||
try self.findNativeIncludeDirPosix(args);
|
try self.findNativeIncludeDirPosix(args);
|
||||||
switch (builtin.target.os.tag) {
|
switch (builtin.target.os.tag) {
|
||||||
.freebsd, .netbsd, .openbsd, .dragonfly => self.crt_dir = try args.allocator.dupeZ(u8, "/usr/lib"),
|
.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),
|
.linux => try self.findNativeCrtDirPosix(args),
|
||||||
else => {},
|
else => {},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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)
|
if (std.mem.startsWith(u8, cxx_src, "src/support/win32/") and target.os.tag != .windows)
|
||||||
continue;
|
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;
|
continue;
|
||||||
if (std.mem.startsWith(u8, cxx_src, "src/support/ibm/") and target.os.tag != .zos)
|
if (std.mem.startsWith(u8, cxx_src, "src/support/ibm/") and target.os.tag != .zos)
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@ -3818,7 +3818,7 @@ const CsuObjects = struct {
|
|||||||
.static_pie => result.set( "start_dyn.o", "crti.o", "crtbeginS.o", "crtendS.o", "crtn.o" ),
|
.static_pie => result.set( "start_dyn.o", "crti.o", "crtbeginS.o", "crtendS.o", "crtn.o" ),
|
||||||
// zig fmt: on
|
// zig fmt: on
|
||||||
},
|
},
|
||||||
.solaris => switch (mode) {
|
.solaris, .illumos => switch (mode) {
|
||||||
// zig fmt: off
|
// zig fmt: off
|
||||||
.dynamic_lib => result.set( null, "crti.o", null, null, "crtn.o" ),
|
.dynamic_lib => result.set( null, "crti.o", null, null, "crtn.o" ),
|
||||||
.dynamic_exe,
|
.dynamic_exe,
|
||||||
|
|||||||
@ -218,7 +218,7 @@ pub fn hasValgrindSupport(target: std.Target) bool {
|
|||||||
.aarch64_32,
|
.aarch64_32,
|
||||||
.aarch64_be,
|
.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);
|
(target.os.tag == .windows and target.abi != .msvc);
|
||||||
},
|
},
|
||||||
else => return false,
|
else => return false,
|
||||||
@ -493,7 +493,7 @@ pub fn libcFullLinkFlags(target: std.Target) []const []const u8 {
|
|||||||
"-lc",
|
"-lc",
|
||||||
"-lutil",
|
"-lutil",
|
||||||
},
|
},
|
||||||
.solaris => &[_][]const u8{
|
.solaris, .illumos => &[_][]const u8{
|
||||||
"-lm",
|
"-lm",
|
||||||
"-lsocket",
|
"-lsocket",
|
||||||
"-lnsl",
|
"-lnsl",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user