diff --git a/src/Compilation.zig b/src/Compilation.zig index 5b14eacc06..8b761cd450 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -1985,7 +1985,7 @@ pub fn update(comp: *Compilation) !void { // This resets the link.File to operate as if we called openPath() in create() // instead of simulating -fno-emit-bin. - var options = comp.bin_file.options; + var options = comp.bin_file.options.move(); if (comp.whole_bin_sub_path) |sub_path| { options.emit = .{ .directory = tmp_artifact_directory.?, diff --git a/src/link.zig b/src/link.zig index 215d24adca..a720bdada2 100644 --- a/src/link.zig +++ b/src/link.zig @@ -167,6 +167,12 @@ pub const Options = struct { pub fn effectiveOutputMode(options: Options) std.builtin.OutputMode { return if (options.use_lld) .Obj else options.output_mode; } + + pub fn move(self: *Options) Options { + const copied_state = self.*; + self.system_libs = .{}; + return copied_state; + } }; pub const File = struct {