|
楼主 |
发表于 2009-11-8 21:26:51
|
显示全部楼层
http://gcc.gnu.org/wiki/LinkTimeOptimizationRequirements
The fundamental mechanism used by the compiler to delay optimization until link time is to write the GIMPLE representation of the program on special sections in the output file. We have chosen ELF as the container format for these sections, so in order to use LTO the target must support ELF. We are using libelf v0.8.12, but any relatively recent libelf implementation should work. Note that ELF is only required as the container format for GIMPLE, this does not mean that ELF must be used as the final executable format.
Despite the "link time" name, LTO does not need to use any special linker features. The basic mechanism needed is the detection of GIMPLE sections inside object files. This is currently implemented in collect2. Therefore, LTO will work on any linker already supported by GCC.
As an added feature, LTO will take advantage of the plugin feature in gold. This allows the compiler to pick up object files that may have been stored in library archives. To use this feature, you must be using gold as the linker and enable the use of the plugin by compiling with gcc -use-linker-plugin. This will shift the responsibility of driving the final stages of compilation from collect2 to gold via the linker plugin.
=> http://sourceware.org/ml/binutils/2008-03/msg00162.htmlTo build it, configure with --enable-gold. You will then get gold
instead of the usual GNU ld.
gold is written in C++. It is likely that it only works with gcc
version 4.0 or later. I would be happy to apply simple compatibility
patches for earlier versions.
gold only supports ELF targets such as GNU/Linux and other free
operating systems. gold does not support Windows. There is no
expectation that gold will ever support anything other than ELF
targets.
At the moment gold only supports x86 and x86_64 targets. It is
designed for portability, and we expect to add support for more
targets in the future.
At the moment gold has only one significant advantage over the
existing linker: it is faster. On large C++ programs, I have measured
it as running five times faster.
一向不喜欢基于 c++ 的软件包,也许该改变了。 |
|