fix(cmakev2): add --cref with MAPFILE_TARGET and remove global -Wl,--cref

When MAPFILE_TARGET is used in idf_build_executable, add the linker
--cref option so the cross-reference table is written to the map file
instead of stdout. Remove the global -Wl,--cref from default link
options in project.cmake so cref is only applied where a map file
is requested.
This commit is contained in:
Sudeep Mohanty
2026-02-24 11:21:19 +01:00
parent ce6f14bdd6
commit 6a878eb0bf
2 changed files with 2 additions and 2 deletions
+2
View File
@@ -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}