4 ms·
-flto is great at the other end of the spectrum- tiny systems. With "-Os -lto", much unused code from newlib is deleted, allowing the rest to fit in a tiny Cor
by jhallenworld 6y ago
-flto is great at the other end of the spectrum- tiny systems. With "-Os -lto", much unused code from newlib is deleted, allowing the rest to fit in a tiny Cortex-M0 system. In the old days, each function of the C library was in its own object file in the library, but these days this appears to not be the case. But -lto gives the same effect.
- bigdict 6y agoI use it too for embedded. Functions get inlined, fewer registers get saved unnecessarily in functions. I also use “-fdata-sections -ffunction-sections” with “-Wl,--gc-sections” to prune unused sections. There is some evidence this can actually increase your code size sometimes: https://stackoverflow.com/a/29951897 https://stackoverflow.com/a/29951897.