aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Compilation.zig2
-rw-r--r--src/codegen/llvm.zig8
-rw-r--r--src/libtsan.zig2
-rw-r--r--src/link/MachO.zig36
-rw-r--r--src/link/MachO/Dylib.zig4
-rw-r--r--src/main.zig2
-rw-r--r--src/target.zig1
7 files changed, 37 insertions, 18 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index 2497081a5e..b830311733 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -5280,7 +5280,7 @@ pub fn addCCArgs(
// doesn't matter which one gets overridden.
argv.appendAssumeCapacity("-Wno-overriding-option");
},
- .ios, .tvos, .watchos => switch (target.cpu.arch) {
+ .ios => switch (target.cpu.arch) {
// Pass the proper -m<os>-version-min argument for darwin.
.x86, .x86_64 => {
const ver = target.os.version_range.semver.min;
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 71481e859b..84692e9a03 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -145,7 +145,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {
.driverkit => "driverkit",
.shadermodel => "shadermodel",
.liteos => "liteos",
- .xros => "xros",
+ .visionos => "xros",
.serenity => "serenity",
.vulkan => "vulkan",
@@ -256,7 +256,7 @@ pub fn targetOs(os_tag: std.Target.Os.Tag) llvm.OSType {
.elfiamcu => .ELFIAMCU,
.tvos => .TvOS,
.watchos => .WatchOS,
- .xros => .XROS,
+ .visionos => .XROS,
.mesa3d => .Mesa3D,
.amdpal => .AMDPAL,
.hermit => .HermitCore,
@@ -618,7 +618,7 @@ const DataLayoutBuilder = struct {
abi = size;
pref = size;
} else switch (self.target.os.tag) {
- .macos, .ios => {},
+ .macos, .ios, .watchos, .tvos, .visionos => {},
.uefi, .windows => {
pref = size;
force_abi = size >= 32;
@@ -11578,7 +11578,7 @@ fn ccAbiPromoteInt(
else => return null,
};
return switch (target.os.tag) {
- .macos => switch (int_info.bits) {
+ .macos, .ios, .watchos, .tvos, .visionos => switch (int_info.bits) {
0...16 => int_info.signedness,
else => null,
},
diff --git a/src/libtsan.zig b/src/libtsan.zig
index a32c9ce297..28dba65772 100644
--- a/src/libtsan.zig
+++ b/src/libtsan.zig
@@ -125,7 +125,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) BuildError!v
}
const platform_tsan_sources = switch (target.os.tag) {
- .ios, .macos, .watchos, .tvos => &darwin_tsan_sources,
+ .ios, .macos, .watchos, .tvos, .visionos => &darwin_tsan_sources,
.windows => &windows_tsan_sources,
else => &unix_tsan_sources,
};
diff --git a/src/link/MachO.zig b/src/link/MachO.zig
index f85b7127a3..4255b298bc 100644
--- a/src/link/MachO.zig
+++ b/src/link/MachO.zig
@@ -891,6 +891,10 @@ pub fn resolveLibSystem(
},
};
+ for (self.lib_dirs) |dir| {
+ if (try accessLibPath(arena, &test_path, &checked_paths, dir, "System")) break :success;
+ }
+
try self.reportMissingLibraryError(checked_paths.items, "unable to find libSystem system library", .{});
return error.MissingLibSystem;
}
@@ -3676,10 +3680,17 @@ pub inline fn getPageSize(self: MachO) u16 {
pub fn requiresCodeSig(self: MachO) bool {
if (self.entitlements) |_| return true;
+ // TODO: enable once we support this linker option
// if (self.options.adhoc_codesign) |cs| return cs;
- return switch (self.getTarget().cpu.arch) {
- .aarch64 => true,
- else => false,
+ const target = self.getTarget();
+ return switch (target.cpu.arch) {
+ .aarch64 => switch (target.os.tag) {
+ .macos => true,
+ .watchos, .tvos, .ios, .visionos => target.abi == .simulator,
+ else => false,
+ },
+ .x86_64 => false,
+ else => unreachable,
};
}
@@ -4424,6 +4435,7 @@ pub const Platform = struct {
.TVOS, .TVOSSIMULATOR => .tvos,
.WATCHOS, .WATCHOSSIMULATOR => .watchos,
.MACCATALYST => .ios,
+ .VISIONOS, .VISIONOSSIMULATOR => .visionos,
else => @panic("TODO"),
},
.abi = switch (cmd.platform) {
@@ -4431,6 +4443,7 @@ pub const Platform = struct {
.IOSSIMULATOR,
.TVOSSIMULATOR,
.WATCHOSSIMULATOR,
+ .VISIONOSSIMULATOR,
=> .simulator,
else => .none,
},
@@ -4481,6 +4494,7 @@ pub const Platform = struct {
},
.tvos => if (plat.abi == .simulator) .TVOSSIMULATOR else .TVOS,
.watchos => if (plat.abi == .simulator) .WATCHOSSIMULATOR else .WATCHOS,
+ .visionos => if (plat.abi == .simulator) .VISIONOSSIMULATOR else .VISIONOS,
else => unreachable,
};
}
@@ -4549,13 +4563,15 @@ const SupportedPlatforms = struct {
// Source: https://github.com/apple-oss-distributions/ld64/blob/59a99ab60399c5e6c49e6945a9e1049c42b71135/src/ld/PlatformSupport.cpp#L52
// zig fmt: off
const supported_platforms = [_]SupportedPlatforms{
- .{ .macos, .none, 0xA0E00, 0xA0800 },
- .{ .ios, .none, 0xC0000, 0x70000 },
- .{ .tvos, .none, 0xC0000, 0x70000 },
- .{ .watchos, .none, 0x50000, 0x20000 },
- .{ .ios, .simulator, 0xD0000, 0x80000 },
- .{ .tvos, .simulator, 0xD0000, 0x80000 },
- .{ .watchos, .simulator, 0x60000, 0x20000 },
+ .{ .macos, .none, 0xA0E00, 0xA0800 },
+ .{ .ios, .none, 0xC0000, 0x70000 },
+ .{ .tvos, .none, 0xC0000, 0x70000 },
+ .{ .watchos, .none, 0x50000, 0x20000 },
+ .{ .visionos, .none, 0x10000, 0x10000 },
+ .{ .ios, .simulator, 0xD0000, 0x80000 },
+ .{ .tvos, .simulator, 0xD0000, 0x80000 },
+ .{ .watchos, .simulator, 0x60000, 0x20000 },
+ .{ .visionos, .simulator, 0x10000, 0x10000 },
};
// zig fmt: on
diff --git a/src/link/MachO/Dylib.zig b/src/link/MachO/Dylib.zig
index 6acfb2080c..226094e997 100644
--- a/src/link/MachO/Dylib.zig
+++ b/src/link/MachO/Dylib.zig
@@ -671,7 +671,7 @@ pub const TargetMatcher = struct {
try self.target_strings.append(allocator, apple_string);
switch (platform) {
- .IOSSIMULATOR, .TVOSSIMULATOR, .WATCHOSSIMULATOR => {
+ .IOSSIMULATOR, .TVOSSIMULATOR, .WATCHOSSIMULATOR, .VISIONOSSIMULATOR => {
// For Apple simulator targets, linking gets tricky as we need to link against the simulator
// hosts dylibs too.
const host_target = try targetToAppleString(allocator, cpu_arch, .MACOS);
@@ -714,9 +714,11 @@ pub const TargetMatcher = struct {
.IOS => "ios",
.TVOS => "tvos",
.WATCHOS => "watchos",
+ .VISIONOS => "xros",
.IOSSIMULATOR => "ios-simulator",
.TVOSSIMULATOR => "tvos-simulator",
.WATCHOSSIMULATOR => "watchos-simulator",
+ .VISIONOSSIMULATOR => "xros-simulator",
.BRIDGEOS => "bridgeos",
.MACCATALYST => "maccatalyst",
.DRIVERKIT => "driverkit",
diff --git a/src/main.zig b/src/main.zig
index 7e6b5d261f..3ec27ceb4e 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -4432,7 +4432,7 @@ fn runOrTestHotSwap(
}
switch (builtin.target.os.tag) {
- .macos, .ios, .tvos, .watchos => {
+ .macos, .ios, .tvos, .watchos, .visionos => {
const PosixSpawn = @import("DarwinPosixSpawn.zig");
var attr = try PosixSpawn.Attr.init();
diff --git a/src/target.zig b/src/target.zig
index 6e77a965cd..99b9abcab8 100644
--- a/src/target.zig
+++ b/src/target.zig
@@ -26,6 +26,7 @@ pub fn libcNeedsLibUnwind(target: std.Target) bool {
.ios,
.watchos,
.tvos,
+ .visionos,
.freestanding,
.wasi, // Wasm/WASI currently doesn't offer support for libunwind, so don't link it.
=> false,