authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-09-29 21:48:50-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-09-29 21:48:50-07:00
log839bdfdc93b1d2a2a4ed6f7c9ca3155323242d82
tree678f299c92cdc7783fadbcf581d3fedfc565f2f1
parent7bffa6f1fb9148aed65f5ca55156dbb0e766c92e

link.Coff: skip redundant (and invalid) copy to same path


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

src/link/Coff.zig+5-1
......@@ -893,7 +893,11 @@ fn linkWithLLD(self: *Coff, comp: *Compilation) !void {
893893 // regarding eliding redundant object -> object transformations.
894894 return error.NoObjectsToLink;
895895 };
896 try fs.cwd().copyFile(the_object_path, fs.cwd(), full_out_path, .{});
896 // This can happen when using --enable-cache and using the stage1 backend. In this case
897 // we can skip the file copy.
898 if (!mem.eql(u8, the_object_path, full_out_path)) {
899 try fs.cwd().copyFile(the_object_path, fs.cwd(), full_out_path, .{});
900 }
897901 } else {
898902 // Create an LLD command line and invoke it.
899903 var argv = std.ArrayList([]const u8).init(self.base.allocator);