[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260129232535.GD844102@ax162>
Date: Thu, 29 Jan 2026 16:25:35 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: Charalampos Mitrodimas <charmitro@...teo.net>
Cc: Asuna Yang <xinrui.riscv@...c.iscas.ac.cn>,
Nicolas Schier <nsc@...nel.org>, Miguel Ojeda <ojeda@...nel.org>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <lossin@...nel.org>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>,
Nick Desaulniers <nick.desaulniers+lkml@...il.com>,
Bill Wendling <morbo@...gle.com>,
Justin Stitt <justinstitt@...gle.com>,
Paul Walmsley <pjw@...nel.org>, Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>, Alexandre Ghiti <alex@...ti.fr>,
Jonathan Corbet <corbet@....net>, Conor Dooley <conor@...nel.org>,
Mingcong Bai <jeffbai@...c.io>, Han Gao <rabenda.cn@...il.com>,
Vivian Wang <wangruikang@...as.ac.cn>,
Jason Montleon <jmontleo@...hat.com>, linux-kbuild@...r.kernel.org,
linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org,
llvm@...ts.linux.dev, linux-riscv@...ts.infradead.org,
linux-doc@...r.kernel.org
Subject: Re: [PATCH v6 4/4] RISC-V: handle extension configs for bindgen,
re-enable gcc + rust builds
On Thu, Jan 29, 2026 at 01:49:56PM +0000, Charalampos Mitrodimas wrote:
> I'm under the impression that the `!RUST ||` guard here doesn't
> actually prevent the `$(bindgen-backend-option,...)` call from being
> executed. `$(...)` shell expansions should happen during the textual
> substitution phase, before symbol dependency evaluation occurs, check
> documentation at kconfig-macro-language.rst lines 228-229.
>
> I did this test:
> $ cat /tmp/fake_bindgen
> #!/bin/bash
> echo "[BINDGEN INVOKED] $(date '+%H:%M:%S') args: $@" >> /tmp/bindgen_calls.log
> # Call real bindgen
> exec /home/charmitro/.cargo/bin/bindgen "$@"
>
> $ make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- BINDGEN=/tmp/fake_bindgen defconfig
> HOSTCC scripts/basic/fixdep
> ...
> *** Default configuration is based on 'defconfig'
> #
> # configuration written to .config
> #
>
> $ linux git:(master) rg CONFIG_RUST .config
> ...
> 283:# CONFIG_RUST is not set
> ...
>
> $ cat /tmp/bindgen_calls.log
> [BINDGEN INVOKED] 15:44:44 args: --version workaround-for-0.69.0
> [BINDGEN INVOKED] 15:44:44 args: ./scripts/rust_is_available_bindgen_libclang.h
> [BINDGEN INVOKED] 15:44:44 args: --version workaround-for-0.69.0
> [BINDGEN INVOKED] 15:44:44 args: /dev/null -- -x c --target=riscv64-linux-gnu -mabi=lp64 -march=rv64imv
> [BINDGEN INVOKED] 15:44:44 args: /dev/null -- -x c --target=riscv64-linux-gnu -mabi=ilp32 -march=rv32imv
> [BINDGEN INVOKED] 15:44:44 args: /dev/null -- -x c --target=riscv64-linux-gnu -mabi=lp64 -march=rv64ima_zabha
> [BINDGEN INVOKED] 15:44:44 args: /dev/null -- -x c --target=riscv64-linux-gnu -mabi=ilp32 -march=rv32ima_zabha
> [BINDGEN INVOKED] 15:44:45 args: /dev/null -- -x c --target=riscv64-linux-gnu -mabi=lp64 -march=rv64ima_zacas
> [BINDGEN INVOKED] 15:44:45 args: /dev/null -- -x c --target=riscv64-linux-gnu -mabi=ilp32 -march=rv32ima_zacas
> [BINDGEN INVOKED] 15:44:45 args: /dev/null -- -x c --target=riscv64-linux-gnu -mabi=lp64 -march=rv64ima_zbb
> [BINDGEN INVOKED] 15:44:45 args: /dev/null -- -x c --target=riscv64-linux-gnu -mabi=ilp32 -march=rv32ima_zbb
> [BINDGEN INVOKED] 15:44:45 args: /dev/null -- -x c --target=riscv64-linux-gnu -mabi=lp64 -march=rv64ima_zba
> [BINDGEN INVOKED] 15:44:45 args: /dev/null -- -x c --target=riscv64-linux-gnu -mabi=ilp32 -march=rv32ima_zba
> [BINDGEN INVOKED] 15:44:45 args: /dev/null -- -x c --target=riscv64-linux-gnu -mabi=lp64 -march=rv64ima_zbc
> [BINDGEN INVOKED] 15:44:46 args: /dev/null -- -x c --target=riscv64-linux-gnu -mabi=ilp32 -march=rv32ima_zbc
> [BINDGEN INVOKED] 15:44:46 args: /dev/null -- -x c --target=riscv64-linux-gnu -mabi=lp64 -march=rv64ima_zbkb
> [BINDGEN INVOKED] 15:44:46 args: /dev/null -- -x c --target=riscv64-linux-gnu -mabi=ilp32 -march=rv32ima_zbkb
> [BINDGEN INVOKED] 15:44:46 args: /dev/null -- -x c --target=riscv64-linux-gnu -mabi=lp64 -march=rv64ima_zicsr_zifencei
> [BINDGEN INVOKED] 15:44:46 args: /dev/null -- -x c --target=riscv64-linux-gnu -mabi=ilp32 -march=rv32ima_zicsr_zifencei
>
> So, CONFIG_RUST not set, yet bindgen was invoked. Not sure if that is
> intentional though.
While I have only recently adopted Kconfig, the section you pointed to
in kconfig-macro-language.rst makes it seem like this is expected. I
read that to mean all shell commands are going to be evaluated and
effectively turned into "y" and "n" before dependencies are evaluated.
You can test this with something like:
if RUST
config RUST_FOOBAR
def_bool $(bindgen-backend-option,-obviously-not-supported)
endif
added in init/Kconfig and running your fake bindgen.
While this is obviously a little wasteful, I suspect this drastically
simplifies the shell commands part of Kconfig for no change in runtime
behavior. The way that the dependency is currently written ensures that
either the result of bindgen-backend-option matters for the sake of
saying an extension is fully supported by the toolchain (when Rust is
enabled) or it does not matter (because Rust is not enabled).
Cheers,
Nathan
Powered by blists - more mailing lists