Skip to contentSkip to conversation

Makefile: support flag -fsanitizer-coverage=trace-cmp

PATCH New [email protected] 1 participant 1 message Nov 17, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 78/94 Makefile: support flag -fsanitizer-coverage=trace-cmp

From: Victor Chibotaru <[email protected]>
Subject: Makefile: support flag -fsanitizer-coverage=trace-cmp

The flag enables Clang instrumentation of comparison operations (currently not supported by GCC). This instrumentation is needed by the new KCOV device to collect comparison operands.

---

 Makefile              |    3 +--
 lib/Kconfig.debug     |   10 ++++++++++
 scripts/Makefile.kcov |    7 +++++++
 3 files changed, 18 insertions(+), 2 deletions(-)
lib/Kconfig.debug renamed from lib/Kconfig.debug~makefile-support-flag-fsanitizer-coverage=trace-cmp +10 -0
diff -puN lib/Kconfig.debug~makefile-support-flag-fsanitizer-coverage=trace-cmp lib/Kconfig.debug
@@ -756,6 +756,16 @@ config KCOV
 
 	  For more details, see Documentation/dev-tools/kcov.rst.
 
+config KCOV_ENABLE_COMPARISONS
+	bool "Enable comparison operands collection by KCOV"
+	depends on KCOV
+	default n
+	help
+	  KCOV also exposes operands of every comparison in the instrumented
+	  code along with operand sizes and PCs of the comparison instructions.
+	  These operands can be used by fuzzing engines to improve the quality
+	  of fuzzing coverage.
+
 config KCOV_INSTRUMENT_ALL
 	bool "Instrument all code by default"
 	depends on KCOV
Makefile renamed from Makefile~makefile-support-flag-fsanitizer-coverage=trace-cmp +0 -1
diff -puN Makefile~makefile-support-flag-fsanitizer-coverage=trace-cmp Makefile
@@ -375,8 +375,6 @@ CFLAGS_KERNEL	=
 AFLAGS_KERNEL	=
 LDFLAGS_vmlinux =
 CFLAGS_GCOV	:= -fprofile-arcs -ftest-coverage -fno-tree-loop-im $(call cc-disable-warning,maybe-uninitialized,)
-CFLAGS_KCOV	:= $(call cc-option,-fsanitize-coverage=trace-pc,)