From 2f9264d8dcedba3a75dcf9d6a31b82447dfc57e8 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 23 Mar 2022 13:02:42 -0700 Subject: stage2: fix -Domit-stage2 regression This flag is used when building stage1 to omit the stage2 backends from the compiler to save memory on the CI server. It regressed with the merging of e8813b296bc55a13b534bd9b2a03e1f6af366915 because Value functions started calling into Sema functions. The end goal for this build option is to eliminate it. --- src/Compilation.zig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/Compilation.zig') diff --git a/src/Compilation.zig b/src/Compilation.zig index e8b1ebb145..6487273e1f 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -2042,7 +2042,8 @@ pub fn update(comp: *Compilation) !void { comp.c_object_work_queue.writeItemAssumeCapacity(key); } - const use_stage1 = build_options.is_stage1 and comp.bin_file.options.use_stage1; + const use_stage1 = build_options.omit_stage2 or + (build_options.is_stage1 and comp.bin_file.options.use_stage1); if (comp.bin_file.options.module) |module| { module.compile_log_text.shrinkAndFree(module.gpa, 0); module.generation += 1; @@ -2198,7 +2199,8 @@ fn flush(comp: *Compilation) !void { try comp.bin_file.flush(comp); // This is needed before reading the error flags. comp.link_error_flags = comp.bin_file.errorFlags(); - const use_stage1 = build_options.is_stage1 and comp.bin_file.options.use_stage1; + const use_stage1 = build_options.omit_stage2 or + (build_options.is_stage1 and comp.bin_file.options.use_stage1); if (!use_stage1) { if (comp.bin_file.options.module) |module| { try link.File.C.flushEmitH(module); -- cgit v1.2.3