reproducible: fix DATE/TIME macros in toolchain-wrapper
authorJérôme Pouiller <jezz@sysmic.org>
Tue, 20 Dec 2016 13:46:18 +0000 (14:46 +0100)
committerPeter Korsgaard <peter@korsgaard.com>
Tue, 7 Feb 2017 20:45:01 +0000 (21:45 +0100)
commit76838f63412a30a358210e457dda4b79f7730624
tree5aedfd22c554ac89916fcd73c62186c74afe9eb9
parentd3760efa7b92da74c39f5673c591b4fa14886b76
reproducible: fix DATE/TIME macros in toolchain-wrapper

The use of the __DATE__ and __TIME__ macros are one of the most common
sources of non-reproducible binaries. In order to fix that, gcc 7 supports
the SOURCE_DATE_EPOCH variable:

https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=e3e8c48c4a494d9da741c1c8ea6c4c0b7c4ff934

This patch take advantage of toolchain-wrapper to provide support of
SOURCE_DATE_EPOCH to older gcc versions.

Function get_source_date_epoch() come directly from gcc git.

This work was sponsored by `BA Robotic Systems'.

[Peter: use sizeof for character array sizes, make function static,
extend commit message, add upstream gcc commit]
Signed-off-by: Jérôme Pouiller <jezz@sysmic.org>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
toolchain/toolchain-wrapper.c