diff --git a/tools/cmakev2/build.cmake b/tools/cmakev2/build.cmake index 75516401064..8084e9095b8 100644 --- a/tools/cmakev2/build.cmake +++ b/tools/cmakev2/build.cmake @@ -597,6 +597,8 @@ function(idf_build_executable executable) if(ARG_MAPFILE_TARGET AND "${linker_type}" STREQUAL "GNU") set(mapfile "${CMAKE_BINARY_DIR}/${ARG_NAME}.map") target_link_options(${executable} PRIVATE "LINKER:--Map=${mapfile}") + # Add cross-reference table to the map file + target_link_options(${executable} PRIVATE "LINKER:--cref") add_custom_command( OUTPUT "${mapfile}" DEPENDS ${executable} diff --git a/tools/cmakev2/project.cmake b/tools/cmakev2/project.cmake index fed486e1575..93212660f1c 100644 --- a/tools/cmakev2/project.cmake +++ b/tools/cmakev2/project.cmake @@ -419,8 +419,6 @@ function(__init_project_configuration) if("${linker_type}" STREQUAL "GNU") set(target_upper "${idf_target}") string(TOUPPER ${target_upper} target_upper) - # Add cross-reference table to the map file - list(APPEND link_options "-Wl,--cref") # Add this symbol as a hint for esp_idf_size to guess the target name list(APPEND link_options "-Wl,--defsym=IDF_TARGET_${target_upper}=0") # Check if linker supports --no-warn-rwx-segments