Commit 65bb6d8d authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Tom Rini

kbuild: build with -Werror=date-time if the compiler supports it

Using __DATE__, __TIME__ would make the build non-deterministic.

If the code needs to refer to build date/time, use U_BOOT_DATE and
U_BOOT_TIME in include/generated/timestamp_autogenerated.h instead.

This commit has been imported from Linux Kernel,
which should be applied to U-Boot too:

    commit fe7c36c7bde12190341722af69358e42171162f3
    Author: Josh Triplett <>
    Date:   Mon Dec 23 13:56:06 2013 -0800

    Makefile: Build with -Werror=date-time if the compiler supports it

    GCC 4.9 and newer have a new warning -Wdate-time, which warns on any use
    of __DATE__, __TIME__, or __TIMESTAMP__, which would make the build
    non-deterministic.  Now that the kernel does not use any of those
    macros, turn on -Werror=date-time if available, to keep it that way.

    The kernel already (optionally) records this information at build time
    in a single place; other kernel code should not duplicate that.
Signed-off-by: Josh Triplett's avatarJosh Triplett <>
Signed-off-by: default avatarMichal Marek <>
Signed-off-by: default avatarMasahiro Yamada <>
parent 9995d8c8
......@@ -578,6 +578,9 @@ KBUILD_AFLAGS += -Wa,-gstabs,-S
# Prohibit date/time macros, which would make the build non-deterministic
KBUILD_CFLAGS += $(call cc-option,-Werror=date-time)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment