Problems with LTO for HotSpot
Julian Waters
tanksherman27 at gmail.com
Wed Sep 24 18:52:00 UTC 2025
>From what I know, the flatten attribute pretty much tells gcc "Forget
heuristics, inline everything into this method" and is basically you
telling the compiler that you know better than it in this case. It
(And always_inline) wouldn't be very useful if they didn't do what you
requested of the compiler based on its mood. But the bigger problem
according to some chats with the gcc developers is that the flatten
attribute simply just wasn't made with LTO in mind and so doesn't
check if a method is defined in another source file before inlining
it. Short of something like adding a parameter to the flatten
attribute to disable cross compilation unit inlining within gcc itself
(Or something along those lines), there's nothing much one can do
aside from use noinline as appropriate to stop the inlining madness
from happening, unfortunately.
best regards,
Julian
More information about the build-dev
mailing list