This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Facilitate deterministic pe executables between linker invocations
- From: Cory Fields <cory at coryfields dot com>
- To: nick clifton <nickc at redhat dot com>
- Cc: binutils <binutils at sourceware dot org>
- Date: Wed, 20 Nov 2013 11:36:49 -0500
- Subject: Re: [PATCH] Facilitate deterministic pe executables between linker invocations
- Authentication-results: sourceware.org; auth=none
- References: <1380649206-19367-1-git-send-email-cory at coryfields dot com> <5256B553 dot 8040307 at redhat dot com> <CAApLimgHaLTS8cq9u1=wqU3y53b2ZteW9-EAf5ieM1pkqy==Xg at mail dot gmail dot com> <CAApLimgC5uBv1xtQp=L8oShWJA3DQbYpsaT1ZX=WbH3D7SuGGA at mail dot gmail dot com> <5257DCED dot 7040004 at redhat dot com> <CAApLimj+FvRftHggFawg1crgah-KK98SGTRBBHE_gzMCxRaZWg at mail dot gmail dot com>
- Reply-to: cory at coryfields dot com
Hi Nick
Sorry for the hasty re-ping, but Tristan seems ok with pulling in the
determinism fixes for 2.24 if I can get them ack'd before the window
closes.
Would you mind commenting on the approach above?
Regards,
Cory
On Mon, Nov 18, 2013 at 6:06 PM, Cory Fields <cory@coryfields.com> wrote:
> Hi Nick
>
> Now that windres and ar are fixed up, ld is the only hold-out for
> clean, deterministic, mingw binaries.
>
> I've implemented an '--enable-deterministic-ld' configure option, to
> match the semantics of ar. But in looking over it, it rather feels
> like beating in a nail with a screwdriver.
>
> It seems to me that the non-deterministic behavior of mingw's ld is a
> bug that has become accepted behavior, rather than an as-intended
> feature. So rather than going the same route as ar, I propose the
> following:
>
> mingw's coff timestamp is set to an arbitrary number, to match the
> standard behavior of ld. A --use-real-timestamp (or so, maybe
> random-seed to match gcc?) is introduced to mimic the previous
> behavior if desired.
>
> With the current functionality of mingw's ld, the userspace
> application 'faketime' can be used to spoof the inserted timestamp.
> This has been used by the buildsystems of several applications
> (including tor and bitcoin) to work-around this problem. To my
> knowledge, the usage of a phony timestamp has not introduced any
> problems. So I don't envision any runtime issues with this change,
> only the theoretical distribution issue you mentioned (companies
> wishing to have different timestamps for distributed binaries, for
> internal reasons), which could easily be mitigated by
> --use-real-timestamp.
>
> Thoughts?
>
> Regards,
> Cory
>
> On Fri, Oct 11, 2013 at 7:11 AM, nick clifton <nickc@redhat.com> wrote:
>> Hi Cory,
>>
>>
>>>> - Are there other viable targets you can think of beyond PE executables?
>>
>>
>> Nope - I think that this is a PE specific feature/bug.
>>
>>
>>>> - What do you think about making this a runtime ld option as well?
>>>> e.g. -D to match ar's. It'd be a shame to be at the mercy of my distro
>>>> for this.
>>
>>
>> This is a good idea.
>>
>>
>>> I've taken another look, and it looks like a pe-specific emulation
>>> flag makes the most sense.
>>
>>
>> Go for it.
>>
>> Cheers
>> Nick
>>
>>