mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/generic_cmake_gc_sections' into 'master'
generic cmake: Always use gc-sections when linking IDF libraries See merge request idf/esp-idf!3873
This commit is contained in:
commit
2b557523ba
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user