Commit 57afdfc8fa

Andrew Kelley <andrew@ziglang.org>
2023-12-16 21:49:03
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
1 parent b1fc3fe
Changed files (2)
src/Compilation.zig
@@ -2336,11 +2336,6 @@ fn wholeCacheModeSetBinFilePath(
 
     if (whole.bin_sub_path) |sub_path| {
         @memcpy(sub_path[digest_start..][0..digest.len], digest);
-
-        comp.bin_file.?.emit = .{
-            .directory = comp.local_cache_directory,
-            .sub_path = sub_path,
-        };
     }
 
     if (whole.implib_sub_path) |sub_path| {
@@ -6243,12 +6238,7 @@ fn buildOutputFromZig(
     try comp.updateSubCompilation(sub_compilation, misc_task_tag, prog_node);
 
     assert(out.* == null);
-    out.* = .{
-        .full_object_path = try sub_compilation.bin_file.?.emit.directory.join(gpa, &.{
-            sub_compilation.bin_file.?.emit.sub_path,
-        }),
-        .lock = sub_compilation.bin_file.?.toOwnedLock(),
-    };
+    out.* = try sub_compilation.toCrtFile();
 }
 
 pub fn build_crt_file(
src/musl.zig
@@ -276,12 +276,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr
             const basename = try comp.gpa.dupe(u8, "libc.so");
             errdefer comp.gpa.free(basename);
 
-            comp.crt_files.putAssumeCapacityNoClobber(basename, .{
-                .full_object_path = try sub_compilation.bin_file.?.emit.directory.join(comp.gpa, &.{
-                    sub_compilation.bin_file.?.emit.sub_path,
-                }),
-                .lock = sub_compilation.bin_file.?.toOwnedLock(),
-            });
+            comp.crt_files.putAssumeCapacityNoClobber(basename, try sub_compilation.toCrtFile());
         },
     }
 }