Re: [REGRESSION][BISECTED] kbuild: CFLAGS=-w no longer works

From: Nicolas Schier

Date: Thu Oct 09 2025 - 04:49:06 EST


On Thu, Oct 09, 2025 at 10:51:49AM +0300, Askar Safin wrote:
> #regzbot introduced: d1d0963121769d8d16150b913fe886e48efefa51
>
> As well as I understand, if you want to disable warnings, you
> should pass "CFLAGS=-w" to "make". Starting with d1d096312176,
> this no longer works.
>
> Steps to reproduce:
>
> $ cd linux
> $ git clean -f -q -d -x # To clean everything not controlled by git
> $ echo 'CONFIG_64BIT=y' > /tmp/minimini
> $ make allnoconfig KCONFIG_ALLCONFIG=/tmp/minimini
> $ make -j32 CFLAGS=-w

If you want to hand-over additional CFLAGS to kbuild you need to use
KCFLAGS or other variations, see Documentation/kbuild/kbuild.rst.
When I intentionally introduce a warning in e.g. init/main.c, I can
suppress the compiler warning by calling

make KCFLAGS=-w

Your log output below does not contain any warning, so I assume that you
actually want to point to something different.


[...]
> CC /rbt/linux/tools/objtool/libsubcmd/exec-cmd.o
> CC /rbt/linux/tools/objtool/libsubcmd/help.o
> CC /rbt/linux/tools/objtool/libsubcmd/pager.o
> CC /rbt/linux/tools/objtool/libsubcmd/parse-options.o
> CC /rbt/linux/tools/objtool/libsubcmd/run-command.o
> CC /rbt/linux/tools/objtool/libsubcmd/sigchain.o
> CC /rbt/linux/tools/objtool/libsubcmd/subcmd-config.o
> exec-cmd.c:2:10: fatal error: linux/compiler.h: No such file or directory
> 2 | #include <linux/compiler.h>
> | ^~~~~~~~~~~~~~~~~~
> compilation terminated.
> make[5]: *** [/rbt/linux/tools/build/Makefile.build:86: /rbt/linux/tools/objtool/libsubcmd/exec-cmd.o] Error 1
> make[5]: *** Waiting for unfinished jobs....
> parse-options.c:2:10: fatal error: linux/compiler.h: No such file or directory
> 2 | #include <linux/compiler.h>
> | ^~~~~~~~~~~~~~~~~~
> compilation terminated.
> make[5]: *** [/rbt/linux/tools/build/Makefile.build:86: /rbt/linux/tools/objtool/libsubcmd/parse-options.o] Error 1
> In file included from sigchain.c:3:
> subcmd-util.h:8:10: fatal error: linux/compiler.h: No such file or directory
> 8 | #include <linux/compiler.h>
> | ^~~~~~~~~~~~~~~~~~
> compilation terminated.
> make[5]: *** [/rbt/linux/tools/build/Makefile.build:86: /rbt/linux/tools/objtool/libsubcmd/sigchain.o] Error 1
> MKELF scripts/mod/elfconfig.h
> In file included from help.c:12:
> subcmd-util.h:8:10: fatal error: linux/compiler.h: No such file or directory
> 8 | #include <linux/compiler.h>
> | ^~~~~~~~~~~~~~~~~~
> compilation terminated.
> HOSTCC scripts/mod/modpost.o
> make[5]: *** [/rbt/linux/tools/build/Makefile.build:85: /rbt/linux/tools/objtool/libsubcmd/help.o] Error 1
> HOSTCC scripts/mod/sumversion.o
> In file included from run-command.c:11:
> subcmd-util.h:8:10: fatal error: linux/compiler.h: No such file or directory
> 8 | #include <linux/compiler.h>
> | ^~~~~~~~~~~~~~~~~~
> compilation terminated.
> HOSTCC scripts/mod/symsearch.o
> make[5]: *** [/rbt/linux/tools/build/Makefile.build:85: /rbt/linux/tools/objtool/libsubcmd/run-command.o] Error 1
> UPD scripts/mod/devicetable-offsets.h
> HOSTCC scripts/mod/file2alias.o
> make[4]: *** [Makefile:78: /rbt/linux/tools/objtool/libsubcmd/libsubcmd-in.o] Error 2
> make[3]: *** [Makefile:83: /rbt/linux/tools/objtool/libsubcmd/libsubcmd.a] Error 2
> make[2]: *** [Makefile:73: objtool] Error 2
> make[1]: *** [/rbt/linux/Makefile:1430: tools/objtool] Error 2
> make[1]: *** Waiting for unfinished jobs....

This is reproducible on my machine:

make -C tools objtool CFLAGS=-w

But is doesn't matter which CFLAGS you add here, as they overwrite
objtool's include paths.

According to tools/build/Documentation/Build.txt you should use
different variables for everything below tools/, e.g.:

make -C tools objtool CFLAGS_objtool=-w

Does this help for your specific issue?

Kind regards,
Nicolas