]> xenbits.xensource.com Git - people/dariof/xen.git/commitdiff
kconfig/gcov: rename to coverage
authorRoger Pau Monné <roger.pau@citrix.com>
Wed, 7 Feb 2018 15:32:18 +0000 (16:32 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 7 Feb 2018 15:33:47 +0000 (16:33 +0100)
So it can be used by both gcc and clang. Just add the Kconfig option
and modify the makefiles so the llvm coverage specific code can be
added in a follow up patch.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
[jb: also change the shim config]

docs/misc/coverage.markdown
tools/firmware/xen-dir/shim.config
xen/Kconfig.debug
xen/Rules.mk
xen/arch/x86/efi/Makefile
xen/common/Makefile
xen/common/coverage/Makefile
xen/common/sysctl.c
xen/include/xen/coverage.h

index b47aba2648196331522a3cb3c2f50558be790bfb..430cd27b2fda8a1823cb23a9065795920d05976b 100644 (file)
@@ -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`.
index effbbd90c931270ef0a342b1894282d491d0ea27..4d5630f87a2e1ab0a6430c95973465d468a2ad00 100644 (file)
@@ -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
index 7bb0465b5d24d4fb84bf046a7de0cadaec558e85..380c4e8d75e1ee1b8389d397633283c03332dc32 100644 (file)
@@ -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.
 
index 541ed13aa17c3f5c92650c54d1d157b5f9077720..da3c35ba363141fb66fe9d035c633e909445c8be 100644 (file)
@@ -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)
index 3edff1cf24cd96ce39e4a18568ec683ac6224450..3be96611089f35b06078461efccf0f4da225269e 100644 (file)
@@ -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
index ad181636f6814e84a48a902b81eb9eb071c57f5f..3a349f478b09c23b50f1cda06d3019ba7a5ae635 100644 (file)
@@ -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
index 5387bc6429c86bfbe44b7a2fdd60dc006e4b0c72..1039a160c4f7b7074083d0f83298846d4f4a23df 100644 (file)
@@ -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
index f2ae6295ff4e2d259e8648c09a61a4b953b90b73..8e83c33a167c798561a125172e850e812637359a 100644 (file)
@@ -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:
index daddef37d326db7b39cdfa2c389527b0fb34e840..ba5fb679471193c9b544aad797393d02ef4f494e 100644 (file)
@@ -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 */