Link-time optimization

From Wikipedia, the free encyclopedia

Link-time optimization is a type of program optimization performed by a compiler to a program at link time. Link time optimization occurs in programming languages that compile programs on a file-by-file basis (such as C and Fortran), rather than all at once (such as Java).

Once all files have been compiled separately into object files, a compiler links (merges) the object files into a single file, the executable. As it is in the process of doing this (or immediately thereafter) a compiler with link-time optimization capabilities can apply various forms of interprocedural optimization to the newly merged file. The process of merging the files may have removed the knowledge limitations that occurred in the earlier stages of compilation, allowing for deeper analysis, more optimization, and ultimately better program performance.