How to use GCC LTO with differently optimized object files?

Viewed 1369

I'm compiling an executable with arm-none-eabi-gcc for a Cortex-M4 based microcontroller. Non-performance-critical code is compiled with -Os (optimized for executable code size) and performance critical parts with another optimalization flags, eg. -Og / -O2 etc.

Is it safe to use -flto in such a build? If so, which optimalization flag should be passed to the linker?

1 Answers
Related