[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251005205335.GA2561157@ax162>
Date: Sun, 5 Oct 2025 13:53:35 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: Askar Safin <safinaskar@...il.com>,
Thomas Weißschuh <thomas.weissschuh@...utronix.de>,
Nicolas Schier <nsc@...nel.org>
Cc: a.hindborg@...nel.org, alex.gaynor@...il.com, aliceryhl@...gle.com,
bjorn3_gh@...tonmail.com, boqun.feng@...il.com, dakr@...nel.org,
gary@...yguo.net, linux-kbuild@...r.kernel.org,
linux-kernel@...r.kernel.org, lossin@...nel.org, ojeda@...nel.org,
rust-for-linux@...r.kernel.org, tmgross@...ch.edu, sam@...too.org
Subject: Re: [PATCH v2 6/6] kbuild: enable -Werror for hostprogs
Hi Askar,
On Sun, Oct 05, 2025 at 04:10:47AM +0300, Askar Safin wrote:
> "Thomas Weißschuh" <thomas.weissschuh@...utronix.de>:
> > Enable -Werror unconditionally
>
> Please, drop this patch.
This is already merged into Linus's tree so it cannot be dropped, it
would need to be reverted. However...
> Never enable -Werror unconditionally for any part of build.
>
> I often bisect Linux. And to do this, I often need to build very old
> Linux commits (with modern compiler). Unconditional -Werror will make
> this impossible.
>
> For example, recently I found this regression:
>
> https://lore.kernel.org/regressions/197f290e30b.eaadc7bc7913.7315623184036672946@zohomail.com/T/#u
>
> The regression caused by commits happened in 2019.
>
> So to bisect it, I had to build 2019 trees using modern compiler.
I do my fair share of bisecting old Linux trees with a modern compiler,
so I do understand that pain. While it is easy enough to avoid this
behavior with HOSTCFLAGS=-Wno-error or HOSTCFLAGS=-w and there are other
places that the kernel enables -Werror unconditionally, I do not want
this to be a major pain point for random people doing bisected,
especially when the host tools are fairly battle tested so warnings may
not be a big deal.
In looking further into this, I noticed that in its current state,
-Werror is not getting applied to scripts/basic/fixup or
scripts/kconfig/*.o files (seems $(include-y) happens to late?), which
was one of the reasons to avoid making it depend on CONFIG_WERROR or
W=e. If that's the case, we could probably make it opt in like the rest
of the warnings for the kernel, which should be a fair compromise
between wanting to make potential issues more obvious while not
impacting people who build old sources with new compilers.
Thomas and Nicolas, thoughts?
Cheers,
Nathan
diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 1434cb6208cb..1a29598cf7cb 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -223,9 +223,11 @@ KBUILD_USERCFLAGS += -Werror
KBUILD_USERLDFLAGS += -Wl,--fatal-warnings
KBUILD_RUSTFLAGS += -Dwarnings
-endif
-
-# Hostprog flags are used during build bootstrapping and can not rely on CONFIG_ symbols.
+# While hostprog flags are used during build bootstrapping (thus can not use on
+# CONFIG_ symbols), -Werror should be opted into, so only apply -Werror to
+# hostprogs built after the initial Kconfig bootstrap.
KBUILD_HOSTCFLAGS += -Werror
KBUILD_HOSTLDFLAGS += -Wl,--fatal-warnings
KBUILD_HOSTRUSTFLAGS += -Dwarnings
+
+endif
Powered by blists - more mailing lists