buildroot/toolchain
Yann E. MORIN 6393b6904b toolchain/wrapper: fake __DATE_ and __TIME__ for older gcc
Starting with version 7, gcc automatically recognises and enforces the
environment variable SOURCE_DATE_EPOCH, and fakes __DATE__ and __TIME__
accordingly, to produce reproducible builds (at least in regards to date
and time).

However, older gcc versions do not offer this feature.

So, we use our toolchain wrapper to force-feed __DATE__ and __TIME__ as
macros, which will take precedence over those that gcc may compute
itself. We compute them according to the specs:
    https://reproducible-builds.org/specs/source-date-epoch/
    https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html

Since we define macros otherwise internal to gcc, we have to tell it not
to warn about that. The -Wno-builtin-macro-redefined flag was introduced
in gcc-4.4.0. Therefore, we make BR2_REPRODUCIBLE depend on GCC >= 4.4.

gcc-7 will ignore SOURCE_DATE_EPOCH when __DATE__ and __TIME__ are
user-defined. Anyway, this is of no consequence: whether __DATE__ and
__TIME__ or SOURCE_DATE_EPOCH takes precedence, it would yield the
exact same end result since we use the same logic to compute it. Note
that we didn't copy the code for it from gcc so using the same logic
doesn't imply that we're inheriting GPL-3.0.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Jérôme Pouiller <jezz@sysmic.org>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
Cc: Peter Korsgaard <peter@korsgaard.com>
[Arnout: rewrite commit message]
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2017-10-22 16:10:37 +02:00
..
toolchain pkg-cmake: move configuration files out of $(HOST_DIR)/usr 2017-07-05 11:50:14 +02:00
toolchain-buildroot toolchain: add glibc support for ARCv2 2017-10-10 23:13:34 +02:00
toolchain-external toolchain-external: bump version of Linaro AArch64 toolchain to 2017.08 2017-09-27 21:39:12 +02:00
Config.in arch/bfin: internal backend not suitable for some cores 2017-10-02 21:41:53 +02:00
helpers.mk toolchain: detect external glibc in merged /usr 2017-09-19 22:43:10 +02:00
toolchain-common.in toolchain: add 4.13.x choice for headers 2017-09-07 21:06:03 +02:00
toolchain-wrapper.c toolchain/wrapper: fake __DATE_ and __TIME__ for older gcc 2017-10-22 16:10:37 +02:00
toolchain-wrapper.mk Globally replace $(HOST_DIR)/usr/bin with $(HOST_DIR)/bin 2017-07-05 15:19:29 +02:00
toolchain.mk toolchain: use the <PKG>_TARGET_FINALIZE_HOOKS 2016-07-18 23:30:46 +02:00