Description
#20985 once again highlighted the importance of reproducible builds. While investigating that, I noticed time-based differences in the built executables. That's because the backend writes a timestamp to the header:
dmd/compiler/src/dmd/backend/mscoffobj.d
Lines 653 to 664 in 001893d
After looking into what that field is even used for, I found:
https://devblogs.microsoft.com/oldnewthing/20180103-00/?p=97705
One of the changes to the Windows engineering system begun in Windows 10 is the move toward reproducible builds. This means that if you start
with the exact same source code, then you should finish with the exact same binary code.
The timestamp is really a unique ID that tells the loader, “The exports of this DLL have not changed since the last time anybody bound to it.” And a hash is a reproducible unique ID.
I think dmd should follow this example. Not just for MSCoff, also for ELF and MachObj.