bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/30245] New: Support SOURCE_DATE_EPOCH (or equivalent) to b


From: slyich at gmail dot com
Subject: [Bug binutils/30245] New: Support SOURCE_DATE_EPOCH (or equivalent) to build deterministic PE files.
Date: Sun, 19 Mar 2023 05:25:41 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=30245

            Bug ID: 30245
           Summary: Support SOURCE_DATE_EPOCH (or equivalent) to build
                    deterministic PE files.
           Product: binutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: slyich at gmail dot com
  Target Milestone: ---

I spent some time in https://github.com/NixOS/nixpkgs/issues/221419 trying to
build deterministic PE files and failed. I managed to build unstripped .exe
file with stable timestamp, but `strip` does not have a knob to achieve the
same.

Reproducer:

$ printf "int main(){}" | x86_64-w64-mingw32-gcc -x c - -o a.exe
-Wl,--no-insert-timestamp

$ x86_64-w64-mingw32-objdump -x a.exe | fgrep Time
Time/Date               Thu Jan  1 01:00:00 1970
 vma:            Hint    Time      Forward  DLL       First

$ x86_64-w64-mingw32-strip -D a.exe; x86_64-w64-mingw32-objdump -x a.exe |
fgrep Time

Time/Date               Sun Mar 19 05:20:05 2023
 vma:            Hint    Time      Forward  DLL       First

I must say that even using `-Wl,--no-insert-timestamp` is not very convenient
as it's a target-specific `ld` option. Handling `strip` on top is yet another
problem. Distribution-wide it would help to have something simpler that
clobbers timestamps.

Throwing some ideas:

One option would be to add `SOURCE_DATE_EPOCH` support:
https://reproducible-builds.org/docs/source-date-epoch/

Pros: be able to set any timestamp, not just 0.

Another option would be to default to `timestamp=0` in `binutils` (possibly
controlled by a ./configure option).

Pros: ease of use.
Cons: one extra knob to tweak.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]