aboutsummaryrefslogtreecommitdiff
path: root/src/link/Coff.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-09-29 21:48:50 -0700
committerAndrew Kelley <andrew@ziglang.org>2020-09-29 21:48:50 -0700
commit839bdfdc93b1d2a2a4ed6f7c9ca3155323242d82 (patch)
tree678f299c92cdc7783fadbcf581d3fedfc565f2f1 /src/link/Coff.zig
parent7bffa6f1fb9148aed65f5ca55156dbb0e766c92e (diff)
downloadzig-839bdfdc93b1d2a2a4ed6f7c9ca3155323242d82.tar.gz
zig-839bdfdc93b1d2a2a4ed6f7c9ca3155323242d82.zip
link.Coff: skip redundant (and invalid) copy to same path
Diffstat (limited to 'src/link/Coff.zig')
-rw-r--r--src/link/Coff.zig6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/link/Coff.zig b/src/link/Coff.zig
index 2290560509..3f462582e7 100644
--- a/src/link/Coff.zig
+++ b/src/link/Coff.zig
@@ -893,7 +893,11 @@ fn linkWithLLD(self: *Coff, comp: *Compilation) !void {
// regarding eliding redundant object -> object transformations.
return error.NoObjectsToLink;
};
- try fs.cwd().copyFile(the_object_path, fs.cwd(), full_out_path, .{});
+ // This can happen when using --enable-cache and using the stage1 backend. In this case
+ // we can skip the file copy.
+ if (!mem.eql(u8, the_object_path, full_out_path)) {
+ try fs.cwd().copyFile(the_object_path, fs.cwd(), full_out_path, .{});
+ }
} else {
// Create an LLD command line and invoke it.
var argv = std.ArrayList([]const u8).init(self.base.allocator);