Rust-for-Linux/linux

`bindgen` breaks build with `ftrace_branch_data_union_...` (LLVM >= 16)

ojeda opened this issue · 6 comments

ojeda commented

Reported by Aakash Sen Sharma (@Shinyzenith) at https://rust-for-linux.zulipchat.com/#narrow/stream/291565-Help/topic/Build.20errors/near/364313442.

Requires LLVM >= 16 to reproduce. bindgen 0.62.0 fixes it: rust-lang/rust-bindgen#2488, rust-lang/rust-bindgen#2319 (thanks @cuviper for the pointer!).

❯ make rustdoc LLVM=1 CLIPPY=1 -j$(nproc)
  DESCEND objtool
  CALL    scripts/checksyscalls.sh
  INSTALL libsubcmd_headers
  RUSTC L rust/core.o
  BINDGEN rust/bindings/bindings_generated.rs
  BINDGEN rust/bindings/bindings_helpers_generated.rs
  BINDGEN rust/uapi/uapi_generated.rs
thread 'main' panicked at '"ftrace_branch_data_union_(anonymous_at__/_/include/linux/compiler_types_h_146_2)" is not a valid Ident', /home/aakash/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.24/src/fallback.rs:693:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
make[1]: *** [rust/Makefile:316: rust/uapi/uapi_generated.rs] Error 1
make[1]: *** Deleting file 'rust/uapi/uapi_generated.rs'
make[1]: *** Waiting for unfinished jobs....
thread 'main' panicked at '"ftrace_branch_data_union_(anonymous_at__/_/include/linux/compiler_types_h_146_2)" is not a valid Ident', /home/aakash/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.24/src/fallback.rs:693:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
make[1]: *** [rust/Makefile:310: rust/bindings/bindings_generated.rs] Error 1
make[1]: *** Deleting file 'rust/bindings/bindings_generated.rs'
make: *** [Makefile:1293: prepare] Error 2

@fbq Has the patch been merged upstream?

If you mean Linus' tree, no, he will merge our PR (which includes the upgrade) during the merge window, in 2-4 weeks.

Cool! Thank you.

The fix is in the rust-next branch in commit 08ab786 ("rust: bindgen: upgrade to 0.65.1").