Forums

Skip to content

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

any info for latest kernel LTO?

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
honeymak
l33t
l33t
User avatar
Posts: 680
Joined: Mon Dec 30, 2002 5:15 pm

any info for latest kernel LTO?

  • Quote

Post by honeymak » Tue Mar 24, 2026 10:32 am

i would like to know any steps for gentoo-sources kernel to do LTO or -flto=auto in any place

btw, is it stable or latest tech for kernel LTO?

thx

:wink: :wink: :roll: :roll:
hackers - make sth real
academics - read sth said to be real
Top
Goverp
Advocate
Advocate
User avatar
Posts: 2402
Joined: Wed Mar 07, 2007 6:41 pm

  • Quote

Post by Goverp » Tue Mar 24, 2026 12:17 pm

IIRC it's possible to build an LTO kernel using gcc, but the normal path is to use clang/LLVM.
You have to select LTO in the kernel configuration, usually

Code: Select all

General architecture-dependent options
  Link Time Optimization (LTO)
    Clang ThinLTO (experimental)
AND you must pass some environment options to the kernel make:

Code: Select all

CC='clang'
LLVM='1'
I doubt it's a good idea to try Clan Full LTO, but I've not tried it.

I've been compiling my kernels this way for ages.
Greybeard
Top
honeymak
l33t
l33t
User avatar
Posts: 680
Joined: Mon Dec 30, 2002 5:15 pm

  • Quote

Post by honeymak » Tue Mar 24, 2026 12:21 pm

i am a gcc guy

i am actually editing kernel makefiles for my cflags
while -flto=auto does not work that way

that's why i am trying to ask here if any extra info
clang/llvm way sorta not my intention

:roll: :roll:
hackers - make sth real
academics - read sth said to be real
Top
krumpf
Apprentice
Apprentice
User avatar
Posts: 268
Joined: Sun Jul 15, 2018 11:21 pm

  • Quote

Post by krumpf » Tue Mar 24, 2026 6:34 pm

To compile kernel with GCC and LTO, read here : https://wiki.gentoo.org/wiki/Kernel/Opt ... timization
The gentoo-sources package itself doesn't care about flto, it's just decompressing the archive containing source files with some gentoo specific patches. As Goverp said, it's easier to LTOize the kernel when building it with Clang.
Dragon Princess Music Games Heroes and villains
Top
honeymak
l33t
l33t
User avatar
Posts: 680
Joined: Mon Dec 30, 2002 5:15 pm

  • Quote

Post by honeymak » Wed Mar 25, 2026 12:26 am

hmmmm.........clang lto is not my way........clang is kinda.....not very mature to me......and has to change so many stuff

btw......LTO stuff is kinda latest tech, right?
i guess i will just wait for some time......

i do edit/change kernel Makefiles for my current 'cflags' stuff
but it's small scale and even just several lines of flags

looks like the gcc pgo kernel info page is kinda lengthy

it's kinda hard for me to trace/track all the changes for every kernel i use....
so....just wait for some more centralise easy changes if any....later.....

i will settle here for now.....hmm...

:wink: :roll:
hackers - make sth real
academics - read sth said to be real
Top
sam_
Developer
Developer
User avatar
Posts: 2810
Joined: Fri Aug 14, 2020 12:33 am

  • Quote

Post by sam_ » Wed Mar 25, 2026 8:15 am

it's a work-in-progress.

GCC 16 (not yet released) will have some work towards making top-level asm work via heuristics, avoiding the need to patch many places in the kernel with explicit annotations (which the kernel developers previously rejected).

Some patches are still needed for the kernel: https://gitlab.com/mixal_iirec/linux_gcc_lto_patches

Even with these patches (some will be dropped in the end), module support is not yet there. i don't recommend trying it yet, but there is progress on this front.
Top
Juippisi
Developer
Developer
User avatar
Posts: 783
Joined: Fri Sep 30, 2005 3:51 pm
Location: /home

  • Quote

Post by Juippisi » Wed Mar 25, 2026 9:01 am

honeymak wrote: btw......LTO stuff is kinda latest tech, right?
No we're in https://wiki.gentoo.org/wiki/Kernel/Opt ... ng_AutoFDO and https://wiki.gentoo.org/wiki/Kernel/Opt ... _Propeller era already. LTO is old tech. Unfortunately these are all clang-related tech.
i guess i will just wait for some time......
looks like the gcc pgo kernel info page is kinda lengthy
so....just wait for some more centralise easy changes if any....later.....
I believe you missed the train for "easy gcc lto'ing". I think cachyos used to maintain a patch to enable lto+gcc for kernels, but they've since moved to compile kernels with clang as well. To my knowledge there's no longer an easy way to get gcc+lto work with kernels.
Top
Zucca
Moderator
Moderator
User avatar
Posts: 4681
Joined: Thu Jun 14, 2007 10:31 pm
Location: Rasi, Finland
Contact:
Contact Zucca
Website

  • Quote

Post by Zucca » Wed Mar 25, 2026 12:11 pm

Another point of view:
  • One should also weigh the pros and cons of LTOing kernel.

    I'm certainly not 100% sure, but normally kernel tries to "stay away" as much as possible so that user space programs could run as fast as possible.
    So unless you've been "bottlenecked" by say network load, filesystem load or something else that's kernel's job... you may only benefit a minuscule amount of LTOing the kernel.

    So if you're experiencing lag/under-performance on some area, do performance checks with and without LTO.

    When it comes to kernel... I wouldn't do anything too experimental. Kernel silently misbehaving can cause all kinds of issues. So if you're going for it, I'd highly suggest using clang.
..: Zucca :..

Code: Select all

init=/sbin/openrc-init
-systemd -logind -elogind seatd
I am NaN! I am a man!
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 Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy