[PATCH RFC next 15/18] kbuild: enable -Werror for hostprogs

Quentin Schulz foss+uboot at 0leil.net
Mon May 4 15:20:42 CEST 2026


From: Quentin Schulz <quentin.schulz at cherry.de>

[ Upstream commit 27758d8c2583d10472b745a43ff86fef96c11ef7 ]

Original commit log:

  The hostprog compilers and linkers do not share the regular compiler flags,
  so they are not affected by CONFIG_WERROR or W=e. As hostprogs are used
  during the bootstrap of the build, they can't depend on kconfig options.

  Enable -Werror unconditionally.

Signed-off-by: Quentin Schulz <quentin.schulz at cherry.de>
---
 scripts/Makefile.extrawarn | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 29b6aab5f72..8988308cc36 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -109,3 +109,8 @@ KBUILD_LDFLAGS		+= --fatal-warnings
 KBUILD_RUSTFLAGS	+= -Dwarnings
 
 endif
+
+# Hostprog flags are used during build bootstrapping and can not rely on CONFIG_ symbols.
+KBUILD_HOSTCFLAGS	+= -Werror
+KBUILD_HOSTLDFLAGS	+= -Wl,--fatal-warnings
+KBUILD_HOSTRUSTFLAGS	+= -Dwarnings

-- 
2.54.0



More information about the U-Boot mailing list