What if I use the __DATE__ macro?
https://github.com/bazelbuild/bazel/blob/34ce6a23f5a2be58bb5...
I don't know enough about bazel to answer your question definitively, but "stamping" is what you want to search for.
It checksums the preprocessed files, so neither `__DATE__`, no comment changes should affect your build times.
The .a/.so/.exe would no longer match the inputs (the .o files), causing a re-link.