Using LTO with Cortex-M

I’m trying to use link-time optimization (LTO) with a Cortex-M based MCU. Unfortunately, simply adding -flto to build flags doesn’t suffice. For instance, PlatformIO won’t use the correct LTO-aware variants of tools like ar, ranlib and so on.

What is the correct way to use LTO?

1 Like