diff options
authorMark Charlebois <>2019-09-27 08:05:36 +0200
committerSascha Hauer <>2019-10-14 12:52:11 +0200
commitf2f6db2654d7a47d9335674b0250ed68b8c2ae74 (patch)
parent3dbc50408b2514125a7170da77912688eb501655 (diff)
kbuild, LLVMLinux: Add -Werror to cc-option to support clang
Clang will warn about unknown warnings but will not return false unless -Werror is set. GCC will return false if an unknown warning is passed. Adding -Werror make both compiler behave the same. [arnd: it turns out we need the same patch for testing whether -ffunction-sections works right with gcc. I've build tested extensively with this patch applied, so let's just merge this one now.] Signed-off-by: Mark Charlebois <> Signed-off-by: Behan Webster <> Reviewed-by: Jan-Simon Möller <> Signed-off-by: Arnd Bergmann <> Acked-by: Kees Cook <> Signed-off-by: Masahiro Yamada <> [afa: ported to barebox from upstream c3f0d0bc5b01ad9] Signed-off-by: Ahmad Fatoum <> Signed-off-by: Sascha Hauer <>
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index a2dbbd8..5f03cf4 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -109,17 +109,17 @@ as-instr = $(call try-run,\
# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
cc-option = $(call try-run,\
- $(CC) $(KBUILD_CPPFLAGS) $(CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",$(1),$(2))
+ $(CC) -Werror $(KBUILD_CPPFLAGS) $(CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",$(1),$(2))
# cc-option-yn
# Usage: flag := $(call cc-option-yn,-march=winchip-c6)
cc-option-yn = $(call try-run,\
- $(CC) $(KBUILD_CPPFLAGS) $(CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",y,n)
+ $(CC) -Werror $(KBUILD_CPPFLAGS) $(CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",y,n)
# cc-disable-warning
# Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
cc-disable-warning = $(call try-run,\
- $(CC) $(KBUILD_CPPFLAGS) $(CFLAGS) -W$(strip $(1)) -c -xc /dev/null -o "$$TMP",-Wno-$(strip $(1)))
+ $(CC) -Werror $(KBUILD_CPPFLAGS) $(CFLAGS) -W$(strip $(1)) -c -xc /dev/null -o "$$TMP",-Wno-$(strip $(1)))
# cc-version
# Usage gcc-ver := $(call cc-version)