Re: [PATCH] rust: Disallow BTF generation with Rust + LTO
From: Arnaldo Carvalho de Melo
Date: Thu Jan 09 2025 - 10:48:01 EST
On Thu, Jan 09, 2025 at 09:55:34AM -0500, Tamir Duberstein wrote:
> > > > On Thu, Jan 9, 2025 at 12:35 AM Matthew Maurer <mmaurer@xxxxxxxxxx> wrote:
> > > > > The kernel cannot currently self-parse BTF containing Rust debug
> > > > > information. pahole uses the language of the CU to determine whether to
> > > > > filter out debug information when generating the BTF.
> In bpf-linker[0] we implemented "sanitization" to allow Rust DI to
> produce functional BTF[1]. This is certainly outside the scope of this
> change but: could pahole adopt a similar strategy rather than
> employing such coarse heuristics?
I was thinking about it after reading this thread yesterday, i.e. we
could encode constructs from Rust that can be represented in BTF and
skip the ones that can't, pruning types that depend on non BTF
representable types, etc.
This way we wouldn't care what language it was written on, as long as we
can represent the types in BTF.
I'll try to do some experimentation with this idea.
- Arnaldo
> [0] https://github.com/aya-rs/bpf-linker
> [1] https://github.com/aya-rs/bpf-linker/blob/e4a9267b0fee69ecb2550058d3c8e5233f946ebe/src/llvm/di.rs