authorgravatar for michael.dusan@gmail.comMichael Dusan <michael.dusan@gmail.com> 2023-09-26 07:51:32-04:00
committergravatar for michael.dusan@gmail.comMichael Dusan <michael.dusan@gmail.com> 2023-09-26 07:51:32-04:00
log0c8bf405ebeab9b1c72ca31b4f066189d74048d0
tree70882e35b3833f418eac7fd80165338a893f2c62
parentebd0776b28c50169936b58f8ba05be70e854fd35
signaturelock-open Commit is signed but in an unrecognized format.

kubkon review changes: 4

- fix `darwin_sdk_layout.?` with null checks

2 files changed, 4 insertions(+), 4 deletions(-)

src/link/MachO.zig+2-2
......@@ -652,7 +652,7 @@ pub fn resolveLibSystem(
652652 "libSystem",
653653 )) break :success;
654654
655 switch (self.base.options.darwin_sdk_layout.?) {
655 if (self.base.options.darwin_sdk_layout) |sdk_layout| switch (sdk_layout) {
656656 .sdk => {
657657 const dir = try fs.path.join(tmp_arena, &[_][]const u8{ self.base.options.sysroot.?, "usr", "lib" });
658658 if (try accessLibPath(tmp_arena, &test_path, &checked_paths, dir, "libSystem")) break :success;
......@@ -661,7 +661,7 @@ pub fn resolveLibSystem(
661661 const dir = try comp.zig_lib_directory.join(tmp_arena, &[_][]const u8{ "libc", "darwin" });
662662 if (try accessLibPath(tmp_arena, &test_path, &checked_paths, dir, "libSystem")) break :success;
663663 },
664 }
664 };
665665
666666 try self.reportMissingLibraryError(checked_paths.items, "unable to find libSystem system library", .{});
667667 return;
src/link/MachO/load_commands.zig+2-2
......@@ -474,7 +474,7 @@ pub fn inferSdkVersion(gpa: Allocator, comp: *const Compilation) ?std.SemanticVe
474474
475475 const options = comp.bin_file.options;
476476
477 const sdk_layout = options.darwin_sdk_layout.?;
477 const sdk_layout = options.darwin_sdk_layout orelse return null;
478478 const sdk_dir = switch (sdk_layout) {
479479 .sdk => options.sysroot.?,
480480 .vendored => std.fs.path.join(arena, &.{ comp.zig_lib_directory.path.?, "libc", "darwin" }) catch return null,
......@@ -482,7 +482,7 @@ pub fn inferSdkVersion(gpa: Allocator, comp: *const Compilation) ?std.SemanticVe
482482 if (readSdkVersionFromSettings(arena, sdk_dir)) |ver| {
483483 return parseSdkVersion(ver);
484484 } else |_| {
485 // We control vendored and reading settings should always succeed.
485 // Read from settings should always succeed when vendored.
486486 if (sdk_layout == .vendored) @panic("zig installation bug: unable to parse SDK version");
487487 }
488488