SLAU646F September 2015 – June 2020
MSP430 GCC supports link-time optimization, which significantly reduces code size and improves performance in projects that consist of multiple source files and libraries. It can be enabled by passing the -flto flag to msp430-elf-gcc.
LTO is a feature of the GCC compiler, and does not affect the behavior of the linker. It is recommended that you compile all source files using the same options, and pass that same set of options when linking using msp430-elf-gcc. For the most straightforward operation, just compile and link all your source files using a single invocation of msp430-elf-gcc.
If the --save-temps option is passed, the optimized assembly code from your entire project will be stored in <output_filename>.ltrans0.s. The output assembly files from individual source files contain the LTO bytecode.
For more detailed information and tips on using LTO, see the GCC documentation on the -flto option.