kbuild: make it possible for the linker to discard local symbols from vmlinux
authorDavid Howells <dhowells@redhat.com>
Wed, 4 Mar 2009 19:59:07 +0000 (11:59 -0800)
committerSam Ravnborg <sam@ravnborg.org>
Sat, 11 Apr 2009 06:18:10 +0000 (08:18 +0200)
Make it possible for the linker to discard local symbols from vmlinux as
they cause vmlinux to balloon when CONFIG_KALLSYMS=y and they cause
dump_stack() and get_wchan() to produce useless information under some
circumstances.

With this we add a config option (CONFIG_STRIP_ASM_SYMS) that will cause
the build to supply -X to the linker to tell it to strip temporary local
symbols.

This doesn't seem to cause gdb any problems.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Makefile
init/Kconfig

index 3e95d454285c4c73262cd873d686780a50b16cb1..ad830bd45a4bb727c06d3855073de6ec4367addc 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -597,6 +597,10 @@ LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\
 LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
 LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)
 
+ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
+LDFLAGS_vmlinux        += -X
+endif
+
 # Default kernel image to build when no specific target is given.
 # KBUILD_IMAGE may be overruled on the command line or
 # set in the environment
index f2f9b5362b48eebe3c50ff0d2f91a9130da429c4..7be4d3836745a049596e7be06b5e850c035b1f72 100644 (file)
@@ -808,6 +808,14 @@ config KALLSYMS_EXTRA_PASS
           you wait for kallsyms to be fixed.
 
 
+config STRIP_ASM_SYMS
+       bool "Strip assembler-generated symbols during link"
+       default n
+       help
+         Strip internal assembler-generated symbols during a link (symbols
+         that look like '.Lxxx') so they don't pollute the output of
+         get_wchan() and suchlike.
+
 config HOTPLUG
        bool "Support for hot-pluggable devices" if EMBEDDED
        default y