-
-
Notifications
You must be signed in to change notification settings - Fork 650
TimeDateStamp in object files should be a deterministic hash #21095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think I understand what's going on. In I'd like to fix this, but I'm not sure which way to go. Like, we can just use a fixed value like 0 for the timestamp. This definitely makes builds deterministic. I tried this thing and compiled same code at different times, and the object file was the same hash.
But is it the right approach to tackle this issue or maybe like we need to create some kind of hash based on what's in the object file? I would love to hear your suggestions. |
Just use |
@Geod24 Did u mean like this?
|
That was my first idea as well, but I don't like how you have to set an environment variable to make builds reproducible even if you don't use
I'd rather follow Microsoft's example here and hash the binary. |
#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
I think dmd should follow this example. Not just for MSCoff, also for ELF and MachObj.
The text was updated successfully, but these errors were encountered: