Rust for Linux List
 help / color / mirror / Atom feed
From: Alan Maguire <almagui@kernel.org>
To: Alan Derk <linux@alanderk.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Alan Maguire <alan.maguire@oracle.com>,
	bpf@vger.kernel.org, dwarves@vger.kernel.org,
	rust-for-linux@vger.kernel.org
Subject: Re: [PATCH dwarves v2 0/2] dwarf_loader: Fix --lang_exclude on merged CUs
Date: Sat, 14 Nov 2026 16:27:41 +0000	[thread overview]
Message-ID: <4a5157e7-2261-49cd-80ef-38dcc2699741@kernel.org> (raw)
In-Reply-To: <CAPLSpGbV5RTSuMZPX=UgzniPtoT7jup7pCGw_Rt2tqiejKXmng@mail.gmail.com>

On 11/5/26 4:48 PM, Alan Derk wrote:
> On Wed, Nov 4, 2026 at 7:38 AM Alan Maguire wrote:
>> Thanks for doing this work! Sorry for the delay in getting to it, I'm
>> looking at the patches now.
> 
> Of course. Please take your time on the review. And thanks for the
> background on the Rust BTF work.
>

Changes are applied, thanks for fixing these issues! I'm thinking we should
probably add a CI job that builds an LTO vmlinux; I'll look at doing that
shortly.
 
>> We've been working on a solution; essentially, the idea is to detect
>> such cases and fix up the type graph in pahole using a new
>> "rust_bindgen_replace" feature so that the final BTF does not have to
>> carry such duplicates. It will only run for Rust CUs, [...]
> 
> Patches 1-2 are general --lang_exclude fixes (both reproducers are
> C++/C). The Kconfig follow-up keeps --lang_exclude=rust, so it is a
> stopgap: Rust stays out of BTF, as it does without LTO, until
> rust_bindgen_replace brings Rust types in. I realize it may not be
> worth it, though it would -- if I understand correctly -- unblock RUST with
> LTO and BTF in the meantime.
> 
> To check how this series of patches fits with your branch, I applied it on
> top of pahole-next-btf-rust (b5e46f8; it applies cleanly) and tried both on
> the 7.2.9 kernels I tested the series on (x86_64 ThinLTO, full LTO
> and distributed ThinLTO, arm64 ThinLTO) and a non-LTO x86_64 build,
> booting each in qemu and loading rust_minimal, rust_print and
> kobject-example:
> 
> - With kbuild's flags (--lang_exclude=rust), the branch alone fails to
>   build the Rust sample modules on the LTO kernels, as patch 1
>   describes. With the series on top, all five kernels build, boot and
>   load the three modules with BTF.
> - With rust_bindgen_replace and nothing excluded, the series changes
>   nothing: vmlinux and module BTF are byte-identical with and without
>   it.
> 
> One thing I noticed along the way, since it's the merged-CU language
> that patch 1 deals with: under LTO the merged CU has one language,
> taken from its first CU (a C or asm file for vmlinux), so
> cu__is_rust() is false and rust_bindgen_replace doesn't run on
> vmlinux. Without LTO it replaced 564 types as expected.
> 

Ah, that's a great point. May have to rethink that part. Thanks again
for giving the changes a try!

Alan

      reply	other threads:[~2026-11-14 16:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-10  0:52 [PATCH dwarves v2 0/2] dwarf_loader: Fix --lang_exclude on merged CUs Alan Derk
2026-10-10  0:52 ` [PATCH dwarves v2 1/2] dwarf_loader: Take the merged CU language from a CU that is kept Alan Derk
2026-10-10  0:52 ` [PATCH dwarves v2 2/2] dwarf_loader: Load types that kept CUs use from excluded CUs Alan Derk
2026-11-04 16:38 ` [PATCH dwarves v2 0/2] dwarf_loader: Fix --lang_exclude on merged CUs Alan Maguire
2026-11-05 16:48   ` Alan Derk
2026-11-14 16:27     ` Alan Maguire [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4a5157e7-2261-49cd-80ef-38dcc2699741@kernel.org \
    --to=almagui@kernel.org \
    --cc=acme@kernel.org \
    --cc=alan.maguire@oracle.com \
    --cc=bpf@vger.kernel.org \
    --cc=dwarves@vger.kernel.org \
    --cc=linux@alanderk.com \
    --cc=rust-for-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox