buildsystem: Enable LTO also for the application

It turns out that currently LTO is enabled only for the kernel.
This commit updates it to enable it for the whole application
and adds additional LTO exclusions required for the standard
C libraries to build and link properly.

Signed-off-by: Radosław Koppel <radoslaw.koppel@nordicsemi.no>
This commit is contained in:
Radoslaw Koppel 2024-02-27 13:17:37 +01:00 committed by Carles Cufí
commit 118f1592ff
3 changed files with 7 additions and 1 deletions

View file

@ -214,7 +214,7 @@ endif()
zephyr_compile_options(${OPTIMIZATION_FLAG})
if(CONFIG_LTO)
add_compile_options($<TARGET_PROPERTY:compiler,optimization_lto>)
zephyr_compile_options($<TARGET_PROPERTY:compiler,optimization_lto>)
add_link_options($<TARGET_PROPERTY:linker,lto_arguments>)
endif()