Difference between revisions of "Link Time Optimization"

From LinuxMIPS
Jump to: navigation, search
(Quick writeup on LTO status for the MIPS kernel.)
(No difference)

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.