On 11/20/21 09:32, Jakub Jelinek wrote:
On Sat, Nov 20, 2021 at 12:24:21AM -0800, Andrew Pinski via Gcc-patches wrote:
On Sat, Nov 20, 2021 at 12:18 AM Jacob Kroon via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
cc1/cc1plus both include a checksum of the object files, archives and
options used during linking. Unless the host binutils has been built
with --enable-deterministic-archives, the archives will have different
checksums each build due to changes in timestamps of the containing
object files, and thus the checksum that is embedded in cc1/cc1plus will
also change.
Fix this by passing "D" to ar/ranlib when creating the archives.
How portable is the D option? That does it work with Mac OS X's ar;
what about AIX's ar; what about Solaris's ar, etc?
GNU binutils is not the only ar which is supported for the host.
It isn't portable and even if ar/ranlib do support that option, not all
users will want it, so forcing it upon them unconditionally is IMO not a
good idea. If anything, configure needs to check if those options are
supported and there needs to be preferrably non-default gcc configure
option to request it.
Aha, I see. Then perhaps an easier and more portable solution for
improving the reproducibility would be to make it optional whether or
not to include the archives when calculating the checksums.
Or perhaps by checksumming the containing object files instead of the
archives themselves ?
Would something like that be acceptable ?
Jacob