authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-12-11 21:23:12-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-01 17:51:19-07:00
logb5e2af49a0469c7f96ebabb8e796585d53382e7d
treec59019f44d7e871a3771c4d38a86e4919f5e6c79
parent6ec6c077957c8d1f96d83299b35f6c84a34b07e6

linker: update link_mode references


5 files changed, 10 insertions(+), 10 deletions(-)

src/link.zig+1-1
......@@ -1098,7 +1098,7 @@ pub const File = struct {
10981098 }
10991099
11001100 pub fn isStatic(self: File) bool {
1101 return self.base.options.link_mode == .Static;
1101 return self.base.comp.config.link_mode == .Static;
11021102 }
11031103
11041104 pub fn isObject(self: File) bool {
src/link/Coff.zig+1-1
......@@ -2218,7 +2218,7 @@ fn writeHeader(self: *Coff) !void {
22182218 .p32 => flags.@"32BIT_MACHINE" = 1,
22192219 .p64 => flags.LARGE_ADDRESS_AWARE = 1,
22202220 }
2221 if (self.base.comp.config.output_mode == .Lib and self.base.options.link_mode == .Dynamic) {
2221 if (self.base.comp.config.output_mode == .Lib and self.base.comp.config.link_mode == .Dynamic) {
22222222 flags.DLL = 1;
22232223 }
22242224
src/link/Coff/lld.zig+3-3
......@@ -46,7 +46,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod
4646 defer sub_prog_node.end();
4747
4848 const is_lib = self.base.comp.config.output_mode == .Lib;
49 const is_dyn_lib = self.base.options.link_mode == .Dynamic and is_lib;
49 const is_dyn_lib = self.base.comp.config.link_mode == .Dynamic and is_lib;
5050 const is_exe_or_dyn_lib = is_dyn_lib or self.base.comp.config.output_mode == .Exe;
5151 const link_in_crt = self.base.options.link_libc and is_exe_or_dyn_lib;
5252 const target = self.base.options.target;
......@@ -423,7 +423,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod
423423 }
424424 }
425425 } else {
426 const lib_str = switch (self.base.options.link_mode) {
426 const lib_str = switch (self.base.comp.config.link_mode) {
427427 .Dynamic => "",
428428 .Static => "lib",
429429 };
......@@ -431,7 +431,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod
431431 .Debug => "d",
432432 else => "",
433433 };
434 switch (self.base.options.link_mode) {
434 switch (self.base.comp.config.link_mode) {
435435 .Static => try argv.append(try allocPrint(arena, "libcmt{s}.lib", .{d_str})),
436436 .Dynamic => try argv.append(try allocPrint(arena, "msvcrt{s}.lib", .{d_str})),
437437 }
src/link/MachO.zig+3-3
......@@ -320,7 +320,7 @@ pub fn flush(self: *MachO, comp: *Compilation, prog_node: *std.Progress.Node) li
320320 const gpa = self.base.comp.gpa;
321321 const output_mode = self.base.comp.config.output_mode;
322322
323 if (output_mode == .Lib and self.base.options.link_mode == .Static) {
323 if (output_mode == .Lib and self.base.comp.config.link_mode == .Static) {
324324 if (build_options.have_llvm) {
325325 return self.base.linkAsArchive(comp, prog_node);
326326 } else {
......@@ -608,7 +608,7 @@ pub fn flushModule(self: *MachO, comp: *Compilation, prog_node: *std.Progress.No
608608 .stacksize = self.base.stack_size,
609609 });
610610 },
611 .Lib => if (self.base.options.link_mode == .Dynamic) {
611 .Lib => if (self.base.comp.config.link_mode == .Dynamic) {
612612 try load_commands.writeDylibIdLC(gpa, &self.base.options, lc_writer);
613613 },
614614 else => {},
......@@ -1910,7 +1910,7 @@ fn resolveSymbolsInDylibs(self: *MachO) !void {
19101910fn resolveSymbolsAtLoading(self: *MachO) !void {
19111911 const output_mode = self.base.comp.config.output_mode;
19121912 const is_lib = output_mode == .Lib;
1913 const is_dyn_lib = self.base.options.link_mode == .Dynamic and is_lib;
1913 const is_dyn_lib = self.base.comp.config.link_mode == .Dynamic and is_lib;
19141914 const allow_undef = is_dyn_lib and self.base.allow_shlib_undefined;
19151915
19161916 var next_sym: usize = 0;
src/link/Wasm.zig+2-2
......@@ -4750,7 +4750,7 @@ fn linkWithLLD(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) !
47504750 try argv.append("--allow-undefined");
47514751 }
47524752
4753 if (wasm.base.comp.config.output_mode == .Lib and wasm.base.options.link_mode == .Dynamic) {
4753 if (wasm.base.comp.config.output_mode == .Lib and wasm.base.comp.config.link_mode == .Dynamic) {
47544754 try argv.append("--shared");
47554755 }
47564756 if (wasm.base.options.pie) {
......@@ -4770,7 +4770,7 @@ fn linkWithLLD(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) !
47704770
47714771 if (target.os.tag == .wasi) {
47724772 const is_exe_or_dyn_lib = wasm.base.comp.config.output_mode == .Exe or
4773 (wasm.base.comp.config.output_mode == .Lib and wasm.base.options.link_mode == .Dynamic);
4773 (wasm.base.comp.config.output_mode == .Lib and wasm.base.comp.config.link_mode == .Dynamic);
47744774 if (is_exe_or_dyn_lib) {
47754775 for (wasm.wasi_emulated_libs) |crt_file| {
47764776 try argv.append(try comp.get_libc_crt_file(