I am using buildroot to prepare images for embedded system. I want to export buildroots internal cross compiler so others can use same version, After command checking GCC version: arm-linux-gcc -v
I see configured COLLECT_LTO_WRAPPER
to static location on my HDD
COLLECT_LTO_WRAPPER=/home/user/arm/buildroot/output/host/usr/libexec/gcc/arm-unknown-linux-uclibcgnueabi/4.7.1/lto-wrapper
It will not be correct on another system.
I was only able to find that LTO means Link Time Optimization. Can you please explain what is lto wrapper used for and when is needed?
Link Time Optimization, or LTO, is a GCC-compatible feature that allows the compiler to retain its internal representation of a program or module and use it later with different compilation units to perform optimizations during linking. Also see Link Time Optimization on the GCC wiki.
What is Link Time Optimization (LTO) Link Time Optimization is a form of interprocedural optimization that is performed at the time of linking application code. Without LTO, Arm® Compiler for Linux compiles and optimizes each source file independently of one another, then links them to form the executable.
Link Time Optimization (LTO) refers to program optimization during linking. The linker pulls all object files together and combines them into one program. The linker can see the whole of the program, and can therefore do whole-program analysis and optimization.
LTO provides a performance boost for all the compilers.
When you compile an executable, gcc will optimize and merge same constants only for the current file. Normally, it can't analyze the whole program since the .o
files are linked with ld
.
That's the purpose of Interprocedural optimization: Compile the whole executable as if it was a single source file, allowing to make the code more static.
There's a problem with this, LD can't really recognize the exported GIMPLES.
For this purpose ld use the lto plugin(liblto_plugin.so.0.0.0) which calls make or thelto-wrapper
directly which calls lto1 where each lto1 launch is responsible for producing a 'partition' (see the -flto-partition option and the lto-partitions parameter in gcc’s documentation).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With