commit 0eeecf6e31c0459291631f2cf3db2f7f04a60d00
parent b34b9955320a4daa458df2baea22db6341cd7346
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 27 Oct 2022 19:59:04 +0200
build: Add support for gcov toolchain
The gcov toolchain is designed to be used to generate coverage
information while executing the tests. At this moment it is not
functional because the c library is built with the same toolchain
than the compiler and it implies that the libc has a dependency
with libgcov.a.
Diffstat:
4 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore
@@ -4,3 +4,5 @@ bin/
lib/
libexec/
dirs
+*.gcno
+*.gcda
diff --git a/scripts/build/tool/gcov.mk b/scripts/build/tool/gcov.mk
@@ -0,0 +1,3 @@
+PROFILE_CFLAGS = -fprofile-arcs -ftest-coverage -fprofile-abs-path
+PROFILE_LDLIBS = -lgcov
+include $(BUILDDIR)/tool/gnu.mk
diff --git a/scripts/build/tool/gnu.mk b/scripts/build/tool/gnu.mk
@@ -7,5 +7,6 @@ PRECOMP = cpp
ARCHIVE_FLAGS = -U
NOPIE_CFLAGS = -fno-pie
-TOOL_CFLAGS = -std=c99 -fno-stack-protector -static
+TOOL_CFLAGS = -std=c99 -fno-stack-protector -static $(PROFILE_CFLAGS)
+TOOL_LDLIBS = $(PROFILE_LDLIBS)
TOOL_LIBC_CFLAGS = -ffreestanding
diff --git a/scripts/rules.mk b/scripts/rules.mk
@@ -201,6 +201,7 @@ clean-dirs:
clean-files:
rm -f *.i *.d *.o *.a *.elf $(TARGET)
+ rm -f *.gcno *.gcda
dep: inc-dep
$(FORALL)