summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/misc/coverage.markdown2
-rw-r--r--tools/firmware/xen-dir/shim.config2
-rw-r--r--xen/Kconfig.debug6
-rw-r--r--xen/Rules.mk9
-rw-r--r--xen/arch/x86/efi/Makefile2
-rw-r--r--xen/common/Makefile2
-rw-r--r--xen/common/coverage/Makefile5
-rw-r--r--xen/common/sysctl.c2
-rw-r--r--xen/include/xen/coverage.h7
9 files changed, 24 insertions, 13 deletions
diff --git a/docs/misc/coverage.markdown b/docs/misc/coverage.markdown
index b47aba2648..430cd27b2f 100644
--- a/docs/misc/coverage.markdown
+++ b/docs/misc/coverage.markdown
@@ -10,7 +10,7 @@ down your hypervisor.
## Enable coverage
-Test coverage support can be turned on compiling Xen with the `CONFIG_GCOV`
+Test coverage support can be turned on compiling Xen with the `CONFIG_COVERAGE`
option set to `y`.
Change your `.config` or run `make -C xen menuconfig`.
diff --git a/tools/firmware/xen-dir/shim.config b/tools/firmware/xen-dir/shim.config
index effbbd90c9..4d5630f87a 100644
--- a/tools/firmware/xen-dir/shim.config
+++ b/tools/firmware/xen-dir/shim.config
@@ -76,7 +76,7 @@ CONFIG_ARCH_SUPPORTS_INT128=y
# CONFIG_DEBUG is not set
# CONFIG_CRASH_DEBUG is not set
# CONFIG_FRAME_POINTER is not set
-# CONFIG_GCOV is not set
+# CONFIG_COVERAGE is not set
# CONFIG_LOCK_PROFILE is not set
# CONFIG_PERF_COUNTERS is not set
# CONFIG_VERBOSE_DEBUG is not set
diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug
index 7bb0465b5d..380c4e8d75 100644
--- a/xen/Kconfig.debug
+++ b/xen/Kconfig.debug
@@ -28,12 +28,12 @@ config FRAME_POINTER
maybe slower, but it gives very useful debugging information
in case of any Xen bugs.
-config GCOV
- bool "Gcov Support"
+config COVERAGE
+ bool "Code coverage support"
depends on !LIVEPATCH
select SUPPRESS_DUPLICATE_SYMBOL_WARNINGS
---help---
- Enable gcov (a test coverage program in GCC) support.
+ Enable code coverage support.
If unsure, say N here.
diff --git a/xen/Rules.mk b/xen/Rules.mk
index 541ed13aa1..da3c35ba36 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -119,8 +119,13 @@ subdir-all := $(subdir-y) $(subdir-n)
$(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS += -DINIT_SECTIONS_ONLY
-ifeq ($(CONFIG_GCOV),y)
-$(filter-out %.init.o $(nogcov-y),$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS += -fprofile-arcs -ftest-coverage
+ifeq ($(CONFIG_COVERAGE),y)
+ifeq ($(clang),y)
+ COV_FLAGS := -fprofile-instr-generate -fcoverage-mapping
+else
+ COV_FLAGS := -fprofile-arcs -ftest-coverage
+endif
+$(filter-out %.init.o $(nocov-y),$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS += $(COV_FLAGS)
endif
ifeq ($(CONFIG_UBSAN),y)
diff --git a/xen/arch/x86/efi/Makefile b/xen/arch/x86/efi/Makefile
index 3edff1cf24..3be9661108 100644
--- a/xen/arch/x86/efi/Makefile
+++ b/xen/arch/x86/efi/Makefile
@@ -13,4 +13,4 @@ boot.init.o: buildid.o
obj-y := stub.o
obj-$(efi) := boot.init.o compat.o relocs-dummy.o runtime.o
extra-$(efi) += buildid.o
-nogcov-$(efi) += stub.o
+nocov-$(efi) += stub.o
diff --git a/xen/common/Makefile b/xen/common/Makefile
index ad181636f6..3a349f478b 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -74,7 +74,7 @@ tmem-y := tmem.o tmem_xen.o tmem_control.o
tmem-$(CONFIG_COMPAT) += compat/tmem_xen.o
obj-$(CONFIG_TMEM) += $(tmem-y)
-subdir-$(CONFIG_GCOV) += coverage
+subdir-$(CONFIG_COVERAGE) += coverage
subdir-$(CONFIG_UBSAN) += ubsan
subdir-y += libelf
diff --git a/xen/common/coverage/Makefile b/xen/common/coverage/Makefile
index 5387bc6429..1039a160c4 100644
--- a/xen/common/coverage/Makefile
+++ b/xen/common/coverage/Makefile
@@ -1,6 +1,9 @@
-obj-y += coverage.o gcov_base.o gcov.o
+obj-y += coverage.o
+ifneq ($(clang),y)
+obj-y += gcov_base.o gcov.o
obj-y += $(call cc-ifversion,lt,0x040700, \
gcc_3_4.o, $(call cc-ifversion,lt,0x040900, \
gcc_4_7.o, $(call cc-ifversion,lt,0x050000, \
gcc_4_9.o, $(call cc-ifversion,lt,0x070000, \
gcc_5.o, gcc_7.o))))
+endif
diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c
index f2ae6295ff..8e83c33a16 100644
--- a/xen/common/sysctl.c
+++ b/xen/common/sysctl.c
@@ -396,12 +396,10 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
}
break;
-#ifdef CONFIG_GCOV
case XEN_SYSCTL_coverage_op:
ret = sysctl_cov_op(&op->u.coverage_op);
copyback = 1;
break;
-#endif
#ifdef CONFIG_HAS_PCI
case XEN_SYSCTL_pcitopoinfo:
diff --git a/xen/include/xen/coverage.h b/xen/include/xen/coverage.h
index daddef37d3..ba5fb67947 100644
--- a/xen/include/xen/coverage.h
+++ b/xen/include/xen/coverage.h
@@ -1,9 +1,14 @@
#ifndef _XEN_COV_H
#define _XEN_COV_H
-#ifdef CONFIG_GCOV
+#ifdef CONFIG_COVERAGE
#include <public/sysctl.h>
int sysctl_cov_op(struct xen_sysctl_coverage_op *op);
+#else
+static inline int sysctl_cov_op(void *unused)
+{
+ return -EOPNOTSUPP;
+}
#endif
#endif /* _XEN_GCOV_H */