aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorPeter Oberparleiter <oberpar@linux.vnet.ibm.com>2009-06-17 19:28:08 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-18 16:03:57 -0400
commit2521f2c228ad750701ba4702484e31d876dbc386 (patch)
tree2221de3e3de9512979b8244c6304366e3be5be63 /Makefile
parent0b923606e75f1ab672e25b14ac039a1cdcfa382f (diff)
gcov: add gcov profiling infrastructure
Enable the use of GCC's coverage testing tool gcov [1] with the Linux kernel. gcov may be useful for: * debugging (has this code been reached at all?) * test improvement (how do I change my test to cover these lines?) * minimizing kernel configurations (do I need this option if the associated code is never run?) The profiling patch incorporates the following changes: * change kbuild to include profiling flags * provide functions needed by profiling code * present profiling data as files in debugfs Note that on some architectures, enabling gcc's profiling option "-fprofile-arcs" for the entire kernel may trigger compile/link/ run-time problems, some of which are caused by toolchain bugs and others which require adjustment of architecture code. For this reason profiling the entire kernel is initially restricted to those architectures for which it is known to work without changes. This restriction can be lifted once an architecture has been tested and found compatible with gcc's profiling. Profiling of single files or directories is still available on all platforms (see config help text). [1] http://gcc.gnu.org/onlinedocs/gcc/Gcov.html Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Huang Ying <ying.huang@intel.com> Cc: Li Wei <W.Li@Sun.COM> Cc: Michael Ellerman <michaele@au1.ibm.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Heiko Carstens <heicars2@linux.vnet.ibm.com> Cc: Martin Schwidefsky <mschwid2@linux.vnet.ibm.com> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: WANG Cong <xiyou.wangcong@gmail.com> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Jeff Dike <jdike@addtoit.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile11
1 files changed, 6 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index ea63667617f3..46e1c9d03d51 100644
--- a/Makefile
+++ b/Makefile
@@ -330,6 +330,7 @@ AFLAGS_MODULE = $(MODFLAGS)
330LDFLAGS_MODULE = 330LDFLAGS_MODULE =
331CFLAGS_KERNEL = 331CFLAGS_KERNEL =
332AFLAGS_KERNEL = 332AFLAGS_KERNEL =
333CFLAGS_GCOV = -fprofile-arcs -ftest-coverage
333 334
334 335
335# Use LINUXINCLUDE when you must reference the include/ directory. 336# Use LINUXINCLUDE when you must reference the include/ directory.
@@ -356,7 +357,7 @@ export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE
356export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS 357export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
357 358
358export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS 359export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
359export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE 360export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV
360export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE 361export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
361 362
362# When compiling out-of-tree modules, put MODVERDIR in the module 363# When compiling out-of-tree modules, put MODVERDIR in the module
@@ -1216,8 +1217,8 @@ clean: archclean $(clean-dirs)
1216 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ 1217 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
1217 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ 1218 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
1218 -o -name '*.symtypes' -o -name 'modules.order' \ 1219 -o -name '*.symtypes' -o -name 'modules.order' \
1219 -o -name 'Module.markers' -o -name '.tmp_*.o.*' \) \ 1220 -o -name 'Module.markers' -o -name '.tmp_*.o.*' \
1220 -type f -print | xargs rm -f 1221 -o -name '*.gcno' \) -type f -print | xargs rm -f
1221 1222
1222# mrproper - Delete all generated files, including .config 1223# mrproper - Delete all generated files, including .config
1223# 1224#
@@ -1421,8 +1422,8 @@ clean: $(clean-dirs)
1421 $(call cmd,rmfiles) 1422 $(call cmd,rmfiles)
1422 @find $(KBUILD_EXTMOD) $(RCS_FIND_IGNORE) \ 1423 @find $(KBUILD_EXTMOD) $(RCS_FIND_IGNORE) \
1423 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ 1424 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
1424 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \ 1425 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
1425 -type f -print | xargs rm -f 1426 -o -name '*.gcno' \) -type f -print | xargs rm -f
1426 1427
1427help: 1428help:
1428 @echo ' Building external modules.' 1429 @echo ' Building external modules.'