[patch] objcopy embeds the current time and ignores SOURCE_DATE_EPOCH making the output unreproducible

Johannes Schauer Marin Rodrigues josch@debian.org
Thu Jul 20 23:15:05 GMT 2023


Hi,

Quoting Nick Clifton (2023-07-20 13:08:35)
> >>     * Updating the description of the --timestamp command line option in
> >>       ld/ld.texi to mention that if SOURCE_DATE_EPOCH is defined in the
> >>      environment then this will be used instead of the current time.
> > I'm a bit confused here. I'm fixing objcopy but am supposed to edit ld/ld.texi?
> Ah - I think that we were both confused.  You see the code that you are patching
> in bfd/peXXigen.c is used by both the linker and objcopy.  I was tracking down
> where the timestamp field in the pe_data_type structure was set, and I got diverted
> to ld/emultempl/pe.em, which is why I thought about updating the linker documentation.
> 
> So anyway, both the linker documentation *and* the objcopy documentation need to
> be updated...

where would you put it in the objcopy docs? I put it to the
--deterministic-libraries option because that's the option I was consulting
when I wanted to know how to make the timestamp reproducible.

> > Also, there is another instance of something calling time(0) in ld/pe-dll.c. I
> > don't know what that does. Does it need fixing as well?
> Good catch.  Yes that will need the same kind of change as peXXigen.c.

Done.

> If you could resubmit your patch (to the list)

Whoops, seems my last mail didn't have the list in CC.

> with these changes and accompanied
> by a DCO then I will approve and apply it.

With DCO you mean this, right? https://gcc.gnu.org/dco.html

I agree to the Developer's Certificate of Origin (version 1.1 or later) and
added a Signed-off-by to my commit accordingly.

If only minor problems remain with the patch, feel free to correct those,
depending on whether you'd spend less time with amending my patch or writing
me an email about the issues you found. :)

Thanks!

cheers, josch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-bfd-peXXigen.c-respect-SOURCE_DATE_EPOCH-environment.patch
Type: text/x-diff
Size: 3679 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20230721/efa13eaa/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: signature
URL: <https://sourceware.org/pipermail/binutils/attachments/20230721/efa13eaa/attachment.sig>


More information about the Binutils mailing list