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