| author | |
| committer | |
| log | b55a3cefa49549e62dbd40f385cc0a5b4b6433b3 |
| tree | 89b09ccde47abbb0d6dc925f537b6f2cbbdcd4b7 |
| parent | bc78b02c04143b7e1b32aceacdcf44130026a7a7 |
3 files changed, 3 insertions(+), 19 deletions(-)
src/Compilation.zig-15| ... | ... | @@ -919,20 +919,6 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { |
| 919 | 919 | } |
| 920 | 920 | }; |
| 921 | 921 | |
| 922 | const libc_stub_path: ?[]const u8 = if (options.target.isDarwin()) libc_stub: { | |
| 923 | // TODO consider other platforms than Darwin which require linking against libc here. | |
| 924 | const needs_libc_stub: bool = switch (options.output_mode) { | |
| 925 | .Obj => false, | |
| 926 | .Lib => if (options.link_mode) |mode| mode == .Dynamic else false, | |
| 927 | .Exe => true, | |
| 928 | }; | |
| 929 | if (needs_libc_stub) { | |
| 930 | break :libc_stub try options.zig_lib_directory.join(arena, &[_][]const u8{ | |
| 931 | "libc", "darwin", "libSystem.B.tbd", | |
| 932 | }); | |
| 933 | } else break :libc_stub null; | |
| 934 | } else null; | |
| 935 | ||
| 936 | 922 | const must_dynamic_link = dl: { |
| 937 | 923 | if (target_util.cannotDynamicLink(options.target)) |
| 938 | 924 | break :dl false; |
| ... | ... | @@ -1302,7 +1288,6 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { |
| 1302 | 1288 | .use_lld = use_lld, |
| 1303 | 1289 | .use_llvm = use_llvm, |
| 1304 | 1290 | .system_linker_hack = darwin_options.system_linker_hack, |
| 1305 | .libc_stub_path = libc_stub_path, | |
| 1306 | 1291 | .link_libc = link_libc, |
| 1307 | 1292 | .link_libcpp = link_libcpp, |
| 1308 | 1293 | .link_libunwind = link_libunwind, |
src/link.zig-3| ... | ... | @@ -62,9 +62,6 @@ pub const Options = struct { |
| 62 | 62 | /// Darwin-only. If this is true, `use_llvm` is true, and `is_native_os` is true, this link code will |
| 63 | 63 | /// use system linker `ld` instead of the LLD. |
| 64 | 64 | system_linker_hack: bool, |
| 65 | /// Path to Zig-hosted libc stub file. | |
| 66 | /// On Darwin, this is a path to libSystem.B.tbd stub file. | |
| 67 | libc_stub_path: ?[]const u8, | |
| 68 | 65 | link_libc: bool, |
| 69 | 66 | link_libcpp: bool, |
| 70 | 67 | link_libunwind: bool, |
src/link/MachO.zig+3-1| ... | ... | @@ -848,7 +848,9 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void { |
| 848 | 848 | try zld.link(positionals.items, full_out_path, .{ |
| 849 | 849 | .libs = libs.items, |
| 850 | 850 | .rpaths = rpaths.items, |
| 851 | .libc_stub_path = self.base.options.libc_stub_path.?, | |
| 851 | .libc_stub_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ | |
| 852 | "libc", "darwin", "libSystem.B.tbd", | |
| 853 | }), | |
| 852 | 854 | }); |
| 853 | 855 | |
| 854 | 856 | break :outer; |