Commit 52ff8020d02f312364ceaf0b1114759d3a1f357b

Authored by Christian Gmeiner
Committed by Tom Rini
1 parent cd5d274252

kconfig: add CONFIG_CC_COVERAGE

Make it possible to use gcc code coverage analysis.

v1 -> v2:
 - Kconfig: remove not needed 'default n'
 - Makefile: use consistent spacing

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

Showing 3 changed files with 17 additions and 0 deletions Side-by-side Diff

... ... @@ -85,4 +85,8 @@
85 85 *.orig
86 86 *~
87 87 \#*#
  88 +
  89 +# gcc code coverage files
  90 +*.gcda
  91 +*.gcno
... ... @@ -59,6 +59,13 @@
59 59  
60 60 This option is enabled by default for U-Boot.
61 61  
  62 +config CC_COVERAGE
  63 + bool "Enable code coverage analysis"
  64 + depends on SANDBOX
  65 + help
  66 + Enabling this option will pass "--coverage" to gcc to compile
  67 + and link code instrumented for coverage analysis.
  68 +
62 69 config DISTRO_DEFAULTS
63 70 bool "Select defaults suitable for booting general purpose Linux distributions"
64 71 default y if ARCH_SUNXI || TEGRA
... ... @@ -725,6 +725,12 @@
725 725 PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(c_flags) -print-libgcc-file-name`) -lgcc
726 726 endif
727 727 PLATFORM_LIBS += $(PLATFORM_LIBGCC)
  728 +
  729 +ifdef CONFIG_CC_COVERAGE
  730 +KBUILD_CFLAGS += --coverage
  731 +PLATFORM_LIBGCC += -lgcov
  732 +endif
  733 +
728 734 export PLATFORM_LIBS
729 735 export PLATFORM_LIBGCC
730 736