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 3/7] kbuild: delay object file renaming during module versioning
Date: Mon, 19 May 2008 10:43:47 +0200	[thread overview]
Message-ID: <48313DC3.4070904@de.ibm.com> (raw)

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

Change module versioning to alter object file names only after
compiling.

Required by the gcov profiling infrastructure: when compiling with
option -fprofile-arcs, gcc stores file names inside object files.
A name change before compilation would prevent the gcov tool from
finding the corresponding source files.

Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
---
 scripts/Makefile.build |   25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

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,26 +165,23 @@ $(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)  $@
-
-ifndef CONFIG_MODVERSIONS
 cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
 
-else
-# When module versioning is enabled the following steps are executed:
-# o compile a .tmp_<file>.o from <file>.c
-# o if .tmp_<file>.o doesn't contain a __ksymtab version, i.e. does
-#   not export symbols, we just rename .tmp_<file>.o to <file>.o and
-#   are done.
-# o otherwise, we calculate symbol versions using the good old
-#   genksyms on the preprocessed source and postprocess them in a way
-#   that they are usable as a linker script
+ifdef CONFIG_MODVERSIONS
+# When module versioning is enabled the following steps are executed
+# in addition to compiling:
+# o if <file>.o doesn't contain a __ksymtab version, i.e. does
+#   not export symbols, we are done
+# o otherwise, we rename <file>.o into .tmp_<file.o> and calculate symbol
+#   versions using the good old genksyms on the preprocessed source and
+#   postprocess them in a way that they are usable as a linker script
 # o generate <file>.o from .tmp_<file>.o using the linker to
 #   replace the unresolved symbols __crc_exported_symbol with
 #   the actual value of the checksum generated by genksyms
 
-cmd_cc_o_c = $(CC) $(c_flags) -c -o $(@D)/.tmp_$(@F) $<
 cmd_modversions =							\
-	if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then	\
+	if $(OBJDUMP) -h $@ | grep -q __ksymtab; then			\
+		mv -f $@ $(@D)/.tmp_$(@F);				\
 		$(CPP) -D__GENKSYMS__ $(c_flags) $<			\
 		| $(GENKSYMS) $(if $(KBUILD_SYMTYPES),			\
 			      -T $(@D)/$(@F:.o=.symtypes)) -a $(ARCH)	\
@@ -193,8 +190,6 @@ cmd_modversions =							\
 		$(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) 		\
 			-T $(@D)/.tmp_$(@F:.o=.ver);			\
 		rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver);	\
-	else								\
-		mv -f $(@D)/.tmp_$(@F) $@;				\
 	fi;
 endif
 






                 reply	other threads:[~2008-05-19  8:44 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=48313DC3.4070904@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.