Compile as one huge object
Compile as one huge object
Posted Dec 16, 2017 12:59 UTC (Sat) by epa (subscriber, #39769)Parent article: Shrinking the kernel with link-time garbage collection
Posted Dec 16, 2017 16:16 UTC (Sat)
by mpr22 (subscriber, #60784)
[Link]
Posted Dec 16, 2017 17:40 UTC (Sat)
by pbonzini (subscriber, #60935)
[Link]
Posted Dec 16, 2017 17:44 UTC (Sat)
by gutschke (subscriber, #27910)
[Link]
You also lose out on a lot of the error messages that you would normally *want* to get, when there are layering violations and code reaches into private implementation details of other parts of the system. So, in practice, you'd have to maintain the code so that it can be compiled in the traditional fashion (that would happen during normal development cycles) and so that it can be compiled as one big file. That's very painful for the developers.
As far as I can tell, there are some compilers that internally do something similar to what you are suggesting. And with proper compiler support, it can of course be made to work. But honestly, from the developer's point of view, it ends up looking very similar to what is described in this article. And it would still need the same source-code annotations to help the compiler figure out which references are life and which ones aren't.
Posted Dec 18, 2017 16:06 UTC (Mon)
by mwsealey (subscriber, #71282)
[Link]
It's probably best to leave the MFC part on a per module/subsystem basis (so, anything that gets a built-in.o) and then LTO both the main kernel binary and any modules. The difficulty is going to be making sure that public functions do not
It's a pain in the backside, all told, but the results are always worth it.
Well, it would at least let you know whether your compiler's execution time is polynomial in the size of the translation unit.
Compile as one huge object
Compile as one huge object
Compile as one huge object
Compile as one huge object
get LTO'd away, while C99 inlining somewhat forces preservation of the 'original' function even if it inlines everything, LTO could strip it out if there's no out-of-line reference to it, and then your modules wouldn't load.