diff --git a/arch/sim/src/cmake/Toolchain.cmake b/arch/sim/src/cmake/Toolchain.cmake index c1caedd3c6..7fb1989fcf 100644 --- a/arch/sim/src/cmake/Toolchain.cmake +++ b/arch/sim/src/cmake/Toolchain.cmake @@ -97,7 +97,11 @@ else() endif() if(CONFIG_DEBUG_OPT_UNUSED_SECTIONS) - add_link_options(-Wl,--gc-sections) + if(APPLE) + add_link_options(-Wl,-dead_strip) + else() + add_link_options(-Wl,--gc-sections) + endif() add_compile_options(-ffunction-sections -fdata-sections) endif()