| author | |
| committer | |
| log | 197ffff0b8d1c5257d66775d4cc46bcbfd570a90 |
| tree | a2ae6a6a5944be7ba8391f19bc073691533cbdc8 |
| parent | 22fd1851bd56dae5b61e5f170671f3af5ef54330 |
| signature |
Support linking against tbd-v3 SDKs such as those bundled with
Xcode 10.3 → 11.3.1 .
- Map target os=`ios` and abi=`macabi` to macho.PLATFORM.MACCATALYST.
This allows for matches against tbdv4 targets, eg. `x86_64-maccatalyst`.
- When parsing old tbdv3 files with `zippered` platform, we append
[`ARCH-macos`, `ARCH-maccatalyst`] to list of "tbd" targets. This
enables linking for standard targets like `ARCH-macos-none` and
maccatalyst targets `ARCH-ios-macabi`.
- Update mappings for macho platform and zig target macabi. While this
is not full maccatalyst support, a basic exe can be built as follows:
```
zig libc > libc.txt
zig build-exe z0.zig --libc libc.txt -target x86_64-ios-macabi
```
closes #191102 files changed, 15 insertions(+), 3 deletions(-)
src/link/MachO.zig+7-1| ... | @@ -4376,9 +4376,11 @@ pub const Platform = struct { | ... | @@ -4376,9 +4376,11 @@ pub const Platform = struct { |
| 4376 | .IOS, .IOSSIMULATOR => .ios, | 4376 | .IOS, .IOSSIMULATOR => .ios, |
| 4377 | .TVOS, .TVOSSIMULATOR => .tvos, | 4377 | .TVOS, .TVOSSIMULATOR => .tvos, |
| 4378 | .WATCHOS, .WATCHOSSIMULATOR => .watchos, | 4378 | .WATCHOS, .WATCHOSSIMULATOR => .watchos, |
| 4379 | .MACCATALYST => .ios, | ||
| 4379 | else => @panic("TODO"), | 4380 | else => @panic("TODO"), |
| 4380 | }, | 4381 | }, |
| 4381 | .abi = switch (cmd.platform) { | 4382 | .abi = switch (cmd.platform) { |
| 4383 | .MACCATALYST => .macabi, | ||
| 4382 | .IOSSIMULATOR, | 4384 | .IOSSIMULATOR, |
| 4383 | .TVOSSIMULATOR, | 4385 | .TVOSSIMULATOR, |
| 4384 | .WATCHOSSIMULATOR, | 4386 | .WATCHOSSIMULATOR, |
| ... | @@ -4425,7 +4427,11 @@ pub const Platform = struct { | ... | @@ -4425,7 +4427,11 @@ pub const Platform = struct { |
| 4425 | pub fn toApplePlatform(plat: Platform) macho.PLATFORM { | 4427 | pub fn toApplePlatform(plat: Platform) macho.PLATFORM { |
| 4426 | return switch (plat.os_tag) { | 4428 | return switch (plat.os_tag) { |
| 4427 | .macos => .MACOS, | 4429 | .macos => .MACOS, |
| 4428 | .ios => if (plat.abi == .simulator) .IOSSIMULATOR else .IOS, | 4430 | .ios => switch (plat.abi) { |
| 4431 | .simulator => .IOSSIMULATOR, | ||
| 4432 | .macabi => .MACCATALYST, | ||
| 4433 | else => .IOS, | ||
| 4434 | }, | ||
| 4429 | .tvos => if (plat.abi == .simulator) .TVOSSIMULATOR else .TVOS, | 4435 | .tvos => if (plat.abi == .simulator) .TVOSSIMULATOR else .TVOS, |
| 4430 | .watchos => if (plat.abi == .simulator) .WATCHOSSIMULATOR else .WATCHOS, | 4436 | .watchos => if (plat.abi == .simulator) .WATCHOSSIMULATOR else .WATCHOS, |
| 4431 | else => unreachable, | 4437 | else => unreachable, |
src/link/MachO/Dylib.zig+8-2| ... | @@ -751,8 +751,14 @@ pub const TargetMatcher = struct { | ... | @@ -751,8 +751,14 @@ pub const TargetMatcher = struct { |
| 751 | .v3 => |v3| blk: { | 751 | .v3 => |v3| blk: { |
| 752 | var targets = std.ArrayList([]const u8).init(arena.allocator()); | 752 | var targets = std.ArrayList([]const u8).init(arena.allocator()); |
| 753 | for (v3.archs) |arch| { | 753 | for (v3.archs) |arch| { |
| 754 | const target = try std.fmt.allocPrint(arena.allocator(), "{s}-{s}", .{ arch, v3.platform }); | 754 | if (mem.eql(u8, v3.platform, "zippered")) { |
| 755 | try targets.append(target); | 755 | // From Xcode 10.3 → 11.3.1, macos SDK .tbd files specify platform as 'zippered' |
| 756 | // which should map to [ '<arch>-macos', '<arch>-maccatalyst' ] | ||
| 757 | try targets.append(try std.fmt.allocPrint(arena.allocator(), "{s}-macos", .{arch})); | ||
| 758 | try targets.append(try std.fmt.allocPrint(arena.allocator(), "{s}-maccatalyst", .{arch})); | ||
| 759 | } else { | ||
| 760 | try targets.append(try std.fmt.allocPrint(arena.allocator(), "{s}-{s}", .{ arch, v3.platform })); | ||
| 761 | } | ||
| 756 | } | 762 | } |
| 757 | break :blk targets.items; | 763 | break :blk targets.items; |
| 758 | }, | 764 | }, |