Skip to content

RFC Enable Clang's Source-based Code Coverage and MC/DC for x86-64

Sasha Levin linux-arch linux-efi linux-kbuild linux-trace-kernel linux-um lkml llvm 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest4 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4llvm-cov: add Clang's Source-based Code Coverage supportMakefile arch/Kconfig include/asm-generic/vmlinux.lds.h +7 more+557 -00 replies
2/4llvm-cov: add Clang's MC/DC supportMakefile kernel/llvm-cov/Kconfig scripts/Makefile.lib+54 -00 replies
3/4x86: disable llvm-cov instrumentationarch/x86/crypto/Makefile lib/crypto/Makefile+3 -10 replies
4/4x86: enable llvm-cov supportarch/x86/Kconfig arch/x86/kernel/vmlinux.lds.S+4 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/4] Enable Clang's Source-based Code Coverage and MC/DC for x86-64

This series adds support for Clang's Source-based Code Coverage to the Linux kernel, enabling more accurate coverage measurement at the source level compared to gcov. This is particularly valuable for safety-critical use cases (automotive, medical, aerospace) where MC/DC coverage is required for certification.

Changes since previous patchset [1]:
- Rebased on v6.18-rc1
- Adapted to lib/crypto reorganization (curve25519 exclusion moved to lib/crypto/Makefile)
- Minor correctness fixes throughout the codebase

The implementation has been tested with a kernel build using Clang 18+ and boots successfully in a KVM environment with instrumentation enabled.

[1] https://lore.kernel.org/all/[email protected]/

Wentao Zhang (4):
llvm-cov: add Clang's Source-based Code Coverage support
llvm-cov: add Clang's MC/DC support
x86: disable llvm-cov instrumentation
x86: enable llvm-cov support

 Makefile                          |   9 ++
 arch/Kconfig                      |   1 +
 arch/x86/Kconfig                  |   2 +
 arch/x86/crypto/Makefile          |   1 +
 arch/x86/kernel/vmlinux.lds.S     |   2 +
 include/asm-generic/vmlinux.lds.h |  36 +++++
 kernel/Makefile                   |   1 +
 kernel/llvm-cov/Kconfig           | 121 ++++++++++++++
 kernel/llvm-cov/Makefile          |   8 +
 kernel/llvm-cov/fs.c              | 253 ++++++++++++++++++++++++++++++
 kernel/llvm-cov/llvm-cov.h        | 157 ++++++++++++++++++
 lib/crypto/Makefile               |   3 +-
 scripts/Makefile.lib              |  23 +++
 scripts/mod/modpost.c             |   2 +
 14 files changed, 618 insertions(+), 1 deletion(-)
 create mode 100644 kernel/llvm-cov/Kconfig
 create mode 100644 kernel/llvm-cov/Makefile
 create mode 100644 kernel/llvm-cov/fs.c
 create mode 100644 kernel/llvm-cov/llvm-cov.h
Signature · 1 line
2.51.0