This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new cef9addbbb sim/cmake: enable garbage collection of unused input 
sections
cef9addbbb is described below

commit cef9addbbb51b1888cdbfe45221e2dbf785e9ef0
Author: chao an <[email protected]>
AuthorDate: Fri Jul 5 21:42:46 2024 +0800

    sim/cmake: enable garbage collection of unused input sections
    
    enable --gc-sections for linker
    enable -ffunction-sections -fdata-sections for compiler
    
    Signed-off-by: chao an <[email protected]>
---
 arch/sim/src/cmake/Toolchain.cmake | 5 +++++
 1 file changed, 5 insertions(+)

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($<$<COMPILE_LANGUAGE:CXX>:-std=${CONFIG_CXX_STANDARD}>)
 endif()

Reply via email to