Skip to content

Commit

Permalink
sim/cmake: enable garbage collection of unused input sections
Browse files Browse the repository at this point in the history
enable --gc-sections for linker
enable -ffunction-sections -fdata-sections for compiler

Signed-off-by: chao an <[email protected]>
  • Loading branch information
anchao authored and xiaoxiang781216 committed Jul 6, 2024
1 parent d298759 commit cef9add
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions arch/sim/src/cmake/Toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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($<$<COMPILE_LANGUAGE:CXX>:-std=${CONFIG_CXX_STANDARD}>)
endif()
Expand Down

0 comments on commit cef9add

Please sign in to comment.