Re: [PATCH v2 6/6] kbuild: enable -Werror for hostprogs
From: Nicolas Schier
Date: Thu Aug 14 2025 - 08:39:22 EST
On Thu, Aug 14, 2025 at 12:14:46PM +0200, Thomas Weißschuh wrote:
> 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: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
>
> ---
> For testing in -next, as discussed in
> https://lore.kernel.org/lkml/20250812-kbuild-werror-v1-2-36c9ff653700@xxxxxxxxxxxxx/
yeah, I am not sure if this is a good change, but I am ok with testing
it in next, as Nathan suggested.
For the rest of the series:
Reviewed-by: Nicolas Schier <nsc@xxxxxxxxxx>
Thanks.
> ---
> scripts/Makefile.extrawarn | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
> index 96ff3f5582d651f0016c8ccd49d46022cc6fe070..1434cb6208cb82f20aeb29cc8c059220d1a1f6d2 100644
> --- a/scripts/Makefile.extrawarn
> +++ b/scripts/Makefile.extrawarn
> @@ -224,3 +224,8 @@ KBUILD_USERLDFLAGS += -Wl,--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.50.1
>