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