Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Kernel & Hardware
  • Search

Can I have Rust, BTF, and LTO enabled at the same time?

Kernel not recognizing your hardware? Problems with power management or PCMCIA? What hardware is compatible with Gentoo? See here. (Only for kernels supported by Gentoo.)
Post Reply
Advanced search
8 posts • Page 1 of 1
Author
Message
leyvi
l33t
l33t
Posts: 806
Joined: Fri Sep 08, 2023 1:22 pm

Can I have Rust, BTF, and LTO enabled at the same time?

  • Quote

Post by leyvi » Tue May 12, 2026 5:31 pm

I'm asking because it looks like I can't, but maybe there's something I don't know. I'm asking because I'm starting to get into AutoFDO profiling, which is supposed to benefit from LTO.
Top
Hu
Administrator
Administrator
Posts: 24556
Joined: Tue Mar 06, 2007 5:38 am

Re: Can I have Rust, BTF, and LTO enabled at the same time?

  • Quote

Post by Hu » Tue May 12, 2026 8:28 pm

Why do you think you cannot have them all? What error messages did you see when you tried? What document did you read that told you that this cannot work?
Top
leyvi
l33t
l33t
Posts: 806
Joined: Fri Sep 08, 2023 1:22 pm

Re: Can I have Rust, BTF, and LTO enabled at the same time?

  • Quote

Post by leyvi » Tue May 12, 2026 9:01 pm

Hu wrote: Tue May 12, 2026 8:28 pm Why do you think you cannot have them all? What error messages did you see when you tried? What document did you read that told you that this cannot work?
In menuconfig, it says that CONFIG_RUST depends on a long list of things being present or absent. Among other things, it would seem that I can't have debug symbols and LTO, among other things. See "Depends on:" for CONFIG_RUST.
Top
skellr
Veteran
Veteran
User avatar
Posts: 1051
Joined: Sat Jun 18, 2005 1:34 am
Location: The Village, Portmeirion

Re: Can I have Rust, BTF, and LTO enabled at the same time?

  • Quote

Post by skellr » Wed May 13, 2026 5:13 am

leyvi wrote: Tue May 12, 2026 9:01 pmIn menuconfig, it says that CONFIG_RUST depends on a long list of things being present or absent. Among other things, it would seem that I can't have debug symbols and LTO, among other things. See "Depends on:" for CONFIG_RUST.
You want to enable the rust-src use flag for rust. The others may already be set by default:

Code: Select all

dev-lang/rust rust-src rustfmt clippy
Then check to see if you have the requirements to use rust:

Code: Select all

make LLVM=1 rustavailable
You want debug but not split debug for CONFIG_DEBUG_INFO_BTF:
!DEBUG_INFO_SPLIT [=n] && !DEBUG_INFO_REDUCED [=n]

and pahole: PAHOLE_VERSION [=131] >=122 && !HEXAGON
Top
leyvi
l33t
l33t
Posts: 806
Joined: Fri Sep 08, 2023 1:22 pm

Re: Can I have Rust, BTF, and LTO enabled at the same time?

  • Quote

Post by leyvi » Wed May 13, 2026 4:22 pm

Hang on; CONFIG_RUST depends on CONFIG_GENDWARFKSYMS (if CONFIG_MODVERSIONS is set, which is needed by CONFIG_RUST through CONFIG_EXTENDED_MODVERSIONS) which can't be enabled at the same time as CONFIG_LTO.

It also looks like DEBUG_INFO_BTF and CONFIG_LTO cannot both be enabled if CONFIG_RUST is enabled:

Code: Select all

(!DEBUG_INFO_BTF [=y] || PAHOLE_HAS_LANG_EXCLUDE [=y] && !LTO [=n])
So I can't have all 3.

This seems unintuitive to me; why isn't this possible? Am I mistaken?
Top
Hu
Administrator
Administrator
Posts: 24556
Joined: Tue Mar 06, 2007 5:38 am

Re: Can I have Rust, BTF, and LTO enabled at the same time?

  • Quote

Post by Hu » Wed May 13, 2026 4:55 pm

git blame on the blocking depends on line leads me to commit 5daa0c35a1f0e7a6c3b8ba9cb721e7d1ace6e619:

Code: Select all

author Matthew Maurer <mmaurer@google.com> Wed Jan 8 23:35:08 2025 +0000
committer Miguel Ojeda <ojeda@kernel.org> Tue Mar 11 20:11:09 2025 +0100

rust: Disallow BTF generation with Rust + LTO

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. When LTO is
enabled, Rust code can cross CU boundaries, resulting in Rust debug
information in CUs labeled as C. This results in a system which cannot
parse its own BTF.

Signed-off-by: Matthew Maurer <mmaurer@google.com>
Cc: stable@vger.kernel.org
Fixes: c1177979af9c ("btf, scripts: Exclude Rust CUs with pahole")
Link: https://lore.kernel.org/r/20250108-rust-btf-lto-incompat-v1-1-60243ff6d820@google.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Does that log message answer your question?
Top
skellr
Veteran
Veteran
User avatar
Posts: 1051
Joined: Sat Jun 18, 2005 1:34 am
Location: The Village, Portmeirion

Re: Can I have Rust, BTF, and LTO enabled at the same time?

  • Quote

Post by skellr » Wed May 13, 2026 5:09 pm

leyvi wrote: Wed May 13, 2026 4:22 pm Hang on; CONFIG_RUST depends on CONFIG_GENDWARFKSYMS (if CONFIG_MODVERSIONS is set, which is needed by CONFIG_RUST through CONFIG_EXTENDED_MODVERSIONS) which can't be enabled at the same time as CONFIG_LTO.

It also looks like DEBUG_INFO_BTF and CONFIG_LTO cannot both be enabled if CONFIG_RUST is enabled:

Code: Select all

(!DEBUG_INFO_BTF [=y] || PAHOLE_HAS_LANG_EXCLUDE [=y] && !LTO [=n])
So I can't have all 3.

This seems unintuitive to me; why isn't this possible? Am I mistaken?
Ohh, no. I was mistaken.
I just went though the config enabling CONFIG_RUST and then enabling CONFIG_DEBUG_INFO_BTF and didn't notice that it disabled CONFIG_RUST

Sorry about that.
Top
leyvi
l33t
l33t
Posts: 806
Joined: Fri Sep 08, 2023 1:22 pm

Re: Can I have Rust, BTF, and LTO enabled at the same time?

  • Quote

Post by leyvi » Wed May 13, 2026 5:35 pm

Hu wrote: Wed May 13, 2026 4:55 pm git blame on the blocking depends on line leads me to commit 5daa0c35a1f0e7a6c3b8ba9cb721e7d1ace6e619:

Code: Select all

author Matthew Maurer <mmaurer@google.com> Wed Jan 8 23:35:08 2025 +0000
committer Miguel Ojeda <ojeda@kernel.org> Tue Mar 11 20:11:09 2025 +0100

rust: Disallow BTF generation with Rust + LTO

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. When LTO is
enabled, Rust code can cross CU boundaries, resulting in Rust debug
information in CUs labeled as C. This results in a system which cannot
parse its own BTF.

Signed-off-by: Matthew Maurer <mmaurer@google.com>
Cc: stable@vger.kernel.org
Fixes: c1177979af9c ("btf, scripts: Exclude Rust CUs with pahole")
Link: https://lore.kernel.org/r/20250108-rust-btf-lto-incompat-v1-1-60243ff6d820@google.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Does that log message answer your question?
Yes, thank you.

I should probably figure out how to use git blame.
Top
Post Reply

8 posts • Page 1 of 1

Return to “Kernel & Hardware”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Authors
Gentoo is a trademark of the Gentoo Foundation, Inc. and of Förderverein Gentoo e.V.
The contents of this document, unless otherwise expressly stated, are licensed under the CC-BY-SA-4.0 license.
The Gentoo Name and Logo Usage Guidelines apply.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy