aboutsummaryrefslogtreecommitdiff
path: root/src/link.zig
diff options
context:
space:
mode:
authorRobin Voetter <robin@voetter.nl>2024-08-18 00:43:33 +0200
committerRobin Voetter <robin@voetter.nl>2024-08-19 19:09:11 +0200
commit43f73af3595c3174b8e67e9f2792c3774f2192e9 (patch)
tree5b178f2316304780f9e84abb60a4286a730ec194 /src/link.zig
parent54e48f7b7dec96c8cdd1a0a0491554b118767817 (diff)
downloadzig-43f73af3595c3174b8e67e9f2792c3774f2192e9.tar.gz
zig-43f73af3595c3174b8e67e9f2792c3774f2192e9.zip
fix various issues related to Path handling in the compiler and std
A compilation build step for which the binary is not required could not be compiled previously. There were 2 issues that caused this: - The compiler communicated only the results of the emitted binary and did not properly communicate the result if the binary was not emitted. This is fixed by communicating the final hash of the artifact path (the hash of the corresponding /o/<hash> directory) and communicating this instead of the entire path. This changes the zig build --listen protocol to communicate hashes instead of paths, and emit_bin_path is accordingly renamed to emit_digest. - There was an error related to the default llvm object path when CacheUse.Whole was selected. I'm not really sure why this didn't manifest when the binary is also emitted. This was fixed by improving the path handling related to flush() and emitLlvmObject(). In general, this commit also improves some of the path handling throughout the compiler and standard library.
Diffstat (limited to 'src/link.zig')
-rw-r--r--src/link.zig5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/link.zig b/src/link.zig
index b3e0aaa4a8..213b440c06 100644
--- a/src/link.zig
+++ b/src/link.zig
@@ -1029,7 +1029,10 @@ pub const File = struct {
llvm_object: LlvmObject.Ptr,
prog_node: std.Progress.Node,
) !void {
- return base.comp.emitLlvmObject(arena, base.emit, .{
+ return base.comp.emitLlvmObject(arena, .{
+ .root_dir = base.emit.directory,
+ .sub_path = std.fs.path.dirname(base.emit.sub_path) orelse "",
+ }, .{
.directory = null,
.basename = base.zcu_object_sub_path.?,
}, llvm_object, prog_node);