authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-11-17 13:04:25+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-11-26 11:50:09+01:00
loge1b65ff8d211066d0856ad3535b96dcdc88e76dc
tree052df855de0d2b23d00effc37e53ab231f752600
parentbe0d5571d2c183ea7504faac13802f0e271f180b

stage2 macho: cleanup minimum version command


1 files changed, 12 insertions(+), 4 deletions(-)

src/link/MachO.zig+12-4
......@@ -1379,13 +1379,21 @@ pub fn populateMissingMetadata(self: *MachO) !void {
13791379 }
13801380 if (self.version_min_cmd_index == null) {
13811381 self.version_min_cmd_index = @intCast(u16, self.load_commands.items.len);
1382 const cmd: u32 = switch (self.base.options.target.os.tag) {
1383 .macos => macho.LC_VERSION_MIN_MACOSX,
1384 .ios => macho.LC_VERSION_MIN_IPHONEOS,
1385 .tvos => macho.LC_VERSION_MIN_TVOS,
1386 .watchos => macho.LC_VERSION_MIN_WATCHOS,
1387 else => unreachable, // wrong OS
1388 };
1389 const ver = self.base.options.target.os.version_range.semver.min;
1390 const version = ver.major << 16 | ver.minor << 8 | ver.patch;
13821391 try self.load_commands.append(self.base.allocator, .{
1383 // TODO allow for different targets and different versions
13841392 .MinVersion = .{
1385 .cmd = macho.LC_VERSION_MIN_MACOSX,
1393 .cmd = cmd,
13861394 .cmdsize = @sizeOf(macho.version_min_command),
1387 .version = 0xB0001, // 11.0.1 BigSur
1388 .sdk = 0xB0001, // 11.0.1 BigSur
1395 .version = version,
1396 .sdk = version,
13891397 },
13901398 });
13911399 }