This repository provides a reproduction for LTO issue in GNU MCU Eclipse GCC toolchain.
- Clone this repository to
<Work>/src
folder - Create directory for build:
mkdir <Work>/build
- Generate CMake build:
cd <Work>/build && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DENABLE_LTO=ON -DTOOLCHAIN=<toolchain_directory>/bin <Work>/src
- Run build:
make app.dump_bin
- Check size for resulting binary:
ls -l <Work>/bin/app/app.bin
app.bin
should be around 1600 bytes
app.bin
is around 3000 bytes and is binary identical to version without LTO.