[PATCH] xen/linker: be more selective about defining LLVM_COV_*

Roger Pau Monne posted 1 patch 2 weeks, 3 days ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20251126081617.45401-1-roger.pau@citrix.com
xen/include/xen/xen.lds.h | 6 ++++++
1 file changed, 6 insertions(+)
[PATCH] xen/linker: be more selective about defining LLVM_COV_*
Posted by Roger Pau Monne 2 weeks, 3 days ago
There's no need to place the LLVM coverage sections in the linker script if
not building with clang, or if code coverage is not enabled.

No functional change intended.

Fixes: 186c02e85961 ('xen: Support LLVM raw profile versions 5, 6, 7, 8, 9, and 10')
Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/include/xen/xen.lds.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xen/include/xen/xen.lds.h b/xen/include/xen/xen.lds.h
index d80c89595979..f54fb2d15290 100644
--- a/xen/include/xen/xen.lds.h
+++ b/xen/include/xen/xen.lds.h
@@ -81,6 +81,7 @@
   .stab.index 0 : { *(.stab.index) }         \
   .stab.indexstr 0 : { *(.stab.indexstr) }
 
+#if defined(CONFIG_CC_IS_CLANG) && defined(CONFIG_COVERAGE)
 /* Clang coverage sections. */
 #define LLVM_COV_RW_DATA                                   \
     DECL_SECTION(__llvm_prf_cnts) { *(__llvm_prf_cnts) }   \
@@ -93,6 +94,11 @@
 #define LLVM_COV_DEBUG                                     \
     DECL_DEBUG(__llvm_covfun, 8)                           \
     DECL_DEBUG(__llvm_covmap, 8)
+#else
+#define LLVM_COV_RW_DATA
+#define LLVM_COV_RO_DATA
+#define LLVM_COV_DEBUG
+#endif
 
 /*
  * ELF sections.
-- 
2.51.0


Re: [PATCH] xen/linker: be more selective about defining LLVM_COV_*
Posted by Jan Beulich 2 weeks, 3 days ago
On 26.11.2025 09:16, Roger Pau Monne wrote:
> There's no need to place the LLVM coverage sections in the linker script if
> not building with clang, or if code coverage is not enabled.
> 
> No functional change intended.
> 
> Fixes: 186c02e85961 ('xen: Support LLVM raw profile versions 5, 6, 7, 8, 9, and 10')
> Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>