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 {...@@ -1263,6 +1263,8 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
1263 // track it and packages as files.1263 // track it and packages as files.
1264 },1264 },
1265 }1265 }
1266
1267 // Synchronize with other matching comments: ZigOnlyHashStuff
1266 hash.add(valgrind);1268 hash.add(valgrind);
1267 hash.add(single_threaded);1269 hash.add(single_threaded);
1268 hash.add(use_stage1);1270 hash.add(use_stage1);
...@@ -1304,11 +1306,11 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {...@@ -1304,11 +1306,11 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
1304 errdefer artifact_dir.close();1306 errdefer artifact_dir.close();
1305 const zig_cache_artifact_directory: Directory = .{1307 const zig_cache_artifact_directory: Directory = .{
1306 .handle = artifact_dir,1308 .handle = artifact_dir,
1307 .path = if (options.local_cache_directory.path) |p|1309 .path = try options.local_cache_directory.join(arena, &[_][]const u8{artifact_sub_dir}),
1308 try std.fs.path.join(arena, &[_][]const u8{ p, artifact_sub_dir })
1309 else
1310 artifact_sub_dir,
1311 };1310 };
1311 log.debug("zig_cache_artifact_directory='{s}' use_stage1={}", .{
1312 zig_cache_artifact_directory.path, use_stage1,
1313 });
13121314
1313 const builtin_pkg = try Package.createWithDir(1315 const builtin_pkg = try Package.createWithDir(
1314 gpa,1316 gpa,
...@@ -2220,6 +2222,18 @@ fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifes...@@ -2220,6 +2222,18 @@ fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifes
2220 try addPackageTableToCacheHash(&man.hash, &arena_allocator, mod.main_pkg.table, &seen_table, .{ .files = man });2222 try addPackageTableToCacheHash(&man.hash, &arena_allocator, mod.main_pkg.table, &seen_table, .{ .files = man });
2221 }2223 }
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);
2223 man.hash.add(mod.emit_h != null);2237 man.hash.add(mod.emit_h != null);
2224 }2238 }
22252239