]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
rust: work around `bindgen` 0.69.0 issue
authorMiguel Ojeda <ojeda@kernel.org>
Tue, 9 Jul 2024 16:06:03 +0000 (18:06 +0200)
committerMiguel Ojeda <ojeda@kernel.org>
Wed, 10 Jul 2024 08:28:52 +0000 (10:28 +0200)
`bindgen` 0.69.0 contains a bug: `--version` does not work without
providing a header [1]:

    error: the following required arguments were not provided:
      <HEADER>

    Usage: bindgen <FLAGS> <OPTIONS> <HEADER> -- <CLANG_ARGS>...

Thus, in preparation for supporting several `bindgen` versions, work
around the issue by passing a dummy argument.

Include a comment so that we can remove the workaround in the future.

Link: https://github.com/rust-lang/rust-bindgen/pull/2678
Reviewed-by: Finn Behrens <me@kloenk.dev>
Tested-by: Benno Lossin <benno.lossin@proton.me>
Tested-by: Andreas Hindborg <a.hindborg@samsung.com>
Link: https://lore.kernel.org/r/20240709160615.998336-9-ojeda@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
init/Kconfig
scripts/rust_is_available.sh

index febdea2afc3be3ffeeb2029386ea931f364dec1c..94e20d3b99d4fec0f69618da20c5e047e06f1388 100644 (file)
@@ -1928,7 +1928,10 @@ config RUSTC_VERSION_TEXT
 config BINDGEN_VERSION_TEXT
        string
        depends on RUST
-       default $(shell,command -v $(BINDGEN) >/dev/null 2>&1 && $(BINDGEN) --version || echo n)
+       # The dummy parameter `workaround-for-0.69.0` is required to support 0.69.0
+       # (https://github.com/rust-lang/rust-bindgen/pull/2678). It can be removed when
+       # the minimum version is upgraded past that (0.69.1 already fixed the issue).
+       default $(shell,command -v $(BINDGEN) >/dev/null 2>&1 && $(BINDGEN) --version workaround-for-0.69.0 || echo n)
 
 #
 # Place an empty function call at each tracepoint site. Can be
index 67cb900124cc9b25c9db522db58b1fdf08f1bc20..1881e8f2a2b90d5cd2a7dfb416d9229751f08593 100755 (executable)
@@ -121,8 +121,12 @@ fi
 # Check that the Rust bindings generator is suitable.
 #
 # Non-stable and distributions' versions may have a version suffix, e.g. `-dev`.
+#
+# The dummy parameter `workaround-for-0.69.0` is required to support 0.69.0
+# (https://github.com/rust-lang/rust-bindgen/pull/2678). It can be removed when
+# the minimum version is upgraded past that (0.69.1 already fixed the issue).
 rust_bindings_generator_output=$( \
-       LC_ALL=C "$BINDGEN" --version 2>/dev/null
+       LC_ALL=C "$BINDGEN" --version workaround-for-0.69.0 2>/dev/null
 ) || rust_bindings_generator_code=$?
 if [ -n "$rust_bindings_generator_code" ]; then
        echo >&2 "***"