Difference between revisions of "Link Time Optimization"
(Quick writeup on LTO status for the MIPS kernel.)
Revision as of 09:08, 12 April 2014
Link Time Optimization (LTO) is a compiler technology which has been implemented for well over a decade in various proprietary compilers such as SGI's RISCompiler for IRIX and now also in GCC since 4.5.0. It moves code generation and optimization into link phase which allows many advanced optimizations such as elemination of unused functions and variables or inlining across compilation units.
LTO for the kernel
LTO also does additional tests on correctness of the source code - it has to in order to perform optimizations correctly. This includes testing that all declarations of a function or variable in compilation units and the actual definition in another are matching. Other old tricks as as the definition of assembler macros in inline assembler files cease to work with LTO. As the result vast cleanups and fixes are necessary.
Andi Kleen is working on a LTO patchset for the kernel for several years. This work covers the x86 and generic part of the kernel and much of it has been merged for Linux 3.15.
LTO for the MIPS kernel
Ralf Bächle is working on LTO for MIPS as a background project for about two years. Linux 3.7 is working except for kernel modules. LTO for later kernels (3.8..3.15) is currently work in progress but has been published on git.linux-mips.org.
- https://lwn.net/Articles/512548/ Linux Weekly News article on LTO for the kernel
- https://github.com/andikleen/linux-misc.git Andy Kleen's LTO kernel repository
- https://git.linux-mips.org/?p=ralf/linux-lto.git;a=summary MIPS LTO repository based on Andi's work