rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: "Askar Safin" <safinaskar@gmail.com>,
	"Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
	"Nicolas Schier" <nsc@kernel.org>
Cc: a.hindborg@kernel.org, alex.gaynor@gmail.com,
	aliceryhl@google.com, bjorn3_gh@protonmail.com,
	boqun.feng@gmail.com, dakr@kernel.org, gary@garyguo.net,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	lossin@kernel.org, ojeda@kernel.org,
	rust-for-linux@vger.kernel.org, tmgross@umich.edu,
	sam@gentoo.org
Subject: Re: [PATCH v2 6/6] kbuild: enable -Werror for hostprogs
Date: Sun, 5 Oct 2025 13:53:35 -0700	[thread overview]
Message-ID: <20251005205335.GA2561157@ax162> (raw)
In-Reply-To: <20251005011100.1035272-1-safinaskar@gmail.com>

Hi Askar,

On Sun, Oct 05, 2025 at 04:10:47AM +0300, Askar Safin wrote:
> "Thomas Weißschuh" <thomas.weissschuh@linutronix.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

  parent reply	other threads:[~2025-10-05 20:53 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-14 10:14 [PATCH v2 0/6] kbuild: enable CONFIG_WERROR for more build steps Thomas Weißschuh
2025-08-14 10:14 ` [PATCH v2 1/6] kbuild: align W=e with CONFIG_WERROR Thomas Weißschuh
2025-08-14 10:14 ` [PATCH v2 2/6] kbuild: unify W=e and CONFIG_WERROR Thomas Weißschuh
2025-08-14 10:14 ` [PATCH v2 3/6] kbuild: rust: move `-Dwarnings` handling to `Makefile.extrawarn` Thomas Weißschuh
2025-08-14 10:14 ` [PATCH v2 4/6] kbuild: respect CONFIG_WERROR for linker and assembler Thomas Weißschuh
2025-08-14 10:14 ` [PATCH v2 5/6] kbuild: respect CONFIG_WERROR for userprogs Thomas Weißschuh
2025-08-14 10:14 ` [PATCH v2 6/6] kbuild: enable -Werror for hostprogs Thomas Weißschuh
2025-08-14 12:10   ` Nicolas Schier
2025-08-14 18:30     ` Nathan Chancellor
2025-08-17 16:31   ` Miguel Ojeda
2025-08-18 17:45     ` Nathan Chancellor
2025-10-05  1:10   ` Askar Safin
2025-10-05  1:31     ` Sam James
2025-10-05 20:53     ` Nathan Chancellor [this message]
2025-10-06 10:20       ` Thomas Weißschuh
2025-10-06 11:27       ` Miguel Ojeda
2025-10-06 21:48         ` Nathan Chancellor
2025-08-14 19:11 ` [PATCH v2 0/6] kbuild: enable CONFIG_WERROR for more build steps Nathan Chancellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251005205335.GA2561157@ax162 \
    --to=nathan@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=nsc@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=safinaskar@gmail.com \
    --cc=sam@gentoo.org \
    --cc=thomas.weissschuh@linutronix.de \
    --cc=tmgross@umich.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).