From c15755092821c5c27727ebf416689084eab5b73e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Sun, 28 Jul 2024 15:56:45 +0200 Subject: [PATCH] link.Coff: Basic support for `/Brepro` in the self-hosted linker. Just keep things simple and zero the timestamp. It's not obvious that there's any real benefit to adding complexity and harming performance by computing a hash of the whole file for the timestamp value. See: * https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#general-concepts * https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#debug-type In the future, we should at least add an empty `IMAGE_DEBUG_TYPE_REPRO` entry to the debug data directory for this case, but I didn't want to do too much surgery right now since it's early days for COFF support in the self-hosted linker. --- src/link/Coff.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/link/Coff.zig b/src/link/Coff.zig index 8102c84f6f..a7b16e9bd5 100644 --- a/src/link/Coff.zig +++ b/src/link/Coff.zig @@ -2289,7 +2289,7 @@ fn writeHeader(self: *Coff) !void { flags.DLL = 1; } - const timestamp = std.time.timestamp(); + const timestamp = if (self.repro) 0 else std.time.timestamp(); const size_of_optional_header = @as(u16, @intCast(self.getOptionalHeaderSize() + self.getDataDirectoryHeadersSize())); var coff_header = coff.CoffHeader{ .machine = coff.MachineType.fromTargetCpuArch(target.cpu.arch),