elf(bugfix):fix elf compile link error when enable LTO

fix compilation errors when enabling the LTO linker

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
This commit is contained in:
xuxin19
2025-10-23 17:08:45 +08:00
committed by GUIDINGLI
parent b34a221121
commit df6505567c
+7 -1
View File
@@ -38,6 +38,12 @@ nuttx_mod_link_options(-r)
nuttx_elf_link_options_ifdef(CONFIG_BUILD_KERNEL -Bstatic)
nuttx_elf_link_options_ifdef(CONFIG_DEBUG_OPT_UNUSED_SECTIONS --gc-sections)
if(CONFIG_DEBUG_OPT_UNUSED_SECTIONS)
if("${CMAKE_LD}" MATCHES "gcc$")
nuttx_elf_link_options(-Wl,--gc-sections)
else()
nuttx_elf_link_options(--gc-sections)
endif()
endif()
nuttx_elf_link_options(-e __start)