All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: ltp-coverage@lists.sourceforge.net,
	Andrew Morton <akpm@linux-foundation.org>,
	Sam Ravnborg <sam@ravnborg.org>,
	Peter Oberparleiter <oberparleiter@googlemail.com>
Subject: [PATCH 5/6] gcov: create links to .gcda files in build directory
Date: Mon, 02 Jun 2008 15:34:35 +0200	[thread overview]
Message-ID: <4843F6EB.6040901@de.ibm.com> (raw)

From: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>

Modify kbuild to create symbolic links in the build directory which
refer to the .gcda files in sysfs.

Required by the gcov profiling infrastructure: the gcov tool requires
all data files (x.gcda, x.gcno) to be found in the same directory.

Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
---
 Makefile               |   11 ++++++-----
 scripts/Makefile.build |    9 ++++++++-
 2 files changed, 14 insertions(+), 6 deletions(-)

Index: linux-2.6.26-rc4/Makefile
===================================================================
--- linux-2.6.26-rc4.orig/Makefile
+++ linux-2.6.26-rc4/Makefile
@@ -321,7 +321,7 @@ LDFLAGS_MODULE  =
 CFLAGS_KERNEL	=
 AFLAGS_KERNEL	=
 CFLAGS_GCOV	= -fprofile-arcs -ftest-coverage
-
+GCOV_DATA_DIR	= /sys/kernel/debug/gcov
 
 # Use LINUXINCLUDE when you must reference the include/ directory.
 # Needed to be compatible with the O= option
@@ -343,7 +343,7 @@ KERNELVERSION = $(VERSION).$(PATCHLEVEL)
 export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
 export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
 export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE
-export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
+export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS GCOV_DATA_DIR
 
 export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
 export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV
@@ -1135,8 +1135,8 @@ clean: archclean $(clean-dirs)
 		\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
 		-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
 		-o -name '*.symtypes' -o -name 'modules.order' \
-		-o -name '*.gcno' \) \
-		-type f -print | xargs rm -f
+		-o -name '*.gcno' -o -name '*.gcda' \) \
+		\( -type f -o -type l \) -print | xargs rm -f
 
 # mrproper - Delete all generated files, including .config
 #
@@ -1340,7 +1340,8 @@ clean: $(clean-dirs)
 	@find $(KBUILD_EXTMOD) $(RCS_FIND_IGNORE) \
 		\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
 		-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
-		-o -name '*.gcno' \) -type f -print | xargs rm -f
+		-o -name '*.gcno' -o -name '*.gcda' \) \
+		\( -type f -o -type l \) -print | xargs rm -f
 
 help:
 	@echo  '  Building external modules.'
Index: linux-2.6.26-rc4/scripts/Makefile.build
===================================================================
--- linux-2.6.26-rc4.orig/scripts/Makefile.build
+++ linux-2.6.26-rc4/scripts/Makefile.build
@@ -198,6 +198,12 @@ cmd_modversions =							\
 	fi;
 endif
 
+ifdef CONFIG_GCOV_PROFILE
+# Create a link to the gcov data file in /sys
+cmd_gcov = ln -s -f $(GCOV_DATA_DIR)$(if \
+	$(filter-out /%,$(@D)),$(objtree)/$(@D),$(@D))/$(@F:.o=.gcda) $(@D)
+endif
+
 define rule_cc_o_c
 	$(call echo-cmd,checksrc) $(cmd_checksrc)			  \
 	$(call echo-cmd,cc_o_c) $(cmd_cc_o_c);				  \
@@ -205,7 +211,8 @@ define rule_cc_o_c
 	scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' >    \
 	                                              $(dot-target).tmp;  \
 	rm -f $(depfile);						  \
-	mv -f $(dot-target).tmp $(dot-target).cmd
+	mv -f $(dot-target).tmp $(dot-target).cmd;			  \
+	$(cmd_gcov)
 endef
 
 # Built-in and composite module parts





                 reply	other threads:[~2008-06-02 13:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4843F6EB.6040901@de.ibm.com \
    --to=peter.oberparleiter@de.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ltp-coverage@lists.sourceforge.net \
    --cc=oberparleiter@googlemail.com \
    --cc=sam@ravnborg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.