]> granicus.if.org Git - esp-idf/commitdiff
esp_common: append gc sections link flag
authorRenz Christian Bagaporo <renz@espressif.com>
Sun, 7 Apr 2019 12:33:56 +0000 (20:33 +0800)
committerRenz Christian Bagaporo <renz@espressif.com>
Tue, 14 May 2019 10:01:14 +0000 (18:01 +0800)
components/esp_common/CMakeLists.txt
tools/cmake/project.cmake

index 3ba1b8224dd3c170b07efd23c4bd82e23a6e72ec..18ffe9367865e72e7bd01ccd5b9a87d510ef0966 100644 (file)
@@ -4,6 +4,7 @@ if(BOOTLOADER_BUILD)
     set(COMPONENT_REQUIRES ${IDF_COMPONENTS})
     set(COMPONENT_SRCS )
     register_component()
+    set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-Wl,--gc-sections")
 else()
     # Regular app build
     set(COMPONENT_SRCS
@@ -26,4 +27,6 @@ else()
         "src/stack_check.c"
         PROPERTIES COMPILE_FLAGS
         -fno-stack-protector)
+    set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY LINK_LIBRARIES "-Wl,--gc-sections")
+    set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-Wl,--gc-sections")
 endif()
index 437e715a480d9c4c7a6acb8a87761064ade79dd3..4522d0a2cff316054da209beeb7e3766c9e10535 100644 (file)
@@ -352,7 +352,6 @@ macro(project project_name)
     add_executable(${project_elf} "${project_elf_src}")
     add_dependencies(${project_elf} _project_elf_src)
 
-    target_link_libraries(${project_elf} "-Wl,--gc-sections")
     target_link_libraries(${project_elf} "-Wl,--start-group")
 
     if(test_components)