Skip to content

Commit

Permalink
macho: add <cpu_arch>-macosx to target strings as a fallback target
Browse files Browse the repository at this point in the history
Turns out that around 10.13/10.14 macOS release version, Apple changed the target tags in
tbd files from `macosx` to `macos`. In order to be compliant and therefore actually support
linking on older platforms against `libSystem.tbd`, we add `<cpu_arch>-macosx` to target strings.
  • Loading branch information
kubkon committed Feb 4, 2024
1 parent a1b607a commit f5dbcd1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/link/MachO/Dylib.zig
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,15 @@ pub const TargetMatcher = struct {
const host_target = try targetToAppleString(allocator, cpu_arch, .MACOS);
try self.target_strings.append(allocator, host_target);
},
.MACOS => {
// Turns out that around 10.13/10.14 macOS release version, Apple changed the target tags in
// tbd files from `macosx` to `macos`. In order to be compliant and therefore actually support
// linking on older platforms against `libSystem.tbd`, we add `<cpu_arch>-macosx` to target_strings.
const fallback_target = try std.fmt.allocPrint(allocator, "{s}-macosx", .{
cpuArchToAppleString(cpu_arch),
});
try self.target_strings.append(allocator, fallback_target);
},
else => {},
}

Expand Down

0 comments on commit f5dbcd1

Please sign in to comment.