Latest updates to AVR toolchain include LTO support in GCC, and compiler works indeed fine producing smaller object code. Unfortunately other tools such as nm (found in $HOME/.platformio/packages/toolchain-atmelavr/bin/avr-nm) does not support reading LTO object files, for example when trying to display symbols:
Print.o:
/home/jazg/.platformio/packages/toolchain-atmelavr/bin/avr-nm: Print.o: plugin needed to handle lto object
00000001 C __gnu_lto_slim
00000001 C __gnu_lto_v1
0000003e a __SP_H__
0000003d a __SP_L__
0000003f a __SREG__
00000000 a __tmp_reg__
00000001 a __zero_reg__
---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/42199437-atmel-avr-toolchain-supports-lto-only-partially?utm_campaign=plugin&utm_content=tracker%2F38207915&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F38207915&utm_medium=issues&utm_source=github).
Latest updates to AVR toolchain include LTO support in GCC, and compiler works indeed fine producing smaller object code. Unfortunately other tools such as
nm
(found in$HOME/.platformio/packages/toolchain-atmelavr/bin/avr-nm
) does not support reading LTO object files, for example when trying to display symbols: