mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 19:24:33 +02:00
generic cmake: Always use gc-sections when linking IDF libraries
Required for some IDF binary libraries Reported on forum: https://esp32.com/viewtopic.php?f=13&t=7535&p=34863#p34852 TW27733
This commit is contained in:
committed by
Angus Gratton
parent
3bc970c5f4
commit
89826e8f47
@@ -246,6 +246,9 @@ function(idf_link_components target components)
|
||||
endforeach()
|
||||
|
||||
if(libraries)
|
||||
# gc-sections is necessary for linking some IDF binary libraries
|
||||
# (and without it, IDF apps are much larger than they should be)
|
||||
target_link_libraries(${target} "-Wl,--gc-sections")
|
||||
target_link_libraries(${target} "-Wl,--start-group")
|
||||
target_link_libraries(${target} ${libraries})
|
||||
message(STATUS "Component libraries: ${IDF_COMPONENT_LIBRARIES}")
|
||||
@@ -258,4 +261,4 @@ endfunction()
|
||||
function(idf_import_components var idf_path build_path)
|
||||
add_subdirectory(${idf_path} ${build_path})
|
||||
set(${var} ${BUILD_COMPONENTS} PARENT_SCOPE)
|
||||
endfunction()
|
||||
endfunction()
|
||||
|
@@ -102,8 +102,7 @@ macro(project name)
|
||||
|
||||
set(mapfile "${CMAKE_PROJECT_NAME}.map")
|
||||
|
||||
target_link_libraries(${IDF_PROJECT_EXECUTABLE} "-Wl,--gc-sections \
|
||||
-Wl,--cref -Wl,--Map=${mapfile}")
|
||||
target_link_libraries(${IDF_PROJECT_EXECUTABLE} "-Wl,--cref -Wl,--Map=${mapfile}")
|
||||
|
||||
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY
|
||||
ADDITIONAL_MAKE_CLEAN_FILES
|
||||
|
Reference in New Issue
Block a user