Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at
Bug 1124342 - build binutils with --enable-deterministic-archives
Summary: build binutils with --enable-deterministic-archives
Alias: None
Product: Fedora
Classification: Fedora
Component: binutils
Version: 21
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Nick Clifton
QA Contact: Fedora Extras Quality Assurance
Depends On:
Blocks: ARM64, F-ExcludeArch-aarch64 1136481
TreeView+ depends on / blocked
Reported: 2014-07-29 09:28 UTC by Benedikt Morbach
Modified: 2014-09-02 17:49 UTC (History)
6 users (show)

Fixed In Version: binutils-2.24-20.fc22
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1136481 (view as bug list)
Last Closed: 2014-09-02 17:49:35 UTC
Type: Bug

Attachments (Terms of Use)

Description Benedikt Morbach 2014-07-29 09:28:49 UTC
I write about ar below, but all of this also applies to ranlib, strip and objcopy.

Description of problem:
GNU ar adds UIDs, GIDs file modes and timestamps to .a files.
Because of this, two builds from the same sources yield different results if they include static archives.
I'm currently working towards reproducible builds for Fedora, so that you can e.g. rebuild a srpm to confirm that the binary matches the one you downloaded.

This metadata in .a files is of course detrimental to that because they will always differ just by virtue of not having been built at the exact same time.

Steps to Reproduce:
1. build static library
2. build same library again
3. diff both
   --> They differ

Proposed solution:
ar has a command line switch 'D': 'When adding files and the archive index use zero for UIDs, GIDs, timestamps, and use consistent file modes for all files'[1]

However, it is impractical to add that to every build, so binutils upstream provides a configure option '--enable-deterministic-archives', which makes this behaviour the default, though it can still be disabled at runtime via the 'u' switch, in case someone wants to use ar to pack non-library files in an archive and cares about the metadata.

I propose we add this flag to our binutils build.


Comment 1 Nick Clifton 2014-08-19 12:50:59 UTC
Hi Benedikt,

  Please try out: binutils-2.24-20.fc22


Comment 2 Benedikt Morbach 2014-08-19 14:13:18 UTC
Hi Nick,

Thanks for adding that.
It is probably to late for f21, right?

Comment 4 Marcin Juszkiewicz 2014-09-02 13:15:31 UTC
make 4.0-3.fc22 fails to build on AArch64 unless  --enable-deterministic-archives is disabled:

make  check-local
make[2]: Entering directory '/builddir/build/BUILD/make-4.0'
cd tests && perl ./ -srcdir /builddir/build/BUILD/make-4.0 -make ../make 
Running tests for GNU make on Linux 3.15.0-0.36.sa2.aarch64 aarch64
                                 GNU Make 4.0
Finding tests...
features/archives ....................................... FAILED (3/10 passed)

I did checks with binutils 2.24-18/-19/-20 and it was -20 when it failed. Built -23 without --enable-deterministic-archives option and it passed again.

But it is probably bug in make testsuite rather than in binutils.

Comment 5 Kyle McMartin 2014-09-02 16:42:06 UTC
i'm going to assume this isn't aarch64 specific, and is only biting us here since we're doing the rebuild with newer package versions than the fedora rebuild. i'll take a look at the make testsuite on x86_64.

Comment 6 Kyle McMartin 2014-09-02 17:49:35 UTC
Closing this one, as I've cloned 1136481 for the make issue.

Note You need to log in before you can comment on or make changes to this bug.