Skip to contentSkip to conversation

xen/linker: be more selective about defining LLVM_COV_*

PATCH In review Roger Pau Monne 2 participants 2 messages Nov 26, 2025

lore
Share & tools
lore
#0 lore raw

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

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')
---
 xen/include/xen/xen.lds.h | 6 ++++++
 1 file changed, 6 insertions(+)
xen/include/xen/xen.lds.h +6 -0
index d80c89595979..f54fb2d15290 100644
@@ -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.
Signature · 1 line
2.51.0