From: "Jérôme Pouiller" <jezz@sysmic.org>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2 02/15] reproducible: fix DATE/TIME macros in toolchain-wrapper
Date: Fri, 18 Nov 2016 10:10:11 +0100 [thread overview]
Message-ID: <1479460224-6119-3-git-send-email-jezz@sysmic.org> (raw)
In-Reply-To: <1479460224-6119-1-git-send-email-jezz@sysmic.org>
The use __DATE__ and __TIME__ are one of most common sources of
non-reproducible binaries. We take advantage of toolchain-wrapper to fix
these macros.
Notice this workaround will be useless this next gcc versions since it will
include suport for SOURCE_DATE_EPOCH variable.
Note: quoting of $(TOOLCHAIN_WRAPPER_ARGS) is a mess, but I did not find easier
way to do (without involving `$(shell ...)')
This work was sponsored by `BA Robotic Systems'.
Signed-off-by: J?r?me Pouiller <jezz@sysmic.org>
---
toolchain/toolchain-wrapper.c | 9 +++++++++
toolchain/toolchain-wrapper.mk | 5 +++++
2 files changed, 14 insertions(+)
diff --git a/toolchain/toolchain-wrapper.c b/toolchain/toolchain-wrapper.c
index 925d013..28709ec 100644
--- a/toolchain/toolchain-wrapper.c
+++ b/toolchain/toolchain-wrapper.c
@@ -75,6 +75,15 @@ static char *predef_args[] = {
#if defined(BR_MIPS_TARGET_BIG_ENDIAN) || defined(BR_ARC_TARGET_BIG_ENDIAN)
"-EB",
#endif
+#if defined(BR_REPRODUCIBLE_TIME) || defined(BR_REPRODUCIBLE_DATE)
+ "-Wno-builtin-macro-redefined",
+#endif
+#ifdef BR_REPRODUCIBLE_TIME
+ "-D__TIME__=" BR_REPRODUCIBLE_TIME,
+#endif
+#ifdef BR_REPRODUCIBLE_DATE
+ "-D__DATE__=" BR_REPRODUCIBLE_DATE,
+#endif
#ifdef BR_ADDITIONAL_CFLAGS
BR_ADDITIONAL_CFLAGS
#endif
diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk
index e7aa5fb..7067134 100644
--- a/toolchain/toolchain-wrapper.mk
+++ b/toolchain/toolchain-wrapper.mk
@@ -30,6 +30,11 @@ ifeq ($(BR2_CCACHE_USE_BASEDIR),y)
TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE_BASEDIR='"$(BASE_DIR)"'
endif
+ifeq ($(BR2_REPRODUCIBLE),y)
+TOOLCHAIN_WRAPPER_ARGS += -DBR_REPRODUCIBLE_TIME="\"\\\"`date -d @$(SOURCE_DATE_EPOCH) "+%T"`\\\"\""
+TOOLCHAIN_WRAPPER_ARGS += -DBR_REPRODUCIBLE_DATE="\"\\\"`date -d @$(SOURCE_DATE_EPOCH) "+%b %e %Y"`\\\"\""
+endif
+
define TOOLCHAIN_WRAPPER_BUILD
$(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_WRAPPER_ARGS) \
-s -Wl,--hash-style=$(TOOLCHAIN_WRAPPER_HASH_STYLE) \
--
1.9.1
next prev parent reply other threads:[~2016-11-18 9:10 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-18 9:10 [Buildroot] [PATCH v2 00/15] Reproducible builds Jérôme Pouiller
2016-11-18 9:10 ` [Buildroot] [PATCH v2 01/15] reproducibility: generate SOURCE_DATE_EPOCH Jérôme Pouiller
2016-11-18 11:33 ` Thomas Petazzoni
2016-11-18 13:48 ` Jérôme Pouiller
2016-11-19 8:51 ` Arnout Vandecappelle
2016-11-19 9:51 ` Thomas Petazzoni
2016-11-19 10:01 ` Arnout Vandecappelle
2016-11-19 8:40 ` Arnout Vandecappelle
2016-11-18 9:10 ` Jérôme Pouiller [this message]
2016-11-18 11:37 ` [Buildroot] [PATCH v2 02/15] reproducible: fix DATE/TIME macros in toolchain-wrapper Thomas Petazzoni
2016-11-18 13:46 ` Jérôme Pouiller
2016-11-18 9:10 ` [Buildroot] [PATCH v2 03/15] reproducible: add '-n' to gzip invocations Jérôme Pouiller
2016-11-18 11:38 ` Thomas Petazzoni
2016-11-19 9:02 ` Arnout Vandecappelle
2016-11-19 13:49 ` Jérôme Pouiller
2016-11-18 9:10 ` [Buildroot] [PATCH v2 04/15] fs/tar: make results reproducible Jérôme Pouiller
2016-11-18 11:40 ` Thomas Petazzoni
2016-11-18 13:02 ` Jérôme Pouiller
2016-11-18 13:29 ` Thomas Petazzoni
2016-11-18 13:44 ` Jérôme Pouiller
2016-11-18 21:28 ` Thomas Petazzoni
2016-11-19 8:33 ` Arnout Vandecappelle
2016-11-19 13:56 ` Jérôme Pouiller
2016-11-19 9:12 ` Arnout Vandecappelle
2016-11-19 13:59 ` Jérôme Pouiller
2016-11-18 9:10 ` [Buildroot] [PATCH v2 05/15] reproducibility/linux: override build timestamp Jérôme Pouiller
2016-11-18 11:40 ` Thomas Petazzoni
2016-11-19 13:53 ` Jérôme Pouiller
2016-11-19 16:10 ` Arnout Vandecappelle
2016-11-18 9:10 ` [Buildroot] [PATCH v2 06/15] reproducibility/linux: inhibit build-id Jérôme Pouiller
2016-11-19 9:31 ` Arnout Vandecappelle
2016-11-19 14:04 ` Jérôme Pouiller
2016-11-18 9:10 ` [Buildroot] [PATCH v2 07/15] reproducibility/busybox: disable build timestamps Jérôme Pouiller
2016-11-18 11:41 ` Thomas Petazzoni
2016-11-19 9:32 ` Arnout Vandecappelle
2016-11-19 9:33 ` Arnout Vandecappelle
2016-11-18 9:10 ` [Buildroot] [PATCH v2 08/15] reproducible: lock modification times in $TARGET_DIR Jérôme Pouiller
2016-11-18 11:43 ` Thomas Petazzoni
2016-11-19 9:39 ` Arnout Vandecappelle
2016-11-18 9:10 ` [Buildroot] [PATCH v2 09/15] fakedate: new package Jérôme Pouiller
2016-11-18 11:48 ` Thomas Petazzoni
2016-11-19 13:24 ` Jérôme Pouiller
2016-11-19 10:21 ` Arnout Vandecappelle
2016-11-19 13:06 ` Jérôme Pouiller
2016-11-19 13:26 ` Arnout Vandecappelle
2016-11-19 13:38 ` Jérôme Pouiller
2016-11-22 10:59 ` Jérôme Pouiller
2016-11-18 9:10 ` [Buildroot] [PATCH v2 10/15] reproducible: enable fakedate Jérôme Pouiller
2016-11-18 11:49 ` Thomas Petazzoni
2016-11-18 13:53 ` Jérôme Pouiller
2016-11-19 10:22 ` Arnout Vandecappelle
2016-11-18 9:10 ` [Buildroot] [PATCH v2 11/15] python2: generate reproducible .pyc Jérôme Pouiller
2016-11-19 10:41 ` Arnout Vandecappelle
2016-11-19 12:35 ` Arnout Vandecappelle
2016-11-18 9:10 ` [Buildroot] [PATCH v2 12/15] python3: " Jérôme Pouiller
2016-11-18 9:10 ` [Buildroot] [PATCH v2 13/15] python2: remove full path from .pyc Jérôme Pouiller
2016-11-19 12:38 ` Arnout Vandecappelle
2016-11-18 9:10 ` [Buildroot] [PATCH v2 14/15] python3: " Jérôme Pouiller
2016-11-19 12:39 ` Arnout Vandecappelle
2016-11-18 9:10 ` [Buildroot] [PATCH v2 15/15] reproducible: improve help text Jérôme Pouiller
2016-11-19 12:45 ` Arnout Vandecappelle
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=1479460224-6119-3-git-send-email-jezz@sysmic.org \
--to=jezz@sysmic.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox