3.6.6.12 Lto Option
This -flto option runs the standard link-time optimizer. This
feature can only be enabled when using a licensed compiler.
When invoked with source code, the compiler adds an internal bytecode representation of the code to special sections in the object file. When the object files are linked together, all the function bodies are read from these sections and instantiated as if they had been part of the same translation unit.
-flto both at compile time and during the final link. For example:xc8-cc -c -O3 -flto -mcpu=atmega3290p
-mdfp="Microchip/ATmega_DFP/3.3.279/xc8" foo.c
xc8-cc -c -O3 -flto -mcpu=atmega3290p
-mdfp="Microchip/ATmega_DFP/3.3.279/xc8" bar.c
xc8-cc -o myprog.elf -flto -O3 -mcpu=atmega3290p
-mdfp="Microchip/ATmega_DFP/3.3.279/xc8" foo.o bar.oxc8-cc -o myprog.elf -flto -O3 -mcpu=atmega3290p
-mdfp="Microchip/ATmega_DFP/3.3.279/xc8" foo.c bar.cLink time optimizations do not require the presence of the whole program to operate. If the program does not require any symbols to be exported, it is possible to combine -flto with -fwhole-program to allow the interprocedural optimizers to use more aggressive assumptions which may lead to improved optimization opportunities.
The -fno-lto form of this option does not run the standard link-time optimizer. This is the default action if this option is not specified.
