From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756184AbYESIoT (ORCPT ); Mon, 19 May 2008 04:44:19 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757873AbYESInw (ORCPT ); Mon, 19 May 2008 04:43:52 -0400 Received: from mtagate4.de.ibm.com ([195.212.29.153]:30122 "EHLO mtagate4.de.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757684AbYESInu (ORCPT ); Mon, 19 May 2008 04:43:50 -0400 Message-ID: <48313DC3.4070904@de.ibm.com> Date: Mon, 19 May 2008 10:43:47 +0200 From: Peter Oberparleiter User-Agent: Thunderbird 2.0.0.4 (X11/20070604) MIME-Version: 1.0 To: linux-kernel@vger.kernel.org CC: ltp-coverage@lists.sourceforge.net, Andrew Morton , Sam Ravnborg , Peter Oberparleiter Subject: [PATCH 3/7] kbuild: delay object file renaming during module versioning Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Oberparleiter 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 --- 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_.o from .c -# o if .tmp_.o doesn't contain a __ksymtab version, i.e. does -# not export symbols, we just rename .tmp_.o to .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 .o doesn't contain a __ksymtab version, i.e. does +# not export symbols, we are done +# o otherwise, we rename .o into .tmp_ 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 .o from .tmp_.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