Commit 5d7d18f5bc507b60d3d8967e2739d5e6ffdd630f

Authored by David Howells
Committed by Sam Ravnborg
1 parent 0fa3a88cfd

kbuild: make it possible for the linker to discard local symbols from vmlinux

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>

Showing 2 changed files with 12 additions and 0 deletions Side-by-side Diff

... ... @@ -597,6 +597,10 @@
597 597 LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
598 598 LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)
599 599  
  600 +ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
  601 +LDFLAGS_vmlinux += -X
  602 +endif
  603 +
600 604 # Default kernel image to build when no specific target is given.
601 605 # KBUILD_IMAGE may be overruled on the command line or
602 606 # set in the environment
... ... @@ -808,6 +808,14 @@
808 808 you wait for kallsyms to be fixed.
809 809  
810 810  
  811 +config STRIP_ASM_SYMS
  812 + bool "Strip assembler-generated symbols during link"
  813 + default n
  814 + help
  815 + Strip internal assembler-generated symbols during a link (symbols
  816 + that look like '.Lxxx') so they don't pollute the output of
  817 + get_wchan() and suchlike.
  818 +
811 819 config HOTPLUG
812 820 bool "Support for hot-pluggable devices" if EMBEDDED
813 821 default y