diff --git a/src/Compilation.zig b/src/Compilation.zig index ac48804848..ddf331d4f3 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -899,7 +899,10 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { break :blk build_options.is_stage1; }; - const cache_mode = if (use_stage1) CacheMode.whole else options.cache_mode; + const cache_mode = if (use_stage1 and !options.disable_lld_caching) + CacheMode.whole + else + options.cache_mode; // Make a decision on whether to use LLVM or our own backend. const use_llvm = build_options.have_llvm and blk: { @@ -1951,8 +1954,6 @@ pub fn update(comp: *Compilation) !void { }; } - comp.emitOthers(); - assert(comp.bin_file.lock == null); comp.bin_file.lock = man.toOwnedLock(); return; diff --git a/src/stage1.zig b/src/stage1.zig index a5be1b78fe..384988dc07 100644 --- a/src/stage1.zig +++ b/src/stage1.zig @@ -458,7 +458,10 @@ export fn stage2_fetch_file( const comp = @intToPtr(*Compilation, stage1.userdata); const file_path = path_ptr[0..path_len]; const max_file_size = std.math.maxInt(u32); - const contents = comp.whole_cache_manifest.?.addFilePostFetch(file_path, max_file_size) catch return null; + const contents = if (comp.whole_cache_manifest) |man| + man.addFilePostFetch(file_path, max_file_size) catch return null + else + std.fs.cwd().readFileAlloc(comp.gpa, file_path, max_file_size) catch return null; result_len.* = contents.len; // TODO https://github.com/ziglang/zig/issues/3328#issuecomment-716749475 if (contents.len == 0) return @intToPtr(?[*]const u8, 0x1);