diff --git a/arch/sim/src/cmake/Toolchain.cmake b/arch/sim/src/cmake/Toolchain.cmake index 90aa92a33b..c787a9fe30 100644 --- a/arch/sim/src/cmake/Toolchain.cmake +++ b/arch/sim/src/cmake/Toolchain.cmake @@ -94,6 +94,11 @@ else() endif() endif() +if(CONFIG_DEBUG_OPT_UNUSED_SECTIONS) + add_link_options(-Wl,--gc-sections) + add_compile_options(-ffunction-sections -fdata-sections) +endif() + if(CONFIG_CXX_STANDARD) add_compile_options($<$:-std=${CONFIG_CXX_STANDARD}>) endif()