public inbox for linux-doc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] gcov: Add MC/DC condition coverage support
@ 2026-03-14 14:17 Sasha Levin
  2026-03-14 14:17 ` [PATCH 1/4] gcov: fix gcov_info_add() merge semantics for IOR counters Sasha Levin
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Sasha Levin @ 2026-03-14 14:17 UTC (permalink / raw)
  To: oberpar
  Cc: corbet, skhan, nathan, linux-kbuild, linux-kernel, linux-doc,
	Sasha Levin

This series adds support for GCC's MC/DC (Modified Condition/Decision
Coverage) instrumentation to the kernel's gcov subsystem.

MC/DC verifies that each condition in a boolean decision independently
affects the decision's outcome. It is required by safety standards such
as DO-178C (avionics) and ISO 26262 (automotive). GCC 14 added MC/DC
instrumentation via -fcondition-coverage.

Patch 1 fixes a pre-existing bug in gcov_info_add() where IOR-based
counters (bitsets) were incorrectly merged with += instead of |=.
Patches 2-3 add the CONFIG_GCOV_CONDITION_COVERAGE Kconfig option and
wire up the compiler flag. Patch 4 documents the feature.

With CONFIG_GCOV_CONDITION_COVERAGE=y, gcov --conditions shows per-line
condition coverage:

  4577658:  257:	if (node->num_loaded > 0)
  condition outcomes covered 2/2
  4577658:  355:	if (info && (strcmp(gcov_info_filename(info), name) == 0))
  condition outcomes covered 2/4
  condition  0 not covered (true)
  condition  1 not covered (true)
     2896:  420:	if (!copy)
  condition outcomes covered 1/2
  condition  0 not covered (true)

Tested with GCC 15.2, verified boot + gcov data extraction + gcov
--conditions output. Also verified clean build with LLVM=1 (condition
coverage correctly disabled for Clang).

Sasha Levin (4):
  gcov: fix gcov_info_add() merge semantics for IOR counters
  kconfig: add CC_HAS_CONDITION_COVERAGE for MC/DC support detection
  gcov: add MC/DC condition coverage support
  Documentation: gcov: document MC/DC condition coverage support

 Documentation/dev-tools/gcov.rst | 25 +++++++++++++++++++++++++
 Makefile                         |  3 +++
 arch/x86/um/vdso/Makefile        |  4 ++--
 init/Kconfig                     |  3 +++
 kernel/gcov/Kconfig              | 15 +++++++++++++++
 kernel/gcov/gcc_4_7.c            | 25 ++++++++++++++++++++++---
 6 files changed, 70 insertions(+), 5 deletions(-)

-- 
2.51.0


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

end of thread, other threads:[~2026-03-14 14:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-14 14:17 [PATCH 0/4] gcov: Add MC/DC condition coverage support Sasha Levin
2026-03-14 14:17 ` [PATCH 1/4] gcov: fix gcov_info_add() merge semantics for IOR counters Sasha Levin
2026-03-14 14:17 ` [PATCH 2/4] kconfig: add CC_HAS_CONDITION_COVERAGE for MC/DC support detection Sasha Levin
2026-03-14 14:17 ` [PATCH 3/4] gcov: add MC/DC condition coverage support Sasha Levin
2026-03-14 14:17 ` [PATCH 4/4] Documentation: gcov: document " Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox