authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-04-21 11:17:26-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-04-21 13:29:46-07:00
logffaa045429c946eaafc199e82b8831cb1e2f637d
treecd70347e7835e7fca652860e8dd84f31f5d37e28
parentebfddbaf0038c62f9560a8bf7134b401fb0e4d19

stage2: add zig_backend to the cache hash

This makes stage2 and stage3 have different cache namespaces, so that building something with stage3 does not try to reuse the same cached artifacts as were produced by stage2. This makes sense since the code of stage3 is produced by the self-hosted compiler, whereas the code of stage2 is produced by the bootstrap compiler. Note also that stage4 and stage3 will share the same zig_backend, end hence cache namespace. Ideally stage4 and stage3 are identical binaries, so this checks out.

1 files changed, 1 insertions(+), 0 deletions(-)

src/Compilation.zig+1
...@@ -1224,6 +1224,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {...@@ -1224,6 +1224,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
12241224
1225 // This is shared hasher state common to zig source and all C source files.1225 // This is shared hasher state common to zig source and all C source files.
1226 cache.hash.addBytes(build_options.version);1226 cache.hash.addBytes(build_options.version);
1227 cache.hash.add(builtin.zig_backend);
1227 cache.hash.addBytes(options.zig_lib_directory.path orelse ".");1228 cache.hash.addBytes(options.zig_lib_directory.path orelse ".");
1228 cache.hash.add(options.optimize_mode);1229 cache.hash.add(options.optimize_mode);
1229 cache.hash.add(options.target.cpu.arch);1230 cache.hash.add(options.target.cpu.arch);