Commit 8f202ba7c7
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",
src/link/MachO.zig
@@ -3676,10 +3676,16 @@ pub inline fn getPageSize(self: MachO) u16 {
pub fn requiresCodeSig(self: MachO) bool {
if (self.entitlements) |_| return true;
- // if (self.options.adhoc_codesign) |cs| return cs;
- return switch (self.getTarget().cpu.arch) {
- .aarch64 => true,
- else => false,
+ if (self.options.adhoc_codesign) |cs| return cs;
+ 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 +4430,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 +4438,7 @@ pub const Platform = struct {
.IOSSIMULATOR,
.TVOSSIMULATOR,
.WATCHOSSIMULATOR,
+ .VISIONOSSIMULATOR,
=> .simulator,
else => .none,
},
@@ -4481,6 +4489,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 +4558,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