[PATCH RFC next 00/18] sync scripts/Makefile.extrawarn with 6.1, enable WERROR for host tools
Tom Rini
trini at konsulko.com
Mon May 4 20:04:29 CEST 2026
On Mon, May 04, 2026 at 03:20:27PM +0200, Quentin Schulz wrote:
> I ended up being surprised host tools aren't compiled with -Werror even
> when CONFIG_WERROR is set.
>
> While this is an issue for local builds, buildman (used in CI) adds
> -Werror to KCFLAGS and HOSTCFLAGS when passed -E (or
> --warnings-as-errors), which we do, see
> 'build all platforms in a single job' job and &buildman_and_testpy_dfn
> template.
>
> It turns out that even though we claim to have synchronized our kbuild
> with Linux kernel v6.1, some of it was stuck to v5.1 +- some partial
> backports. This doesn't attempt to update everything that isn't in sync
> with 6.1 though!
Thanks for doing this. Having done a few of the previous re-syncs it's
always hard to find every file that needs to be updated.
> The first two patches are for fixing pytest calling make directly on a
> "dirty" build directory as generated by buildman using the clang-20
> toolchain, but pytest does not set HOSTCC and CC to clang-20, resulting
> in clang flags being used with gcc).
>
> One can simply reproduce it (after backporting up to patch
> "scripts/Makefile.extrawarn: sync with 6.1") by doing so in the
> container:
>
> make HOSTCC=clang-20 CC=clang-20 O=build/sandbox sandbox_defconfig
> make HOSTCC=clang-20 CC=clang-20 O=build/sandbox -j`nproc
> make O=build/sandbox u-boot-initial-env
>
> It'll print:
> gcc: error: unrecognized command-line option '-mno-global-merge'
> gcc: error: unrecognized command-line option '-Wformat-invalid-specifier'
> gcc: error: unrecognized command-line option '-Qunused-arguments'
>
> This is essentially what's run within test_env_initial_env_file in
> test/py/tests/test_env.py.
>
> While I'm not unhappy with the patches to pytest, it feels to me we may
> be missing something else for the u-boot-initial-env make target to
> update the kconfig symbol based on the toolchain being used when called.
Is there some other target in the Makefile that should catch this kind
of change? It's not just that build target that needs to be remade, it's
everything, yes?
> While looking at the kernel git history for Makefile and
> scripts/Makefile.extrawarn I also saw a few flags being removed or
> reworked so I took the liberty of backporting some.
>
> Then, scripts/Makefile.extrawarn is directly imported verbatim from v6.1
> which is the version we've claimed to be synced with so far.
>
> Also, patches to apply CONFIG_WERROR to the host tools as well as linker
> and assembler are backported.
>
> kernel-doc is made to ignore KBUILD_EXTRA_WARN since we have too many
> warnings for now and it prevents us from being able to use W=e Make
> variable which is extremely convenient to essentially do the same as
> setting CONFIG_WERROR in Kconfig, just without needing to actually set
> it in the defconfig or in a .config. I don't like it but it is what it
> is. Our kernel-doc has a couple of patches on top of Linux kernel
> v5.11's. The kernel has moved to a Python script this year, so it's
> probably wise to migrate to that before trying to tackle kernel-doc
> warnings.
This makes sense, yes.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20260504/4daa8359/attachment.sig>
More information about the U-Boot
mailing list