Skip to content

Commit a6b78e2

Browse files
committed
linker: update link_mode references
1 parent 4d2fe43 commit a6b78e2

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/link.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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,15 +423,15 @@ 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
};
430430
const d_str = switch (optimize_mode) {
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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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 {
19101910
fn 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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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(

0 commit comments

Comments
 (0)