|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 for-next 6/9] kconfig/gcov: rename to coverage
On Thu, Nov 09, 2017 at 11:13:46AM +0000, Roger Pau Monne wrote:
> 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>
> ---
> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Cc: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> Cc: Jan Beulich <jbeulich@xxxxxxxx>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
> Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
> Cc: Tim Deegan <tim@xxxxxxx>
> Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
> ---
> 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
Any particular reason this was removed?
Or is the idea that the coverage technology should have this select?
> ---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;
Not -EOPNOTSUPP ?
> +}
> #endif
>
> #endif /* _XEN_GCOV_H */
> --
> 2.13.6 (Apple Git-96)
>
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |