| author | |
| committer | |
| log | 0c8bf405ebeab9b1c72ca31b4f066189d74048d0 |
| tree | 70882e35b3833f418eac7fd80165338a893f2c62 |
| parent | ebd0776b28c50169936b58f8ba05be70e854fd35 |
| signature |
- fix `darwin_sdk_layout.?` with null checks2 files changed, 4 insertions(+), 4 deletions(-)
src/link/MachO.zig+2-2| ... | @@ -652,7 +652,7 @@ pub fn resolveLibSystem( | ... | @@ -652,7 +652,7 @@ pub fn resolveLibSystem( |
| 652 | "libSystem", | 652 | "libSystem", |
| 653 | )) break :success; | 653 | )) break :success; |
| 654 | 654 | ||
| 655 | switch (self.base.options.darwin_sdk_layout.?) { | 655 | if (self.base.options.darwin_sdk_layout) |sdk_layout| switch (sdk_layout) { |
| 656 | .sdk => { | 656 | .sdk => { |
| 657 | const dir = try fs.path.join(tmp_arena, &[_][]const u8{ self.base.options.sysroot.?, "usr", "lib" }); | 657 | const dir = try fs.path.join(tmp_arena, &[_][]const u8{ self.base.options.sysroot.?, "usr", "lib" }); |
| 658 | if (try accessLibPath(tmp_arena, &test_path, &checked_paths, dir, "libSystem")) break :success; | 658 | if (try accessLibPath(tmp_arena, &test_path, &checked_paths, dir, "libSystem")) break :success; |
| ... | @@ -661,7 +661,7 @@ pub fn resolveLibSystem( | ... | @@ -661,7 +661,7 @@ pub fn resolveLibSystem( |
| 661 | const dir = try comp.zig_lib_directory.join(tmp_arena, &[_][]const u8{ "libc", "darwin" }); | 661 | const dir = try comp.zig_lib_directory.join(tmp_arena, &[_][]const u8{ "libc", "darwin" }); |
| 662 | if (try accessLibPath(tmp_arena, &test_path, &checked_paths, dir, "libSystem")) break :success; | 662 | if (try accessLibPath(tmp_arena, &test_path, &checked_paths, dir, "libSystem")) break :success; |
| 663 | }, | 663 | }, |
| 664 | } | 664 | }; |
| 665 | 665 | ||
| 666 | try self.reportMissingLibraryError(checked_paths.items, "unable to find libSystem system library", .{}); | 666 | try self.reportMissingLibraryError(checked_paths.items, "unable to find libSystem system library", .{}); |
| 667 | return; | 667 | return; |
src/link/MachO/load_commands.zig+2-2| ... | @@ -474,7 +474,7 @@ pub fn inferSdkVersion(gpa: Allocator, comp: *const Compilation) ?std.SemanticVe | ... | @@ -474,7 +474,7 @@ pub fn inferSdkVersion(gpa: Allocator, comp: *const Compilation) ?std.SemanticVe |
| 474 | 474 | ||
| 475 | const options = comp.bin_file.options; | 475 | const options = comp.bin_file.options; |
| 476 | 476 | ||
| 477 | const sdk_layout = options.darwin_sdk_layout.?; | 477 | const sdk_layout = options.darwin_sdk_layout orelse return null; |
| 478 | const sdk_dir = switch (sdk_layout) { | 478 | const sdk_dir = switch (sdk_layout) { |
| 479 | .sdk => options.sysroot.?, | 479 | .sdk => options.sysroot.?, |
| 480 | .vendored => std.fs.path.join(arena, &.{ comp.zig_lib_directory.path.?, "libc", "darwin" }) catch return null, | 480 | .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 | ... | @@ -482,7 +482,7 @@ pub fn inferSdkVersion(gpa: Allocator, comp: *const Compilation) ?std.SemanticVe |
| 482 | if (readSdkVersionFromSettings(arena, sdk_dir)) |ver| { | 482 | if (readSdkVersionFromSettings(arena, sdk_dir)) |ver| { |
| 483 | return parseSdkVersion(ver); | 483 | return parseSdkVersion(ver); |
| 484 | } else |_| { | 484 | } else |_| { |
| 485 | // We control vendored and reading settings should always succeed. | 485 | // Read from settings should always succeed when vendored. |
| 486 | if (sdk_layout == .vendored) @panic("zig installation bug: unable to parse SDK version"); | 486 | if (sdk_layout == .vendored) @panic("zig installation bug: unable to parse SDK version"); |
| 487 | } | 487 | } |
| 488 | 488 |