New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

binutils: Ensure that the timestamp in PE/COFF headers is always init… #1737

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
3 participants
@Beuc
Contributor

Beuc commented Mar 31, 2017

Hi,

When using --no-insert-timestamp, instead of inserting a 0 timestamp, ld 2.25.1 does not initialized memory resulting in a random date timestamp.

This pull requests applies the 2-lines fix from upstream, resulting in stable/reproducible output.

I noticed this issue when working on a reproducible build of my FreeDink game, you can see details at:
https://blog.beuc.net/posts/Practical_basics_of_reproducible_builds_2/
https://blog.beuc.net/posts/Practical_basics_of_reproducible_builds/

(For your info, Debian has a more extensive, upstream-pending patch related to the SOURCE_DATE_EPOCH specification, see specify-timestamp.patch in http://http.debian.net/debian/pool/main/b/binutils-mingw-w64/binutils-mingw-w64_7.4.tar.xz)

@starius

This comment has been minimized.

Show comment
Hide comment
@starius

starius Apr 1, 2017

Member

Thank you! I'm testing your patch.
I reformatted the patch file in the format produced by tools/patch-tool-mxe:
https://gist.github.com/265da3742f46d0bf055d00d96f269b4b
Can you replace the file in your pull request with it (and put it in src/binutils-1-fixes.patch), please?

Member

starius commented Apr 1, 2017

Thank you! I'm testing your patch.
I reformatted the patch file in the format produced by tools/patch-tool-mxe:
https://gist.github.com/265da3742f46d0bf055d00d96f269b4b
Can you replace the file in your pull request with it (and put it in src/binutils-1-fixes.patch), please?

binutils: Ensure that the timestamp in PE/COFF headers is always init…
…ialised.

PR ld/20634
* peXXigen.c (_bfd_XXi_only_swap_filehdr_out): Put 0 in the
timestamp field if real time values are not being stored.

(from upstream 1c5f704fc035bc705dee887418f42cb8bca24b5d)
@Beuc

This comment has been minimized.

Show comment
Hide comment
@Beuc

Beuc Apr 1, 2017

Contributor

Like this?

By the way, are there plans to upgrade binutils?
Stephen Kitt pointed out that a similar issue affects DLL files, his patch is here:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=030f4c7f08246bdc79d74c4c297729003773b67c

Contributor

Beuc commented Apr 1, 2017

Like this?

By the way, are there plans to upgrade binutils?
Stephen Kitt pointed out that a similar issue affects DLL files, his patch is here:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=030f4c7f08246bdc79d74c4c297729003773b67c

@starius

This comment has been minimized.

Show comment
Hide comment
@starius

starius Apr 1, 2017

Member

Like this?

Exactly. Thanks!

By the way, are there plans to upgrade binutils?

File src/binutils.mk has the following comment:

# see https://lists.nongnu.org/archive/html/mingw-cross-env-list/2016-01/msg00013.html
# 2.26 causes incorrect dlls to be built with sjlj exceptions

Are there any updates on that?

Stephen Kitt pointed out that a similar issue affects DLL files, his patch is here

Can we add his patch as well?

Member

starius commented Apr 1, 2017

Like this?

Exactly. Thanks!

By the way, are there plans to upgrade binutils?

File src/binutils.mk has the following comment:

# see https://lists.nongnu.org/archive/html/mingw-cross-env-list/2016-01/msg00013.html
# 2.26 causes incorrect dlls to be built with sjlj exceptions

Are there any updates on that?

Stephen Kitt pointed out that a similar issue affects DLL files, his patch is here

Can we add his patch as well?

@Beuc

This comment has been minimized.

Show comment
Hide comment
@Beuc

Beuc Apr 1, 2017

Contributor

File src/binutils.mk has the following comment:

see https://lists.nongnu.org/archive/html/mingw-cross-env-list/2016-01/msg00013.html
2.26 causes incorrect dlls to be built with sjlj exceptions

Are there any updates on that?

I have no clue about this bug :/
However 2.28 is out now, and also 2.27 will be in the next Debian:
https://packages.debian.org/stretch/binutils-mingw-w64
I don't see any patch related to that issue in the package.
That doesn't mean anything per se but this is encouraging.

Stephen Kitt pointed out that a similar issue affects DLL files, his patch is here

Can we add his patch as well?

Given Stephen's credentials I would trust his patch, however I don't work much with DLLs these days hence I haven't tested the issue extensively as I did for this pull request.

Contributor

Beuc commented Apr 1, 2017

File src/binutils.mk has the following comment:

see https://lists.nongnu.org/archive/html/mingw-cross-env-list/2016-01/msg00013.html
2.26 causes incorrect dlls to be built with sjlj exceptions

Are there any updates on that?

I have no clue about this bug :/
However 2.28 is out now, and also 2.27 will be in the next Debian:
https://packages.debian.org/stretch/binutils-mingw-w64
I don't see any patch related to that issue in the package.
That doesn't mean anything per se but this is encouraging.

Stephen Kitt pointed out that a similar issue affects DLL files, his patch is here

Can we add his patch as well?

Given Stephen's credentials I would trust his patch, however I don't work much with DLLs these days hence I haven't tested the issue extensively as I did for this pull request.

@Beuc

This comment has been minimized.

Show comment
Hide comment
@Beuc

Beuc Apr 17, 2017

Contributor

Hi, any news on this? :)

Contributor

Beuc commented Apr 17, 2017

Hi, any news on this? :)

tonytheodore added a commit to tonytheodore/mxe that referenced this pull request Jul 14, 2017

binutils: update 2.25.1 --> 2.28
* fixes original 2.26 regression with iostreams dll
    ```
    $ make gcc STRIP_TOOLCHAIN= MXE_TARGETS=i686-w64-mingw32.shared
    [...]
    $ i686-w64-mingw32.shared-nm  usr/i686-w64-mingw32.shared/bin/libstdc++-6.dll | grep InitC1
    6fefa2d0 T __ZNSt8ios_base4InitC1Ev
    ```
* replaces #1737
* fixes #1758
* tested on all four targets
@tonytheodore

This comment has been minimized.

Show comment
Hide comment
@tonytheodore

tonytheodore Jul 14, 2017

Member

@Beuc, interesting posts on reproducible builds - thanks.

I've done a new PR (#1822) to update binutils and add the SOURCE_DATE_EPOCH patch. The main holdup to updating was the 2.26 regression that's now fixed.

Member

tonytheodore commented Jul 14, 2017

@Beuc, interesting posts on reproducible builds - thanks.

I've done a new PR (#1822) to update binutils and add the SOURCE_DATE_EPOCH patch. The main holdup to updating was the 2.26 regression that's now fixed.

@tonytheodore

This comment has been minimized.

Show comment
Hide comment
@tonytheodore

tonytheodore Jul 23, 2017

Member

Replaced with #1822

Member

tonytheodore commented Jul 23, 2017

Replaced with #1822

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment