Skip to content

Conversation

mochaaP
Copy link

@mochaaP mochaaP commented May 5, 2025

Uses the /Brepro switch to freeze the __DATE__, __TIME__, __TIMESTAMP__ macros, and make FileDateStamp in the PE header a hash of the resulting binary.

This undocumented switch works on both clang-cl and MSVC.

Closes bazelbuild/bazel#5750

Uses the `/Brepro` switch to freeze the `__DATE__`, `__TIME__`, `__TIMESTAMP__` macros,
and make FileDateStamp in the PE header a hash of the resulting binary.

This undocumented switch works on both clang-cl and MSVC.
@fmeum
Copy link
Collaborator

fmeum commented May 5, 2025

@meteorcloudy

@meteorcloudy
Copy link
Member

@mochaaP Thanks! Is there a minimal version requirement for this flag?

@mochaaP
Copy link
Author

mochaaP commented May 5, 2025

I think this switch came out when they started testing reproducible builds on Windows 10, so it's likely around VS2013-2015.

I found an early mention of the flag here:
https://stackoverflow.com/questions/75891687/potential-downsides-of-brepro-msvc-linker-option

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows,C++: non-deterministic compilation because time/date macros are not redacted

3 participants