This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Facilitate deterministic pe executables between linker invocations


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
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]