authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-12-16 13:49:03-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-01 17:51:20-07:00
log57afdfc8fae667e69850650ebb8606805d0d2272
tree99bfdad275c3fc0dc00415377ca40f3d577cf89a
parentb1fc3fe1c42d50a40eee985f059a4f43a5f1ce1a

compilation: fix build artifact communication from sub-compilation

in whole cache mode, build artifacts are communicated by accessing the whole cache information, for which there is a helper method called toCrtFile

2 files changed, 2 insertions(+), 17 deletions(-)

src/Compilation.zig+1-11
......@@ -2336,11 +2336,6 @@ fn wholeCacheModeSetBinFilePath(
23362336
23372337 if (whole.bin_sub_path) |sub_path| {
23382338 @memcpy(sub_path[digest_start..][0..digest.len], digest);
2339
2340 comp.bin_file.?.emit = .{
2341 .directory = comp.local_cache_directory,
2342 .sub_path = sub_path,
2343 };
23442339 }
23452340
23462341 if (whole.implib_sub_path) |sub_path| {
......@@ -6243,12 +6238,7 @@ fn buildOutputFromZig(
62436238 try comp.updateSubCompilation(sub_compilation, misc_task_tag, prog_node);
62446239
62456240 assert(out.* == null);
6246 out.* = .{
6247 .full_object_path = try sub_compilation.bin_file.?.emit.directory.join(gpa, &.{
6248 sub_compilation.bin_file.?.emit.sub_path,
6249 }),
6250 .lock = sub_compilation.bin_file.?.toOwnedLock(),
6251 };
6241 out.* = try sub_compilation.toCrtFile();
62526242}
62536243
62546244pub fn build_crt_file(
src/musl.zig+1-6
......@@ -276,12 +276,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr
276276 const basename = try comp.gpa.dupe(u8, "libc.so");
277277 errdefer comp.gpa.free(basename);
278278
279 comp.crt_files.putAssumeCapacityNoClobber(basename, .{
280 .full_object_path = try sub_compilation.bin_file.?.emit.directory.join(comp.gpa, &.{
281 sub_compilation.bin_file.?.emit.sub_path,
282 }),
283 .lock = sub_compilation.bin_file.?.toOwnedLock(),
284 });
279 comp.crt_files.putAssumeCapacityNoClobber(basename, try sub_compilation.toCrtFile());
285280 },
286281 }
287282}