Re: [PATCH] rust: kbuild: generate a symbol version for rust_build_error

From: Sami Tolvanen

Date: Wed Nov 18 2026 - 19:45:36 EST


On Wed, Nov 18, 2026 at 1:08 AM Peder Bergan via B4 Relay
<devnull+peder.bergan.gmail.com@xxxxxxxxxx> wrote:
>
> From: Peder Bergan <peder.bergan@xxxxxxxxx>
>
> CONFIG_RUST_BUILD_ASSERT_ALLOW exports rust_build_error to modules.
> When CONFIG_MODVERSIONS is also enabled, modpost warns that the export
> has no symbol version and records a zero CRC because the build_error.o
> rule skips gendwarfksyms.
>
> Generate the checksum from build_error.o with the existing Rust library
> rule. Make build_error.o depend on rust/Makefile when module versioning
> is enabled so incremental builds pick up the change. Kbuild's saved
> rustc command does not include the gendwarfksyms step.
>
> Fixes: ac61506bf2d1 ("rust: Use gendwarfksyms + extended modversions for CONFIG_MODVERSIONS")
> Reported-by: Gwan-gyeong Mun <gwan-gyeong.mun@xxxxxxxxx>
> Closes: https://github.com/Rust-for-Linux/linux/issues/1201
> Signed-off-by: Peder Bergan <peder.bergan@xxxxxxxxx>
> ---
> An incremental x86-64 build with LLVM=1 CLIPPY=1 clears the modpost
> warning. The kernel export and a Rust module that references it both
> record the same nonzero CRC.
>
> OpenAI Codex assisted with coding and testing.
> ---
> rust/Makefile | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)

Reviewed-by: Sami Tolvanen <samitolvanen@xxxxxxxxxx>

Sami