All of lore.kernel.org
 help / color / mirror / Atom feed
From: Atharva Lele <itsatharva@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2 1/2] toolchain/toolchain-wrapper: explicitly set Build ID to none if BR2_REPRODUCIBLE
Date: Sat, 31 Aug 2019 23:31:12 +0530	[thread overview]
Message-ID: <20190831180113.16025-1-itsatharva@gmail.com> (raw)

Build ID is added to binaries at link time. Building in different output
directories causes some packages to have different Build IDs, thus resulting in
non-reproducibility.

Adding "-Wl,--build-id=none" fixes this issue by disabling setting of Build ID.

Diffoscope output for Build ID issue: https://gitlab.com/snippets/1886180/raw

After this patch, build is reproducible - i.e. diffoscope does not produce any
output.

Signed-off-by: Atharva Lele <itsatharva@gmail.com>
---
Changes v1 -> v2:
  - Handle inside toolchain-wrapper.mk instead of both .mk and .c
---
 toolchain/toolchain-wrapper.mk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk
index 970bde76a0..88695a5b2d 100644
--- a/toolchain/toolchain-wrapper.mk
+++ b/toolchain/toolchain-wrapper.mk
@@ -21,6 +21,10 @@ TOOLCHAIN_WRAPPER_OPTS = \
 	$(call qstrip,$(BR2_SSP_OPTION)) \
 	$(call qstrip,$(BR2_TARGET_OPTIMIZATION))
 
+ifeq ($(BR2_REPRODUCIBLE),y)
+TOOLCHAIN_WRAPPER_OPTS += -Wl,--build-id=none
+endif
+
 # We create a list like '"-mfoo", "-mbar", "-mbarfoo"' so that each flag is a
 # separate argument when used in execv() by the toolchain wrapper.
 TOOLCHAIN_WRAPPER_ARGS += \
-- 
2.22.0

             reply	other threads:[~2019-08-31 18:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-31 18:01 Atharva Lele [this message]
2019-08-31 18:01 ` [Buildroot] [PATCH v2 2/2] toolchain/toolchain-wrapper: handle __FILE__ macro for reproducibility Atharva Lele
2019-09-07 14:34   ` Romain Naour
2019-09-16 11:54     ` Atharva Lele
2019-09-16 12:06       ` Arnout Vandecappelle
2020-01-06 22:28   ` Thomas Petazzoni
2019-09-07 14:13 ` [Buildroot] [PATCH v2 1/2] toolchain/toolchain-wrapper: explicitly set Build ID to none if BR2_REPRODUCIBLE Romain Naour
2019-10-26 15:07 ` Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190831180113.16025-1-itsatharva@gmail.com \
    --to=itsatharva@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.