[PATCH v2 19/20] gcov: add MC/DC condition coverage support
Peter Oberparleiter
oberpar at linux.ibm.com
Thu Nov 5 09:56:10 PST 2026
On 03.11.2026 02:52, Sasha Levin wrote:
> Support CONFIG_COVERAGE_MCDC with gcov, using GCC's MC/DC condition
> coverage instrumentation (-fcondition-coverage), which is available
> since GCC 14. The data is shown by "gcov --conditions".
>
> Add -fcondition-coverage to the gcov compiler flags when enabled, and
> disable the warnings about decisions it leaves out, as is done for
> Clang. Both are gated on the config option to avoid Clang warnings
> about unknown options.
>
> Also add -fcondition-coverage to CFLAGS_REMOVE in the x86 UML vDSO
> Makefile to prevent instrumentation of userspace vDSO code.
>
> Signed-off-by: Sasha Levin <sashal at kernel.org>
Looks good, minor comment below.
Reviewed-by: Peter Oberparleiter <oberpar at linux.ibm.com>
[...]
> @@ -108,8 +108,8 @@ config COVERAGE_PROFILE_ALL
>
> config COVERAGE_MCDC
> bool "Measure modified condition/decision coverage (MC/DC)"
> - depends on LLVM_COV_KERNEL
> - depends on CLANG_VERSION >= 220000 || !WERROR
> + depends on LLVM_COV_KERNEL || (GCOV_KERNEL && CC_HAS_CONDITION_COVERAGE)
> + depends on !LLVM_COV_KERNEL || CLANG_VERSION >= 220000 || !WERROR
Would it make sense to transform this for readability, i.e.
depends on !(LLVM_COV_KERNEL && CLANG_VERSION < 220000 && WERROR)
--
Peter Oberparleiter
Linux on IBM Z Development - IBM Germany R&D
More information about the linux-um
mailing list