diff --git a/src/link.zig b/src/link.zig index 703dfb8739..42322cbda8 100644 --- a/src/link.zig +++ b/src/link.zig @@ -966,6 +966,8 @@ pub const File = struct { } pub fn linkAsArchive(base: *File, comp: *Compilation, prog_node: *std.Progress.Node) FlushError!void { + const emit = base.options.emit orelse return; + const tracy = trace(@src()); defer tracy.end(); @@ -973,8 +975,8 @@ pub const File = struct { defer arena_allocator.deinit(); const arena = arena_allocator.allocator(); - const directory = base.options.emit.?.directory; // Just an alias to make it shorter to type. - const full_out_path = try directory.join(arena, &[_][]const u8{base.options.emit.?.sub_path}); + const directory = emit.directory; // Just an alias to make it shorter to type. + const full_out_path = try directory.join(arena, &[_][]const u8{emit.sub_path}); const full_out_path_z = try arena.dupeZ(u8, full_out_path); // If there is no Zig code to compile, then we should skip flushing the output file diff --git a/src/link/Coff.zig b/src/link/Coff.zig index 8720fc1037..f1b914c368 100644 --- a/src/link/Coff.zig +++ b/src/link/Coff.zig @@ -1452,6 +1452,8 @@ pub fn updateDeclExports( if (self.llvm_object) |llvm_object| return llvm_object.updateDeclExports(mod, decl_index, exports); } + if (self.base.options.emit == null) return; + const gpa = self.base.allocator; const decl = mod.declPtr(decl_index); diff --git a/src/link/Elf.zig b/src/link/Elf.zig index 4bb049e074..ec4da9c728 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -2865,6 +2865,8 @@ pub fn updateDeclExports( if (self.llvm_object) |llvm_object| return llvm_object.updateDeclExports(mod, decl_index, exports); } + if (self.base.options.emit == null) return; + const tracy = trace(@src()); defer tracy.end(); diff --git a/src/link/MachO.zig b/src/link/MachO.zig index d124a1f51c..44e6acc397 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -2386,6 +2386,8 @@ pub fn updateDeclExports( return llvm_object.updateDeclExports(mod, decl_index, exports); } + if (self.base.options.emit == null) return; + const tracy = trace(@src()); defer tracy.end(); diff --git a/src/link/NvPtx.zig b/src/link/NvPtx.zig index fc3d659770..fd1504a3d3 100644 --- a/src/link/NvPtx.zig +++ b/src/link/NvPtx.zig @@ -106,10 +106,11 @@ pub fn flushModule(self: *NvPtx, comp: *Compilation, prog_node: *std.Progress.No if (build_options.skip_non_native) { @panic("Attempted to compile for architecture that was disabled by build configuration"); } + const outfile = comp.bin_file.options.emit orelse return; + const tracy = trace(@src()); defer tracy.end(); - const outfile = comp.bin_file.options.emit.?; // We modify 'comp' before passing it to LLVM, but restore value afterwards. // We tell LLVM to not try to build a .o, only an "assembly" file. // This is required by the LLVM PTX backend. diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index c2a2de398f..11294daa84 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -1712,6 +1712,8 @@ pub fn updateDeclExports( if (wasm.llvm_object) |llvm_object| return llvm_object.updateDeclExports(mod, decl_index, exports); } + if (wasm.base.options.emit == null) return; + const decl = mod.declPtr(decl_index); const atom_index = try wasm.getOrCreateAtomForDecl(decl_index); const atom = wasm.getAtom(atom_index);