From 4d8eedb09ae78c2cb1004ff4fb62a48e77175bda Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Sun, 16 Jul 2023 10:11:46 +0800 Subject: [PATCH] arch/sim: Link to libgcov.a when CONFIG_ARCH_COVERAGE is enabled Signed-off-by: Xiang Xiao --- arch/sim/src/Makefile | 4 ++++ arch/sim/src/sim/CMakeLists.txt | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/arch/sim/src/Makefile b/arch/sim/src/Makefile index 0ad0520173..a58013f8b3 100644 --- a/arch/sim/src/Makefile +++ b/arch/sim/src/Makefile @@ -110,6 +110,10 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y) STDLIBS += -lm endif +ifeq ($(CONFIG_ARCH_COVERAGE),y) + STDLIBS += -lgcov +endif + ifeq ($(CONFIG_STACK_COLORATION),y) CSRCS += sim_checkstack.c endif diff --git a/arch/sim/src/sim/CMakeLists.txt b/arch/sim/src/sim/CMakeLists.txt index 0babbd8e9d..84d6fd6760 100644 --- a/arch/sim/src/sim/CMakeLists.txt +++ b/arch/sim/src/sim/CMakeLists.txt @@ -27,6 +27,10 @@ set(HOSTSRCS) set(HOST_INCLUDE_DIRS) set(STDLIBS pthread) +if(CONFIG_ARCH_COVERAGE) + list(APPEND STDLIBS gcov) +endif() + list(APPEND HOST_DEFINITIONS -D__SIM__) # common guest sources