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 6/7] kbuild: make source and include paths absolute
Date: Mon, 19 May 2008 10:44:56 +0200 [thread overview]
Message-ID: <48313E08.8070904@de.ibm.com> (raw)
From: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
Change all source and include paths to absolute form when
CONFIG_GCOV_PROFILE is enabled.
Example:
gcc -Idir1 -c a.c -o a.o
will become
gcc -I/path/to/dir1 -c /path/to/a.c -o a.o
Required by the gcov profiling infrastructure: when compiling with
option -fprofile-arcs, gcc stores file names inside object files.
Relative paths prevent the gcov tool from finding corresponding source
files.
Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
---
scripts/Kbuild.include | 7 +++++++
scripts/Makefile.build | 3 ++-
scripts/Makefile.lib | 8 +++++++-
3 files changed, 16 insertions(+), 2 deletions(-)
Index: linux-2.6.26-rc3/scripts/Makefile.lib
===================================================================
--- linux-2.6.26-rc3.orig/scripts/Makefile.lib
+++ linux-2.6.26-rc3/scripts/Makefile.lib
@@ -126,10 +126,16 @@ __a_flags = $(c
__cpp_flags = $(call flags,_cpp_flags)
endif
-c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \
+___c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \
$(__c_flags) $(modkern_cflags) \
-D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags)
+ifeq ($(CONFIG_GCOV_PROFILE),)
+c_flags = $(___c_flags)
+else
+c_flags = $(call flags_addpath,___c_flags,$(objtree))
+endif
+
a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \
$(__a_flags) $(modkern_aflags)
Index: linux-2.6.26-rc3/scripts/Makefile.build
===================================================================
--- linux-2.6.26-rc3.orig/scripts/Makefile.build
+++ linux-2.6.26-rc3/scripts/Makefile.build
@@ -165,7 +165,8 @@ $(obj)/%.symtypes : $(src)/%.c FORCE
# (See cmd_cc_o_c + relevant part of rule_cc_o_c)
quiet_cmd_cc_o_c = CC $(quiet_modtag) $@
-cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
+cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ \
+ $(if $(CONFIG_GCOV_PROFILE),$(call addpath,$<,$(objtree)),$<)
ifdef CONFIG_MODVERSIONS
# When module versioning is enabled the following steps are executed
Index: linux-2.6.26-rc3/scripts/Kbuild.include
===================================================================
--- linux-2.6.26-rc3.orig/scripts/Kbuild.include
+++ linux-2.6.26-rc3/scripts/Kbuild.include
@@ -149,6 +149,13 @@ addtree = $(if $(filter-out -I/%,$(1)),$
# Find all -I options and call addtree
flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o)))
+# Prefix $(1) with $(2)/ if $(1) does not start with /
+addpath = $(if $(filter-out /%,$(1)),$(2)/$(1),$(1))
+
+# Find all -I options and call addpath
+flags_addpath = $(foreach o,$($(1)),\
+ $(if $(filter -I%,$(o)),-I$(call addpath,$(o:-I%=%),$(2)),$(o)))
+
# echo command.
# Short version is used, if $(quiet) equals `quiet_', otherwise full one.
echo-cmd = $(if $($(quiet)cmd_$(1)),\
next reply other threads:[~2008-05-19 8:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-19 8:44 Peter Oberparleiter [this message]
2008-05-19 13:45 ` [PATCH 6/7] kbuild: make source and include paths absolute Jan Blunck
2008-05-23 3:17 ` Andrew Morton
2008-05-23 17:18 ` Adrian Bunk
2008-05-23 18:17 ` Andrew Morton
2008-05-23 19:09 ` Sam Ravnborg
2008-05-23 19:42 ` Vegard Nossum
2008-05-23 19:52 ` Sam Ravnborg
2008-05-27 9:16 ` Peter Oberparleiter
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=48313E08.8070904@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.