From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Stefano Stabellini <sstabellini@kernel.org>,
Wei Liu <wei.liu2@citrix.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
George Dunlap <George.Dunlap@eu.citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
Jan Beulich <jbeulich@suse.com>,
Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH v2 for-next 6/9] kconfig/gcov: rename to coverage
Date: Thu, 9 Nov 2017 11:13:46 +0000 [thread overview]
Message-ID: <20171109111349.95800-7-roger.pau@citrix.com> (raw)
In-Reply-To: <20171109111349.95800-1-roger.pau@citrix.com>
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>
---
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Tim Deegan <tim@xen.org>
Cc: Wei Liu <wei.liu2@citrix.com>
---
Changes since v1:
- Use a choice in kconfig to select code coverage technology.
- Compile coverage.c regardless of selected code coverage technology.
- Introduce an unimplemented sysctl_cov_op function if
CONFIG_COVERAGE is not set.
---
docs/misc/coverage.markdown | 2 +-
xen/Kconfig.debug | 7 +++----
xen/Rules.mk | 6 +++++-
xen/common/Makefile | 2 +-
xen/common/coverage/Makefile | 5 ++++-
xen/common/sysctl.c | 2 --
xen/include/xen/coverage.h | 7 ++++++-
7 files changed, 20 insertions(+), 11 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/xen/Kconfig.debug b/xen/Kconfig.debug
index 7bb0465b5d..153d68fed3 100644
--- a/xen/Kconfig.debug
+++ b/xen/Kconfig.debug
@@ -28,12 +28,11 @@ 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 2659f8a4d1..d1b72e24ab 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -115,9 +115,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)
+ifeq ($(CONFIG_COVERAGE),y)
+ifeq ($(clang),y)
+$(filter-out %.init.o $(nogcov-y),$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS += -fprofile-instr-generate -fcoverage-mapping
+else
$(filter-out %.init.o $(nogcov-y),$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS += -fprofile-arcs -ftest-coverage
endif
+endif
ifeq ($(CONFIG_UBSAN),y)
$(filter-out %.init.o $(noubsan-y),$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS += -fsanitize=undefined
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..098f116760 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 -ENOSYS;
+}
#endif
#endif /* _XEN_GCOV_H */
--
2.13.6 (Apple Git-96)
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-11-09 11:14 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-09 11:13 [PATCH v2 for-next 0/9] LLVM coverage support for Xen Roger Pau Monne
2017-11-09 11:13 ` [PATCH v2 for-next 1/9] kconfig/gcov: remove gcc version choice from kconfig Roger Pau Monne
2017-11-27 14:51 ` Jan Beulich
2017-12-01 12:14 ` Wei Liu
2017-11-09 11:13 ` [PATCH v2 for-next 2/9] gcov: rename folder and header to coverage Roger Pau Monne
2017-11-16 22:24 ` Konrad Rzeszutek Wilk
2017-11-09 11:13 ` [PATCH v2 for-next 3/9] gcov: rename sysctl and functions Roger Pau Monne
2017-11-16 22:24 ` Konrad Rzeszutek Wilk
2018-01-23 9:37 ` Jan Beulich
2018-01-23 11:07 ` Ian Jackson
2017-11-09 11:13 ` [PATCH v2 for-next 4/9] gcov: introduce hooks for the sysctl Roger Pau Monne
2017-11-16 22:19 ` Konrad Rzeszutek Wilk
2017-11-27 14:53 ` Jan Beulich
2017-11-09 11:13 ` [PATCH v2 for-next 5/9] coverage: introduce generic file Roger Pau Monne
2017-11-16 22:23 ` Konrad Rzeszutek Wilk
2017-11-09 11:13 ` Roger Pau Monne [this message]
2017-11-16 22:22 ` [PATCH v2 for-next 6/9] kconfig/gcov: rename to coverage Konrad Rzeszutek Wilk
2017-11-27 11:27 ` Roger Pau Monné
2017-11-27 11:42 ` Jan Beulich
2017-11-27 15:00 ` Jan Beulich
2017-11-09 11:13 ` [PATCH v2 for-next 7/9] coverage: introduce support for llvm profiling Roger Pau Monne
2017-11-27 15:01 ` Jan Beulich
2017-11-09 11:13 ` [PATCH v2 for-next 8/9] xsm: add bodge when compiling with llvm coverage support Roger Pau Monne
2017-11-09 11:13 ` [PATCH v2 for-next 9/9] coverage: add documentation for LLVM coverage Roger Pau Monne
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171109111349.95800-7-roger.pau@citrix.com \
--to=roger.pau@citrix.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=konrad.wilk@oracle.com \
--cc=sstabellini@kernel.org \
--cc=tim@xen.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).