Re: [PATCH] rust: Disallow BTF generation with Rust + LTO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 09, 2025 at 02:41:50PM -0800, Matthew Maurer wrote:
> Doing a little more digging, I've also found that the latest version
> of `pahole` doesn't seem to conflict with LTO in my test builds - it
> seems to successfully filter out the Rust types. Version 1.25 was
> causing the errors that got reported to me and I was able to
> reproduce.

Right, I recall now that this multi-lang mixup of DWARF tags theory came
up in the past and IIRC were fixed by:

commit b98565e7b17ec24daeb0b17f8f403c263dfcbd36
Author: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Date:   Tue Oct 1 14:57:25 2024 -0300

    dwarf_loader: Honour --lang_exclude when merging LTO built CUs
    
    When building kernels with clang, thin-LTO, the Rust DWARF tags were
    being added, which causes confusion as there has not been a concerted
    effort to check if what is being generated is useful/valid.
    
    At least the Rust DWARF tags, when converted to BTF, were not causing
    crashes, which is a good signal.
    
    Fix it by passing a 'struct cu' with all fields zeroed except for the
    CU name and its language code. This is enough for the existing filter,
    in pahole (cu__filter) and will also allow us to, in verbose mode, show
    the CU names being filtered.
    
    Reported-by: Tom Stellard <tstellar@xxxxxxxxxx>
    Cc: Alan Maguire <alan.maguire@xxxxxxxxxx>
    Cc: Don Zickus <dzickus@xxxxxxxxxx>
    Cc: Josh Stone <jistone@xxxxxxxxxx>
    Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>

So there was a mixup, but not in the DWARF data, but in the way pahole
processes LTO built CUs, combining then into one to resolve inter CU tag
references, by not filtering the Rust CUs.

But as the message there mentions, it would be good to process tags that
are valid as BTF while "voiding", i.e. filtering the ones that are not,
I'll try to continue experimenting with it as reported in this thread,
this way we could stop using lang_exclude and have some degree of Rust
BTF support that could maybe be useful to some use cases, who knows.

- Arnaldo




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux