diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2023-08-31 22:04:24 +0200 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2023-08-31 22:04:24 +0200 |
| commit | 43adfd96892262373945e3697cdd820f700ae0a0 (patch) | |
| tree | 69b83715dbefd943acbe457d97c87b7d914fa32a | |
| parent | f4c9e19bc3213c2bc7e03d7b06d7129882f39f6c (diff) | |
| download | zig-43adfd96892262373945e3697cdd820f700ae0a0.tar.gz zig-43adfd96892262373945e3697cdd820f700ae0a0.zip | |
macho: check if fallback libSystem.{d}.tbd exists in Zig's installation
| -rw-r--r-- | src/link/MachO.zig | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/link/MachO.zig b/src/link/MachO.zig index ff5547cc19..fbbe253895 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -657,17 +657,17 @@ pub fn resolveLibSystem( if (try resolveLibSystemInDirs(arena, search_dirs, out_libs)) return; // As a fallback, try linking against Zig shipped stub. - const libsystem_name = try std.fmt.allocPrint(arena, "libSystem.{d}.tbd", .{ + const libsystem_name = try std.fmt.allocPrint(arena, "libSystem.{d}", .{ target.os.version_range.semver.min.major, }); - const full_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ - "libc", "darwin", libsystem_name, - }); - try out_libs.put(full_path, .{ - .needed = true, - .weak = false, - .path = full_path, - }); + const full_dir_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libc", "darwin" }); + if (try resolveLib(arena, full_dir_path, libsystem_name, ".tbd")) |full_path| { + try out_libs.put(full_path, .{ + .needed = true, + .weak = false, + .path = full_path, + }); + } } fn resolveLibSystemInDirs(arena: Allocator, dirs: []const []const u8, out_libs: anytype) !bool { |
