Commit f20929bd8b

Andrew Kelley <andrew@ziglang.org>
2022-02-17 21:12:31
stage2: fix crash using -femit-bin
1 parent 63cbec1
Changed files (2)
src/Compilation.zig
@@ -2771,6 +2771,8 @@ fn processOneJob(comp: *Compilation, job: Job, main_progress_node: *std.Progress
                 sema_frame.end();
                 sema_frame_ended = true;
 
+                if (comp.bin_file.options.emit == null) return;
+
                 const liveness_frame = tracy.namedFrame("liveness");
                 var liveness_frame_ended = false;
                 errdefer if (!liveness_frame_ended) liveness_frame.end();
src/Module.zig
@@ -5266,7 +5266,11 @@ pub fn populateTestFunctions(mod: *Module) !void {
 }
 
 pub fn linkerUpdateDecl(mod: *Module, decl: *Decl) !void {
-    mod.comp.bin_file.updateDecl(mod, decl) catch |err| switch (err) {
+    const comp = mod.comp;
+
+    if (comp.bin_file.options.emit == null) return;
+
+    comp.bin_file.updateDecl(mod, decl) catch |err| switch (err) {
         error.OutOfMemory => return error.OutOfMemory,
         error.AnalysisFail => {
             decl.analysis = .codegen_failure;