authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-01-02 18:54:16-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-01-02 18:54:47-07:00
log663ffa5a7a1d53d1adf9c1ea6991aad8bf82aadc
tree18d0b54612dd1eae16d08d01401510032975bae1
parent5e086b2b4c4558681cc23c6cc602704fd06d6fc8

stage2: fix missing items from whole cache mode hash

Without this, Zig would re-use a compiler-rt built with stage2 when one built by stage1 was needed.

1 files changed, 18 insertions(+), 4 deletions(-)

src/Compilation.zig+18-4
......@@ -1263,6 +1263,8 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
12631263 // track it and packages as files.
12641264 },
12651265 }
1266
1267 // Synchronize with other matching comments: ZigOnlyHashStuff
12661268 hash.add(valgrind);
12671269 hash.add(single_threaded);
12681270 hash.add(use_stage1);
......@@ -1304,11 +1306,11 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
13041306 errdefer artifact_dir.close();
13051307 const zig_cache_artifact_directory: Directory = .{
13061308 .handle = artifact_dir,
1307 .path = if (options.local_cache_directory.path) |p|
1308 try std.fs.path.join(arena, &[_][]const u8{ p, artifact_sub_dir })
1309 else
1310 artifact_sub_dir,
1309 .path = try options.local_cache_directory.join(arena, &[_][]const u8{artifact_sub_dir}),
13111310 };
1311 log.debug("zig_cache_artifact_directory='{s}' use_stage1={}", .{
1312 zig_cache_artifact_directory.path, use_stage1,
1313 });
13121314
13131315 const builtin_pkg = try Package.createWithDir(
13141316 gpa,
......@@ -2220,6 +2222,18 @@ fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifes
22202222 try addPackageTableToCacheHash(&man.hash, &arena_allocator, mod.main_pkg.table, &seen_table, .{ .files = man });
22212223 }
22222224
2225 // Synchronize with other matching comments: ZigOnlyHashStuff
2226 man.hash.add(comp.bin_file.options.valgrind);
2227 man.hash.add(comp.bin_file.options.single_threaded);
2228 man.hash.add(comp.bin_file.options.use_stage1);
2229 man.hash.add(comp.bin_file.options.use_llvm);
2230 man.hash.add(comp.bin_file.options.dll_export_fns);
2231 man.hash.add(comp.bin_file.options.is_test);
2232 man.hash.add(comp.test_evented_io);
2233 man.hash.addOptionalBytes(comp.test_filter);
2234 man.hash.addOptionalBytes(comp.test_name_prefix);
2235 man.hash.add(comp.bin_file.options.skip_linker_dependencies);
2236 man.hash.add(comp.bin_file.options.parent_compilation_link_libc);
22232237 man.hash.add(mod.emit_h != null);
22242238 }
22252239