Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rust: kbuild: update `bindgen --rust-target` version and replace comment

As the comment in the `Makefile` explains, previously, we needed to
limit ourselves to the list of Rust versions known by `bindgen` for its
`--rust-target` option [1].

In other words, we needed to consult the versions known by the minimum
version of `bindgen` that we supported.

Now that we bumped the minimum version of `bindgen`, that limitation
does not apply anymore since `bindgen` 0.71.0 [2].

Thus replace the comment and simply write our minimum supported Rust
version there, which is much simpler.

See commit 7a5f93ea5862 ("rust: kbuild: set `bindgen`'s Rust target
version") for more details.

Link: https://rust-lang.zulipchat.com/#narrow/channel/425075-rust-for-linux/topic/rust.20version.20on.20generated.20bindings/near/484087179 [1]
Link: https://github.com/rust-lang/rust-bindgen/pull/2993 [2]
Reviewed-by: Tamir Duberstein <tamird@kernel.org>
Reviewed-by: Gary Guo <gary@garyguo.net>
Link: https://patch.msgid.link/20260405235309.418950-21-ojeda@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

+2 -14
+2 -14
rust/Makefile
··· 441 441 # architecture instead of generating `usize`. 442 442 bindgen_c_flags_final = $(bindgen_c_flags_lto) -fno-builtin -D__BINDGEN__ 443 443 444 - # Each `bindgen` release may upgrade the list of Rust target versions. By 445 - # default, the highest stable release in their list is used. Thus we need to set 446 - # a `--rust-target` to avoid future `bindgen` releases emitting code that 447 - # `rustc` may not understand. On top of that, `bindgen` does not support passing 448 - # an unknown Rust target version. 449 - # 450 - # Therefore, the Rust target for `bindgen` can be only as high as the minimum 451 - # Rust version the kernel supports and only as high as the greatest stable Rust 452 - # target supported by the minimum `bindgen` version the kernel supports (that 453 - # is, if we do not test the actual `rustc`/`bindgen` versions running). 454 - # 455 - # Starting with `bindgen` 0.71.0, we will be able to set any future Rust version 456 - # instead, i.e. we will be able to set here our minimum supported Rust version. 444 + # `--rust-target` points to our minimum supported Rust version. 457 445 quiet_cmd_bindgen = BINDGEN $@ 458 446 cmd_bindgen = \ 459 - $(BINDGEN) $< $(bindgen_target_flags) --rust-target 1.68 \ 447 + $(BINDGEN) $< $(bindgen_target_flags) --rust-target 1.85 \ 460 448 --use-core --with-derive-default --ctypes-prefix ffi --no-layout-tests \ 461 449 --no-debug '.*' --enable-function-attribute-detection \ 462 450 -o $@ -- $(bindgen_c_flags_final) -DMODULE \