mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jan Beulich" <jbeulich@novell.com>
To: "Sam Ravnborg" <sam@ravnborg.org>
Cc: "Theodore Ts'o" <tytso@mit.edu>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	"Kernel Testers List" <kernel-testers@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH] Re: [Bug #12416] Recent change to kernel spikes out ccache/distcc
Date: Tue, 20 Jan 2009 10:31:27 +0000	[thread overview]
Message-ID: <4975B60F.76E4.0078.0@novell.com> (raw)
In-Reply-To: <2QN7KFic7LG.A.cl.C-QdJB@chimera>

To address the various issues raised on the stripping patches, this
patch
- adds a config option to control whether __crc_* symbols should be
  stripped from modules (and restores filtering out __crc_* in
  mksysmap)
- adds a fallback if the advanced module stripping fails during module
  installation
- disallows KALLSYMS_STRIP_GENERATED for 32-bit Sparc

Parts based on a draft patch from Sam Ravnborg.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Rafael J. Wysocki <rjw@sisk.pl>

---
 Makefile                 |    4 +++-
 init/Kconfig             |   12 ++++++++++++
 scripts/Makefile.build   |   20 +++++++++++++++++---
 scripts/Makefile.modinst |    3 ++-
 scripts/mksysmap         |    6 ++++--
 5 files changed, 38 insertions(+), 7 deletions(-)

--- linux-2.6.29-rc2/Makefile	2009-01-20 10:30:08.000000000 +0100
+++ 2.6.29-rc2-strip-conditional/Makefile	2009-01-07 15:35:07.000000000 +0100
@@ -620,13 +620,15 @@ mod_strip_cmd = $(OBJCOPY) --strip-debug
 ifeq ($(CONFIG_KALLSYMS_ALL),$(CONFIG_KALLSYMS_STRIP_GENERATED))
 mod_strip_cmd += --wildcard $(addprefix --strip-symbols ,$(strip-symbols))
 endif
+mod_strip_cmd2 = $(OBJCOPY) --strip-debug
 else
 mod_strip_cmd = $(OBJCOPY) $(INSTALL_MOD_STRIP)
 endif # INSTALL_MOD_STRIP=1
 else
 mod_strip_cmd = false
 endif # INSTALL_MOD_STRIP
-export mod_strip_cmd
+mod_strip_cmd2 ?= false
+export mod_strip_cmd mod_strip_cmd2
 
 
 ifeq ($(KBUILD_EXTMOD),)
--- linux-2.6.29-rc2/init/Kconfig	2009-01-20 10:30:37.000000000 +0100
+++ 2.6.29-rc2-strip-conditional/init/Kconfig	2009-01-08 09:34:39.000000000 +0100
@@ -628,6 +628,8 @@ config KALLSYMS_ALL
 config KALLSYMS_STRIP_GENERATED
 	bool "Strip machine generated symbols from kallsyms"
 	depends on KALLSYMS_ALL
+	# This doesn't work with -r in LDFLAGS_vmlinux.
+	depends on !SPARC || SPARC64
 	default y
 	help
 	  Say N if you want kallsyms to retain even machine generated symbols.
@@ -938,6 +940,16 @@ config MODVERSIONS
 	  make them incompatible with the kernel you are running.  If
 	  unsure, say N.
 
+config KBUILD_STRIP_CRC
+	bool "Strip __crc_* symbols from modules"
+	depends on MODVERSIONS
+	help
+	  Since they are useless to keep post compilation, this allows to
+	  strip these symbols. However, binutils don't offer a simple way
+	  to get rid of them, so the .c->.o compilation step gets broken up
+	  when selecting this option, which is known to have an adverse
+	  effect on compilation caching/distribution systems (ccache/distcc).
+
 config MODULE_SRCVERSION_ALL
 	bool "Source checksum for all modules"
 	help
--- linux-2.6.29-rc2/scripts/Makefile.build	2009-01-20 10:30:44.000000000 +0100
+++ 2.6.29-rc2-strip-conditional/scripts/Makefile.build	2009-01-08 10:03:27.000000000 +0100
@@ -153,7 +153,7 @@ $(obj)/%.i: $(src)/%.c FORCE
 
 cmd_genksyms =                                                              \
     $(CPP) -D__GENKSYMS__ $(c_flags) $< |                                   \
-    $(GENKSYMS) -T $@ -A -a $(ARCH)                                         \
+    $(GENKSYMS) -T $@ $(if $(CONFIG_KBUILD_STRIP_CRC), -A) -a $(ARCH)       \
      $(if $(KBUILD_PRESERVE),-p)                                            \
      $(if $(1),-r $(firstword $(wildcard $(@:.symtypes=.symref) /dev/null)))
 
@@ -187,11 +187,12 @@ else
 # o assemble <file>.o from .tmp_<file>.s forcing inclusion of directives
 #   defining the actual values of __crc_*, followed by objcopy-ing them
 #   to force these symbols to be local to permit stripping them later.
-s_file = $(@D)/.tmp_$(@F:.o=.s)
 v_file = $(@D)/.tmp_$(@F:.o=.v)
 tmp_o_file = $(@D)/.tmp_$(@F)
 no_g_c_flags = $(filter-out -g%,$(c_flags))
 
+ifneq ($(CONFIG_KBUILD_STRIP_CRC),)
+s_file = $(@D)/.tmp_$(@F:.o=.s)
 cmd_cc_o_c = $(CC) $(c_flags) -S -o $(s_file) $<
 
 cmd_modversions =							\
@@ -210,6 +211,19 @@ cmd_modversions =							\
 		rm -f $(v_file);					\
 		$(CC) $(no_g_c_flags) -c -o $@ $(s_file);		\
 	fi;
+else
+cmd_cc_o_c = $(CC) $(c_flags) -c -o $(tmp_o_file) $<
+
+cmd_modversions =							\
+	if $(OBJDUMP) -h $(tmp_o_file) | grep -q __ksymtab; then	\
+		$(cmd_genksyms) > $(v_file);				\
+		$(LD) $(LDFLAGS) -r -o $@ $(tmp_o_file)	-T $(v_file);	\
+	else								\
+		rm -f $(v_file);					\
+		mv $(tmp_o_file) $@;					\
+	fi;
+
+endif
 endif
 
 ifdef CONFIG_FTRACE_MCOUNT_RECORD
@@ -225,7 +239,7 @@ define rule_cc_o_c
 	$(cmd_record_mcount)						  \
 	scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' >    \
 	                                              $(dot-target).tmp;  \
-	if [ -r $(@D)/.tmp_$(@F:.o=.v) ]; then				  \
+	if [ -r $(v_file) ]; then					  \
 		echo >> $(dot-target).tmp;				  \
 		echo '$@: $(GENKSYMS)' >> $(dot-target).tmp;		  \
 		echo '$(GENKSYMS):: ;' >> $(dot-target).tmp;		  \
--- linux-2.6.29-rc2/scripts/Makefile.modinst	2009-01-20 10:30:44.000000000 +0100
+++ 2.6.29-rc2-strip-conditional/scripts/Makefile.modinst	2009-01-07 15:32:23.000000000 +0100
@@ -18,7 +18,8 @@ __modinst: $(modules)
 
 quiet_cmd_modules_install = INSTALL $@
       cmd_modules_install = mkdir -p $(2); \
-			    $(mod_strip_cmd) $@ $(2)/$(notdir $@) || cp $@ $(2)
+			    $(mod_strip_cmd) $@ $(2)/$(notdir $@) || \
+			    $(mod_strip_cmd2) $@ $(2)/$(notdir $@) || cp $@ $(2)
 
 # Modules built outside the kernel source tree go into extra by default
 INSTALL_MOD_DIR ?= extra
--- linux-2.6.29-rc2/scripts/mksysmap	2009-01-20 10:30:44.000000000 +0100
+++ 2.6.29-rc2-strip-conditional/scripts/mksysmap	2009-01-20 00:00:00.000000000 +0100
@@ -37,6 +37,8 @@
 
 # readprofile starts reading symbols when _stext is found, and
 # continue until it finds a symbol which is not either of 'T', 't',
-# 'W' or 'w'.
+# 'W' or 'w'. __crc_ are 'A' and placed in the middle
+# so we just ignore them to let readprofile continue to work.
+# (At least sparc64 has __crc_ in the middle).
 
-$NM -n $1 | grep -v '\( [aNUw] \)\|\( \$[adt]\)' > $2
+$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)' > $2



  reply	other threads:[~2009-01-20 10:31 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-19 21:28 2.6.29-rc2-git1: Reported regressions from 2.6.28 Rafael J. Wysocki
2009-01-19 21:28 ` [Bug #12399] USB wakeup problem on multiple machines Rafael J. Wysocki
2009-01-19 21:32 ` [Bug #12400] git-latest: kernel oops in IOMMU setup Rafael J. Wysocki
2009-01-19 21:32 ` [Bug #12414] iwl4965 cannot use "ap auto" on latest 2.6.28/29? Rafael J. Wysocki
2009-01-19 21:32 ` [Bug #12416] Recent change to kernel spikes out ccache/distcc Rafael J. Wysocki
2009-01-20 10:31   ` Jan Beulich [this message]
2009-01-19 21:32 ` [Bug #12402] 2.6.29-rc: kernel BUG at fs/xfs/support/debug.c:108 Rafael J. Wysocki
2009-01-28 23:39   ` Alexander Beregalov
2009-02-03 22:56     ` Rafael J. Wysocki
2009-01-19 21:32 ` [Bug #12415] WARNING: at drivers/net/wireless/iwlwifi/iwl-sta.c:689 Rafael J. Wysocki
2009-01-19 21:32 ` [Bug #12418] Repeated ioctl(4, 0x40046445, ..) loop in glxgears Rafael J. Wysocki
2009-01-19 21:32 ` [Bug #12422] 2.6.28-git can't resume from str Rafael J. Wysocki
2009-01-20  0:39   ` Harvey Harrison
2009-01-20  1:46   ` Jeff Chua
2009-01-19 21:32 ` [Bug #12419] possible circular locking dependency on i915 dma Rafael J. Wysocki
2009-01-20  0:29   ` Wang Chen
2009-01-19 21:32 ` [Bug #12417] glx performance drop with: "x86: PAT: implement track/untrack of pfnmap regions for x86 - v3" Rafael J. Wysocki
2009-01-20  7:47   ` Ingo Molnar
2009-01-20  9:09     ` Alexey Fisher
2009-01-20 13:45     ` Alexey Fisher
2009-01-19 21:32 ` [Bug #12441] Xorg can't use dri on radeon X1950 AGP Rafael J. Wysocki
2009-01-19 21:32 ` [Bug #12444] X hangs following switch from radeonfb console - Bisected Rafael J. Wysocki
2009-01-19 21:32 ` [Bug #12427] cpumask change causes sparc build bustage Rafael J. Wysocki
2009-01-19 21:32 ` [Bug #12490] ath5k related kernel panic in 2.6.29-rc1 Rafael J. Wysocki
2009-01-20 22:44   ` Bob Copeland
2009-01-19 21:32 ` [Bug #12491] i915 lockdep warning Rafael J. Wysocki
2009-01-19 21:32 ` [Bug #12468] Crash in acpi_cpufreq_init Rafael J. Wysocki
2009-01-20  0:33   ` Alex Riesen
2009-01-20 14:23     ` Ingo Molnar
2009-01-20 22:35       ` Alex Riesen
2009-01-21 11:59         ` Ingo Molnar
2009-01-19 21:32 ` [Bug #12469] XFS : Corruption of in-memory data Rafael J. Wysocki
2009-01-19 21:32 ` [Bug #12496] swsusp cannot find resume device (sometimes) Rafael J. Wysocki
2009-01-19 21:32 ` [Bug #12493] ACPI related kernel panic when booting 2.6.29-rc2 Rafael J. Wysocki
2009-01-19 21:32 ` [Bug #12495] thinkpad problems during resume Rafael J. Wysocki
2009-01-19 21:32 ` [Bug #12494] Sony backlight regression from 2.6.28 to 29-rc Rafael J. Wysocki
2009-01-20 16:46   ` Norbert Preining
2009-01-19 21:32 ` [Bug #12497] new barrier warnings in 2.6.29-rc1 Rafael J. Wysocki
2009-01-19 21:32 ` [Bug #12499] Problem with using bluetooth adaper connected to usb port Rafael J. Wysocki
2009-01-19 21:32 ` [Bug #12498] OOPS and panic on 2.6.29-rc1 on xen-x86 Rafael J. Wysocki
2009-01-20  0:35   ` Nick Piggin
2009-01-19 21:32 ` [Bug #12501] build bug in eeepc-laptop.c Rafael J. Wysocki
2009-01-19 21:32 ` [Bug #12502] pipe_read oops on sh Rafael J. Wysocki
2009-01-19 21:32 ` [Bug #12503] [slab corruption] BUG key_jar: Poison overwritten Rafael J. Wysocki
2009-01-19 21:32 ` [Bug #12504] 2.6.29-rc1 vs selinux Rafael J. Wysocki
2009-01-19 21:32 ` [Bug #12506] Undefined symbols when CONFIG_MFD_PCF50633 is enabled Rafael J. Wysocki
2009-01-19 21:32 ` [Bug #12505] 2.6.29-rc1 Firefox crashing on page load Rafael J. Wysocki
2009-01-20  6:29   ` Justin Madru
2009-01-20  7:43     ` Ingo Molnar
2009-01-20  8:16       ` Ingo Molnar
2009-01-20  8:37         ` Ingo Molnar
2009-01-21  9:31           ` Justin Madru
2009-01-21  9:40             ` Justin P. Mattock
2009-01-19 21:32 ` [Bug #12507] e100: netconsole not functional because of missing firmware Rafael J. Wysocki
2009-01-19 21:32 ` [Bug #12511] WARNING: at drivers/dma/dmaengine.c:352 Rafael J. Wysocki
2009-01-19 21:32 ` [Bug #12510] 2.6.29-rc2 dies on startup Rafael J. Wysocki
2009-01-19 21:32 ` [Bug #12508] "powerpc/pci: Reserve legacy regions on PCI" broke my G3 Rafael J. Wysocki
2009-01-19 21:32 ` [Bug #12509] lockdep report. fb_mmap vs sys_mmap2 Rafael J. Wysocki

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=4975B60F.76E4.0078.0@novell.com \
    --to=jbeulich@novell.com \
    --cc=kernel-testers@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@sisk.pl \
    --cc=sam@ravnborg.org \
    --cc=tytso@mit.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome