aboutsummaryrefslogtreecommitdiff
path: root/src/link
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2024-04-05 23:37:51 +0200
committerGitHub <noreply@github.com>2024-04-05 23:37:51 +0200
commit23f729aec96cec68be15436db2a38e37d54fbe8f (patch)
treedfc1e929aa4cbad0336cfd9da703aa7e2417d37b /src/link
parentdf1f8b0ae6ee493262f4244e3af0fb604ccd0a0f (diff)
parent197ffff0b8d1c5257d66775d4cc46bcbfd570a90 (diff)
downloadzig-23f729aec96cec68be15436db2a38e37d54fbe8f.tar.gz
zig-23f729aec96cec68be15436db2a38e37d54fbe8f.zip
Merge pull request #19260 from mikdusan/macos-zippered
macos: add zippered support
Diffstat (limited to 'src/link')
-rw-r--r--src/link/MachO.zig8
-rw-r--r--src/link/MachO/Dylib.zig14
2 files changed, 17 insertions, 5 deletions
diff --git a/src/link/MachO.zig b/src/link/MachO.zig
index 2c8a3da59f..01e03a10ba 100644
--- a/src/link/MachO.zig
+++ b/src/link/MachO.zig
@@ -4376,9 +4376,11 @@ pub const Platform = struct {
.IOS, .IOSSIMULATOR => .ios,
.TVOS, .TVOSSIMULATOR => .tvos,
.WATCHOS, .WATCHOSSIMULATOR => .watchos,
+ .MACCATALYST => .ios,
else => @panic("TODO"),
},
.abi = switch (cmd.platform) {
+ .MACCATALYST => .macabi,
.IOSSIMULATOR,
.TVOSSIMULATOR,
.WATCHOSSIMULATOR,
@@ -4425,7 +4427,11 @@ pub const Platform = struct {
pub fn toApplePlatform(plat: Platform) macho.PLATFORM {
return switch (plat.os_tag) {
.macos => .MACOS,
- .ios => if (plat.abi == .simulator) .IOSSIMULATOR else .IOS,
+ .ios => switch (plat.abi) {
+ .simulator => .IOSSIMULATOR,
+ .macabi => .MACCATALYST,
+ else => .IOS,
+ },
.tvos => if (plat.abi == .simulator) .TVOSSIMULATOR else .TVOS,
.watchos => if (plat.abi == .simulator) .WATCHOSSIMULATOR else .WATCHOS,
else => unreachable,
diff --git a/src/link/MachO/Dylib.zig b/src/link/MachO/Dylib.zig
index aa853cdbc6..6acfb2080c 100644
--- a/src/link/MachO/Dylib.zig
+++ b/src/link/MachO/Dylib.zig
@@ -54,7 +54,7 @@ pub fn parse(self: *Dylib, macho_file: *MachO, file: std.fs.File, fat_arch: ?fat
const gpa = macho_file.base.comp.gpa;
const offset = if (fat_arch) |ar| ar.offset else 0;
- log.debug("parsing dylib from binary", .{});
+ log.debug("parsing dylib from binary: {s}", .{self.path});
var header_buffer: [@sizeOf(macho.mach_header_64)]u8 = undefined;
{
@@ -266,7 +266,7 @@ pub fn parseTbd(
const gpa = macho_file.base.comp.gpa;
- log.debug("parsing dylib from stub", .{});
+ log.debug("parsing dylib from stub: {s}", .{self.path});
const umbrella_lib = lib_stub.inner[0];
@@ -751,8 +751,14 @@ pub const TargetMatcher = struct {
.v3 => |v3| blk: {
var targets = std.ArrayList([]const u8).init(arena.allocator());
for (v3.archs) |arch| {
- const target = try std.fmt.allocPrint(arena.allocator(), "{s}-{s}", .{ arch, v3.platform });
- try targets.append(target);
+ if (mem.eql(u8, v3.platform, "zippered")) {
+ // From Xcode 10.3 → 11.3.1, macos SDK .tbd files specify platform as 'zippered'
+ // which should map to [ '<arch>-macos', '<arch>-maccatalyst' ]
+ try targets.append(try std.fmt.allocPrint(arena.allocator(), "{s}-macos", .{arch}));
+ try targets.append(try std.fmt.allocPrint(arena.allocator(), "{s}-maccatalyst", .{arch}));
+ } else {
+ try targets.append(try std.fmt.allocPrint(arena.allocator(), "{s}-{s}", .{ arch, v3.platform }));
+ }
}
break :blk targets.items;
},