xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [Xen-devel] [PATCH] xen/coverage: wrap coverage related things under 'CONFIG_COVERAGE'
@ 2019-06-11  6:02 Baodong Chen
  2019-06-11 14:03 ` Jan Beulich
  0 siblings, 1 reply; 7+ messages in thread
From: Baodong Chen @ 2019-06-11  6:02 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, Jan Beulich, Baodong Chen, Roger Pau Monné

Constructors between '__ctors_start' and '__ctors_end' only used
for code-coverage, not by xen itself, so use 'CONFIG_COVERAGE' wrap them.

Signed-off-by: Baodong Chen <chenbaodong@mxnavi.com>
---
 xen/arch/arm/xen.lds.S | 2 ++
 xen/arch/x86/xen.lds.S | 2 ++
 xen/common/lib.c       | 5 +++++
 3 files changed, 9 insertions(+)

diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
index 1e72906..320ff68 100644
--- a/xen/arch/arm/xen.lds.S
+++ b/xen/arch/arm/xen.lds.S
@@ -172,12 +172,14 @@ SECTIONS
        *(.init.data.rel)
        *(.init.data.rel.*)
 
+#if defined(CONFIG_COVERAGE)
        . = ALIGN(8);
        __ctors_start = .;
        *(.ctors)
        *(.init_array)
        *(SORT(.init_array.*))
        __ctors_end = .;
+#endif
 
 #if defined(CONFIG_HAS_VPCI) && !defined(CONFIG_LATE_HWDOM)
        . = ALIGN(POINTER_ALIGN);
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index cb42dc8..604353f 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -240,12 +240,14 @@ SECTIONS
         *(.altinstructions)
         __alt_instructions_end = .;
 
+#if defined(CONFIG_COVERAGE)
        . = ALIGN(8);
        __ctors_start = .;
        *(.ctors)
        *(.init_array)
        *(SORT(.init_array.*))
        __ctors_end = .;
+#endif
 
 #if defined(CONFIG_HAS_VPCI) && !defined(CONFIG_LATE_HWDOM)
        . = ALIGN(POINTER_ALIGN);
diff --git a/xen/common/lib.c b/xen/common/lib.c
index 8ebec81..b8fc165 100644
--- a/xen/common/lib.c
+++ b/xen/common/lib.c
@@ -491,15 +491,20 @@ unsigned long long parse_size_and_unit(const char *s, const char **ps)
     return ret;
 }
 
+#if defined(CONFIG_COVERAGE)
 typedef void (*ctor_func_t)(void);
 extern const ctor_func_t __ctors_start[], __ctors_end[];
+#endif
 
+/* see 'docs/hypervisor-guide/code-coverage.rst' */
 void __init init_constructors(void)
 {
+#if defined(CONFIG_COVERAGE)
     const ctor_func_t *f;
     for ( f = __ctors_start; f < __ctors_end; ++f )
         (*f)();
 
+#endif
     /* Putting this here seems as good (or bad) as any other place. */
     BUILD_BUG_ON(sizeof(size_t) != sizeof(ssize_t));
 }
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-06-12  8:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-11  6:02 [Xen-devel] [PATCH] xen/coverage: wrap coverage related things under 'CONFIG_COVERAGE' Baodong Chen
2019-06-11 14:03 ` Jan Beulich
2019-06-12  0:23   ` chenbaodong
2019-06-12  6:34     ` Jan Beulich
2019-06-12  7:36       ` chenbaodong
2019-06-12  7:58         ` Jan Beulich
2019-06-12  8:49           ` chenbaodong

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).