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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -738,17 +738,12 @@ 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()
set(ZIG_HOST_TARGET_OS "illumos")
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 MATCHES "(solaris|illumos)")
if (ZIG_HOST_TARGET_OS STREQUAL "illumos")
set(ZIG_HOST_TARGET_ARCH "x86_64")
else()
set(ZIG_HOST_TARGET_ARCH "x86")
Expand Down
2 changes: 1 addition & 1 deletion build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ fn addCmakeCfgOptionsToExe(
try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes);
if (static) try addCxxKnownPath(b, cfg, exe, b.fmt("libgcc_eh.{s}", .{lib_suffix}), null, need_cpp_includes);
},
.solaris, .illumos => {
.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);
},
Expand Down
8 changes: 4 additions & 4 deletions lib/compiler/aro/aro/Compilation.zig
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ fn generateSystemDefines(comp: *Compilation, w: *std.Io.Writer) !void {
.netbsd => try define(w, "__NetBSD__"),
.openbsd => try define(w, "__OpenBSD__"),
.dragonfly => try define(w, "__DragonFly__"),
.solaris => try defineStd(w, "sun", is_gnu),
.illumos => try defineStd(w, "sun", is_gnu),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI @Vexu note the replacement of solaris with illumos rather than outright removal of the prong. I'm assuming a lot of this code mirrors Clang frontend code and therefore never properly handled illumos because LLVM/Clang lump them together in a single solaris tag.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: The illumos compilers patch gcc/clang to also use __illumos__ the platforms have diverged enough that this matters.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zig/src/Compilation.zig

Lines 6868 to 6870 in dba1bf9

// LLVM doesn't distinguish between Solaris and illumos, but the illumos GCC fork
// defines this macro.
.illumos => try argv.append("__illumos__"),

I think this should be picked up by translate-c as well, though obviously Aro will want to add that macro independently too.

.macos,
.tvos,
.ios,
Expand All @@ -361,7 +361,7 @@ fn generateSystemDefines(comp: *Compilation, w: *std.Io.Writer) !void {
.linux,
.haiku,
.hurd,
.solaris,
.illumos,
.aix,
.emscripten,
.ps4,
Expand Down Expand Up @@ -618,15 +618,15 @@ fn generateSystemDefines(comp: *Compilation, w: *std.Io.Writer) !void {
try defineStd(w, "sparc", is_gnu);
try define(w, "__sparc_v9__");
try define(w, "__arch64__");
if (comp.target.os.tag != .solaris) {
if (comp.target.os.tag != .illumos) {
try define(w, "__sparc64__");
try define(w, "__sparc_v9__");
try define(w, "__sparcv9__");
}
},
.sparc => {
try defineStd(w, "sparc", is_gnu);
if (comp.target.os.tag == .solaris) {
if (comp.target.os.tag == .illumos) {
try define(w, "__sparcv8");
}
},
Expand Down
8 changes: 4 additions & 4 deletions lib/compiler/aro/aro/Toolchain.zig
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,8 @@ fn getUnwindLibKind(tc: *const Toolchain) !UnwindLibKind {
}
}

fn getAsNeededOption(is_solaris: bool, needed: bool) []const u8 {
if (is_solaris) {
fn getAsNeededOption(is_illumos: bool, needed: bool) []const u8 {
if (is_illumos) {
return if (needed) "-zignore" else "-zrecord";
} else {
return if (needed) "--as-needed" else "--no-as-needed";
Expand All @@ -412,7 +412,7 @@ fn addUnwindLibrary(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !voi

try argv.ensureUnusedCapacity(tc.driver.comp.gpa, 3);
if (as_needed) {
argv.appendAssumeCapacity(getAsNeededOption(target.os.tag == .solaris, true));
argv.appendAssumeCapacity(getAsNeededOption(target.os.tag == .illumos, true));
}
switch (unw) {
.none => return,
Expand All @@ -435,7 +435,7 @@ fn addUnwindLibrary(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !voi
}

if (as_needed) {
argv.appendAssumeCapacity(getAsNeededOption(target.os.tag == .solaris, false));
argv.appendAssumeCapacity(getAsNeededOption(target.os.tag == .illumos, false));
}
}

Expand Down
13 changes: 6 additions & 7 deletions lib/compiler/aro/aro/target.zig
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ pub fn systemCompiler(target: std.Target) LangOpts.Compiler {
target.abi.isAndroid() or
target.os.tag.isBSD() or
target.os.tag == .fuchsia or
target.os.tag == .solaris or
target.os.tag == .illumos or
target.os.tag == .haiku or
target.cpu.arch == .hexagon)
{
Expand Down Expand Up @@ -281,7 +281,7 @@ pub fn hasFloat128(target: std.Target) bool {
.haiku,
.linux,
.openbsd,
.solaris,
.illumos,
=> target.cpu.arch.isX86(),
else => false,
};
Expand Down Expand Up @@ -654,8 +654,7 @@ pub fn toLLVMTriple(target: std.Target, buf: []u8) []const u8 {
.ps3 => "lv2",
.netbsd => "netbsd",
.openbsd => "openbsd",
.solaris => "solaris",
.illumos => "illumos",
.illumos => "solaris",
.windows => "windows",
.zos => "zos",
.haiku => "haiku",
Expand Down Expand Up @@ -755,7 +754,7 @@ pub fn isPIEDefault(target: std.Target) DefaultPIStatus {
.dragonfly,
.netbsd,
.freebsd,
.solaris,
.illumos,

.cuda,
.amdhsa,
Expand Down Expand Up @@ -838,7 +837,7 @@ pub fn isPICdefault(target: std.Target) DefaultPIStatus {
.openbsd,
.netbsd,
.freebsd,
.solaris,
.illumos,
.hurd,
=> {
return switch (target.cpu.arch) {
Expand Down Expand Up @@ -897,7 +896,7 @@ pub fn isPICDefaultForced(target: std.Target) DefaultPIStatus {
.openbsd,
.netbsd,
.freebsd,
.solaris,
.illumos,
.cuda,
.ps4,
.ps5,
Expand Down
2 changes: 1 addition & 1 deletion lib/std/Progress.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1547,7 +1547,7 @@ fn handleSigWinch(sig: i32, info: *const posix.siginfo_t, ctx_ptr: ?*anyopaque)
const have_sigwinch = switch (builtin.os.tag) {
.linux,
.plan9,
.solaris,
.illumos,
.netbsd,
.openbsd,
.haiku,
Expand Down
65 changes: 15 additions & 50 deletions lib/std/Target.zig
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub const Os = struct {
aix,
haiku,
hurd,
illumos,
linux,
plan9,
rtems,
Expand All @@ -45,9 +46,6 @@ pub const Os = struct {
visionos,
watchos,

illumos,
solaris,

windows,
uefi,

Expand Down Expand Up @@ -98,10 +96,6 @@ pub const Os = struct {
};
}

pub inline fn isSolarish(tag: Tag) bool {
return tag == .solaris or tag == .illumos;
}

pub fn exeFileExt(tag: Tag, arch: Cpu.Arch) [:0]const u8 {
return switch (tag) {
.windows => ".exe",
Expand Down Expand Up @@ -163,11 +157,10 @@ pub const Os = struct {
.managarm,

.haiku,
.illumos,
.plan9,
.serenity,

.illumos,

.ps3,
.ps4,
.ps5,
Expand Down Expand Up @@ -197,8 +190,6 @@ pub const Os = struct {
.visionos,
.watchos,

.solaris,

.uefi,

.@"3ds",
Expand Down Expand Up @@ -395,11 +386,10 @@ pub const Os = struct {
.managarm,

.haiku,
.illumos,
.plan9,
.serenity,

.illumos,

.ps3,
.ps4,
.ps5,
Expand Down Expand Up @@ -597,13 +587,6 @@ pub const Os = struct {
},
},

.solaris => .{
.semver = .{
.min = .{ .major = 11, .minor = 0, .patch = 0 },
.max = .{ .major = 11, .minor = 4, .patch = 0 },
},
},

.windows => .{
.windows = .{
.min = .win10,
Expand Down Expand Up @@ -930,15 +913,14 @@ pub const Abi = enum {
.contiki,
.fuchsia,
.hermit,
.illumos,
.managarm,
.plan9,
.serenity,
.zos,
.dragonfly,
.driverkit,
.macos,
.illumos,
.solaris,
.ps3,
.ps4,
.ps5,
Expand Down Expand Up @@ -2043,10 +2025,6 @@ pub const Cpu = struct {
else => &s390x.cpu.arch8,
},
.sparc => &sparc.cpu.v9, // glibc does not work with 'plain' v8.
.sparc64 => switch (os.tag) {
.solaris => &sparc.cpu.ultrasparc3,
else => generic(arch),
},
.x86 => &x86.cpu.pentium4,
.x86_64 => switch (os.tag) {
.driverkit => &x86.cpu.nehalem,
Expand Down Expand Up @@ -2175,6 +2153,7 @@ pub inline fn isWasiLibC(target: *const Target) bool {
pub fn requiresLibC(target: *const Target) bool {
return switch (target.os.tag) {
.aix,
.illumos,
.driverkit,
.macos,
.ios,
Expand All @@ -2184,8 +2163,6 @@ pub fn requiresLibC(target: *const Target) bool {
.dragonfly,
.openbsd,
.haiku,
.solaris,
.illumos,
.serenity,
=> true,

Expand Down Expand Up @@ -2332,6 +2309,7 @@ pub const DynamicLinker = struct {
.fuchsia,

.haiku,
.illumos,
.serenity,

.dragonfly,
Expand All @@ -2345,9 +2323,6 @@ pub const DynamicLinker = struct {
.tvos,
.visionos,
.watchos,

.illumos,
.solaris,
=> .arch_os,
.hurd,
.linux,
Expand Down Expand Up @@ -2439,6 +2414,14 @@ pub const DynamicLinker = struct {
else => none,
},

.illumos,
=> switch (cpu.arch) {
.x86,
.x86_64,
=> initFmt("/lib/{s}ld.so.1", .{if (ptrBitWidth_cpu_abi(cpu, .none) == 64) "64/" else ""}),
else => none,
},

.linux => if (abi.isAndroid())
switch (cpu.arch) {
.arm => if (abi == .androideabi) init("/system/bin/linker") else none,
Expand Down Expand Up @@ -2755,22 +2738,6 @@ pub const DynamicLinker = struct {
else => none,
},

.illumos,
=> switch (cpu.arch) {
.x86,
.x86_64,
=> initFmt("/lib/{s}ld.so.1", .{if (ptrBitWidth_cpu_abi(cpu, .none) == 64) "64/" else ""}),
else => none,
},

.solaris,
=> switch (cpu.arch) {
.sparc64,
.x86_64,
=> initFmt("/lib/{s}ld.so.1", .{if (ptrBitWidth_cpu_abi(cpu, .none) == 64) "64/" else ""}),
else => none,
},

// Operating systems in this list have been verified as not having a standard
// dynamic linker path.
.freestanding,
Expand Down Expand Up @@ -3134,6 +3101,7 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
.aix,
.haiku,
.hurd,
.illumos,
.linux,
.plan9,
.rtems,
Expand All @@ -3145,9 +3113,6 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
.netbsd,
.openbsd,

.illumos,
.solaris,

.wasi,
.emscripten,
=> switch (target.cpu.arch) {
Expand Down
10 changes: 5 additions & 5 deletions lib/std/Thread.zig
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub const max_name_len = switch (native_os) {
.freebsd => 15,
.openbsd => 23,
.dragonfly => 1023,
.solaris, .illumos => 31,
.illumos => 31,
// https://github.com/SerenityOS/serenity/blob/6b4c300353da49d3508b5442cf61da70bd04d757/Kernel/Tasks/Thread.h#L102
.serenity => 63,
else => 0,
Expand Down Expand Up @@ -211,7 +211,7 @@ pub fn setName(self: Thread, name: []const u8) SetNameError!void {
else => |e| return posix.unexpectedErrno(e),
}
},
.netbsd, .solaris, .illumos => if (use_pthreads) {
.netbsd, .illumos => if (use_pthreads) {
const err = std.c.pthread_setname_np(self.getHandle(), name_with_terminator.ptr, null);
switch (@as(posix.E, @enumFromInt(err))) {
.SUCCESS => return,
Expand Down Expand Up @@ -324,7 +324,7 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co
else => |e| return posix.unexpectedErrno(e),
}
},
.netbsd, .solaris, .illumos => if (use_pthreads) {
.netbsd, .illumos => if (use_pthreads) {
const err = std.c.pthread_getname_np(self.getHandle(), buffer.ptr, max_name_len + 1);
switch (@as(posix.E, @enumFromInt(err))) {
.SUCCESS => return std.mem.sliceTo(buffer, 0),
Expand Down Expand Up @@ -739,10 +739,10 @@ const PosixThreadImpl = struct {
};
return @as(usize, @intCast(count));
},
.solaris, .illumos, .serenity => {
.illumos, .serenity => {
// The "proper" way to get the cpu count would be to query
// /dev/kstat via ioctls, and traverse a linked list for each
// cpu. (solaris, illumos)
// cpu. (illumos)
const rc = c.sysconf(@intFromEnum(std.c._SC.NPROCESSORS_ONLN));
return switch (posix.errno(rc)) {
.SUCCESS => @as(usize, @intCast(rc)),
Expand Down
Loading
Loading