From 9fcb551b8eed4b5e98b9241683531808c169b995 Mon Sep 17 00:00:00 2001 From: Alexey Gerenkov Date: Thu, 29 Jun 2023 21:15:46 +0300 Subject: [PATCH] gcov: Fix not linked gcov rtio functions --- components/app_trace/CMakeLists.txt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/components/app_trace/CMakeLists.txt b/components/app_trace/CMakeLists.txt index e6f4df2c46..3f671beb14 100644 --- a/components/app_trace/CMakeLists.txt +++ b/components/app_trace/CMakeLists.txt @@ -50,10 +50,12 @@ idf_component_register(SRCS "${srcs}" PRIV_REQUIRES soc esp_ipc LDFRAGMENTS linker.lf) -# disable --coverage for this component, as it is used as transport -# for gcov -target_compile_options(${COMPONENT_LIB} PRIVATE "-fno-profile-arcs" "-fno-test-coverage") - -# Force app_trace to also appear later than gcov in link line -idf_component_get_property(app_trace app_trace COMPONENT_LIB) -target_link_libraries(${COMPONENT_LIB} INTERFACE $ gcov $ c) +if(CONFIG_APPTRACE_GCOV_ENABLE) + # disable --coverage for this component, as it is used as transport + # for gcov + target_compile_options(${COMPONENT_LIB} PRIVATE "-fno-profile-arcs" "-fno-test-coverage") + # Force app_trace to appear later than gcov in link line + idf_component_get_property(app_trace app_trace COMPONENT_LIB) + target_link_libraries(${COMPONENT_LIB} INTERFACE + "-Wl,--undefined=gcov_rtio_atexit" $ gcov $ c) +endif()