[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] kconfig/gcov: rename to coverage



commit 6222e7cbaa1ed75dd8f9d90cfa394a49fed0be2c
Author:     Roger Pau Monné <roger.pau@xxxxxxxxxx>
AuthorDate: Wed Feb 7 16:32:18 2018 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Feb 7 16:33:47 2018 +0100

    kconfig/gcov: rename to coverage
    
    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@xxxxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    [jb: also change the shim config]
---
 docs/misc/coverage.markdown        | 2 +-
 tools/firmware/xen-dir/shim.config | 2 +-
 xen/Kconfig.debug                  | 6 +++---
 xen/Rules.mk                       | 9 +++++++--
 xen/arch/x86/efi/Makefile          | 2 +-
 xen/common/Makefile                | 2 +-
 xen/common/coverage/Makefile       | 5 ++++-
 xen/common/sysctl.c                | 2 --
 xen/include/xen/coverage.h         | 7 ++++++-
 9 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/docs/misc/coverage.markdown b/docs/misc/coverage.markdown
index b47aba2..430cd27 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 effbbd9..4d5630f 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 7bb0465..380c4e8 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 541ed13..da3c35b 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 3edff1c..3be9661 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 ad18163..3a349f4 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 5387bc6..1039a16 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 f2ae629..8e83c33 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 daddef3..ba5fb67 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 */
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.