Re: [PATCH v4] kconfig: add kconfig-sym-check static checker
From: Sergey Senozhatsky
Date: Wed Jun 24 2026 - 23:44:09 EST
On (26/06/24 13:28), Julian Braha wrote:
> On 6/24/26 04:34, Sergey Senozhatsky wrote:
> > OK, maybe they are not similar, as Julian pointed out. Makes
> > we wonder is there any benefit in moving this functionality
> > into kconfig (which is the tool that deals with Kconfig files).
>
> Agreed, it would be ideal if the check could be part of the kconfig
> interpeter.
>
> However...
Right... There's always a "however" :)
> Linux does a funky thing with its architecture handling in kconfig:
> it looks up the architecture from a makefile variable and uses that to
> resolve a kconfig file import in 'arch/Kconfig'.
>
> This means e.g. when evaluating the kconfig on an x86 machine, all of
> the config options in the RISC-V kconfig are never reached, thus never
> parsed, and never added to the symbol table. As far as the interpeter is
> aware, any reference to, say, RISCV_SBI is a dead reference on x86.
>
> Yet, options throughout the kernel can reference arch-specific options.
> Try searching in menuconfig for the RISCV-only option HVC_RISCV_SBI on
> x86, and you'll successfully find it, because it's defined in 'drivers/'
> (not downstream of arch/Kconfig). Then try searching for its dependency,
> RISCV_SBI. Apparently it doesn't exist? In my opinion, this should also
> be considered a bug in the frontend...
>
> All this is to say, until architectures are restructured in kconfig,
> alarming on unknown options would output 99% noise.
Agreed, let's keep it simple. Thank you!