Re: [PATCH v4] kconfig: add kconfig-sym-check static checker

Sergey Senozhatsky <[email protected]> Wed, 24 Jun 2026 12:27:32 +0900
Newsgroups gmane.linux.kbuild.devel,gmane.linux.kernel
Message-ID <[email protected]>
Hi,

On (26/06/23 10:18), Andrew Jones wrote:
> > .config:1606:warning: unknown symbol: SENSORS_APDS990X
> > .config:2498:warning: unknown symbol: APPLICOM
> > make[3]: *** [scripts/kconfig/Makefile:85: syncconfig] Error 1
> > make[2]: *** [Makefile:760: syncconfig] Error 2
> 
> Thanks, Sergey. I wasn't aware of this. Is there a way to combine that
> with some "make all" type target in order to find all the dangling
> symbols that the static checker finds?

That's how we wanted it to work.  We've got beaten by
symbols renames/removals in the past.

A demo:

- Add a dangling symbol

% echo "CONFIG_DISABLE_BUGS=y" >> .config

- Now run make (KCONFIG_WARN_UNKNOWN_SYMBOLS/KCONFIG_WERROR are env
  variables)

% KCONFIG_WARN_UNKNOWN_SYMBOLS=1 KCONFIG_WERROR=1 make oldconfig

.config:4693:warning: unknown symbol: DISABLE_BUGS
make[2]: *** [scripts/kconfig/Makefile:85: oldconfig] Error 1
make[1]: *** [/media/dev/linux/Makefile:760: oldconfig] Error 2
make: *** [Makefile:248: __sub-make] Error 2

And make fails.

kconfig reads the symbols for (pretty much?) all the targets, it
needs to make sure that nothing is missing (SAT), that there are
no conflicts and so on.  Detecting unrecognized .config symbols
on the kconfig level is a low hanging fruit, in this regard.