Skip to contentSkip to conversation

kbuild: CFLAGS=-w no longer works

REGRESSION Askar Safin 3 participants 6 messages Oct 9, 2025 – Dec 3, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

#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

My system info:

d-user@comp:~$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/14/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 14.2.0-19' --with-bugurl=file:///usr/share/doc/gcc-14/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2,rust --prefix=/usr --with-gcc-major-version-only --program-suffix=-14 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/reproducible-path/gcc-14-14.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/reproducible-path/gcc-14-14.2.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=3
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.2.0 (Debian 14.2.0-19) 
d-user@comp:~$ cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 13 (trixie)"
NAME="Debian GNU/Linux"
VERSION_ID="13"
VERSION="13 (trixie)"
VERSION_CODENAME=trixie
DEBIAN_VERSION_FULL=13.1
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Culpit commit (d1d096312176) produces this output:

d-user@comp:/rbt$ cd linux
d-user@comp:/rbt/linux$ git clean -f -q -d -x
d-user@comp:/rbt/linux$ echo 'CONFIG_64BIT=y' > /tmp/minimini
d-user@comp:/rbt/linux$ make allnoconfig KCONFIG_ALLCONFIG=/tmp/minimini
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  LEX     scripts/kconfig/lexer.lex.c
  YACC    scripts/kconfig/parser.tab.[ch]
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/menu.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTCC  scripts/kconfig/util.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
d-user@comp:/rbt/linux$ make -j32 CFLAGS=-w
  GEN     arch/x86/include/generated/asm/orc_hash.h
  WRAP    arch/x86/include/generated/uapi/asm/bpf_perf_event.h
  WRAP    arch/x86/include/generated/uapi/asm/errno.h
  WRAP    arch/x86/include/generated/uapi/asm/fcntl.h
  UPD     include/generated/uapi/linux/version.h
  SYSHDR  arch/x86/include/generated/uapi/asm/unistd_32.h
  WRAP    arch/x86/include/generated/uapi/asm/ioctl.h
  SYSHDR  arch/x86/include/generated/uapi/asm/unistd_64.h
  WRAP    arch/x86/include/generated/uapi/asm/ioctls.h
  WRAP    arch/x86/include/generated/uapi/asm/ipcbuf.h
  SYSHDR  arch/x86/include/generated/uapi/asm/unistd_x32.h
  SYSTBL  arch/x86/include/generated/asm/syscalls_32.h
  WRAP    arch/x86/include/generated/uapi/asm/param.h
  SYSHDR  arch/x86/include/generated/asm/unistd_32_ia32.h
  WRAP    arch/x86/include/generated/uapi/asm/poll.h
  WRAP    arch/x86/include/generated/uapi/asm/resource.h
  SYSHDR  arch/x86/include/generated/asm/unistd_64_x32.h
  WRAP    arch/x86/include/generated/uapi/asm/socket.h
  SYSTBL  arch/x86/include/generated/asm/syscalls_64.h
  WRAP    arch/x86/include/generated/uapi/asm/sockios.h
  WRAP    arch/x86/include/generated/uapi/asm/termbits.h
  WRAP    arch/x86/include/generated/uapi/asm/termios.h
  WRAP    arch/x86/include/generated/uapi/asm/types.h
  HOSTCC  arch/x86/tools/relocs_32.o
  HOSTCC  arch/x86/tools/relocs_64.o
  HOSTCC  arch/x86/tools/relocs_common.o
  UPD     include/generated/compile.h
  WRAP    arch/x86/include/generated/asm/early_ioremap.h
  WRAP    arch/x86/include/generated/asm/fprobe.h
  HOSTCC  scripts/kallsyms
  WRAP    arch/x86/include/generated/asm/mcs_spinlock.h
  WRAP    arch/x86/include/generated/asm/mmzone.h
  HOSTCC  scripts/sorttable
  WRAP    arch/x86/include/generated/asm/irq_regs.h
  WRAP    arch/x86/include/generated/asm/kmap_size.h
  WRAP    arch/x86/include/generated/asm/local64.h
  WRAP    arch/x86/include/generated/asm/mmiowb.h
  WRAP    arch/x86/include/generated/asm/module.lds.h
  UPD     include/config/kernel.release
  WRAP    arch/x86/include/generated/asm/rwonce.h
  DESCEND objtool
  UPD     include/generated/utsrelease.h
  INSTALL /rbt/linux/tools/objtool/libsubcmd/include/subcmd/exec-cmd.h
  INSTALL /rbt/linux/tools/objtool/libsubcmd/include/subcmd/help.h
  INSTALL /rbt/linux/tools/objtool/libsubcmd/include/subcmd/pager.h
  INSTALL /rbt/linux/tools/objtool/libsubcmd/include/subcmd/parse-options.h
  INSTALL /rbt/linux/tools/objtool/libsubcmd/include/subcmd/run-command.h
  INSTALL libsubcmd_headers
  HOSTLD  arch/x86/tools/relocs
  CC      scripts/mod/empty.o
  HOSTCC  scripts/mod/mk_elfconfig
  CC      scripts/mod/devicetable-offsets.s
  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....
  HOSTLD  scripts/mod/modpost
  CC      kernel/bounds.s
  CHKSHA1 include/linux/atomic/atomic-arch-fallback.h
  CHKSHA1 include/linux/atomic/atomic-instrumented.h
  CHKSHA1 include/linux/atomic/atomic-long.h
  UPD     include/generated/timeconst.h
  UPD     include/generated/bounds.h
  CC      arch/x86/kernel/asm-offsets.s
  UPD     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
make: *** [Makefile:251: __sub-make] Error 2
Signature · 1 line
Askar Safin
#1 lore raw

The bug still reproducible with current kbuild-next (2ea77fca84f07849aa995271271340d262d0c2e9)

Signature · 1 line
Askar Safin
maintainer
#2 lore raw
In reply to Askar Safin
Quoted 6 lines · Askar Safin

#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.

Quoted 7 lines

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.

[...]

Quoted 39 lines
  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

Quoted 8 lines

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

#3 lore raw
Quoted 2 lines · Nicolas Schier

If you want to hand-over additional CFLAGS to kbuild you need to use KCFLAGS or other variations, see Documentation/kbuild/kbuild.rst.

Oops, I'm sorry.
#regzbot invalid: there is no bug, kbuild works as documented

Signature · 1 line
Askar Safin
#4 lore raw
In reply to Askar Safin

Hi Askar,

Quoted 6 lines · Askar Safin

#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.

Quoted 7 lines

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

As Nicolas pointed out, CFLAGS has not be hooked into Kbuild for a long time, see commit 69ee0b352242 ("kbuild: do not pick up CFLAGS from the environment"). You would need to use KCFLAGS=-w to accomplish the same thing. KCFLAGS is only for the kernel build though, you would need HOSTCFLAGS=-w as well to ignore warnings when building the host programs such as objtool.

It does seem like the objtool Makefile should be hardened against CFLAGS being passed in from the command line so that the build does not break like this though.

Cheers,
Nathan