aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile47
1 files changed, 35 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 5dd0ed3b12c6..b3d1c8f1f4ce 100644
--- a/Makefile
+++ b/Makefile
@@ -604,6 +604,9 @@ export INSTALL_PATH ?= /boot
604MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) 604MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
605export MODLIB 605export MODLIB
606 606
607strip-symbols := $(srctree)/scripts/strip-symbols \
608 $(wildcard $(srctree)/arch/$(ARCH)/scripts/strip-symbols)
609
607# 610#
608# INSTALL_MOD_STRIP, if defined, will cause modules to be stripped while 611# INSTALL_MOD_STRIP, if defined, will cause modules to be stripped while
609# they get installed. If INSTALL_MOD_STRIP is '1', then the default 612# they get installed. If INSTALL_MOD_STRIP is '1', then the default
@@ -611,8 +614,10 @@ export MODLIB
611# be used as the option(s) to the objcopy command. 614# be used as the option(s) to the objcopy command.
612ifdef INSTALL_MOD_STRIP 615ifdef INSTALL_MOD_STRIP
613ifeq ($(INSTALL_MOD_STRIP),1) 616ifeq ($(INSTALL_MOD_STRIP),1)
614mod_strip_cmd = $(OBJCOPY) --strip-debug --strip-symbols \ 617mod_strip_cmd = $(OBJCOPY) --strip-debug
615 $(srctree)/scripts/strip-symbols --wildcard 618ifeq ($(CONFIG_KALLSYMS_ALL),$(CONFIG_KALLSYMS_STRIP_GENERATED))
619mod_strip_cmd += --wildcard $(addprefix --strip-symbols ,$(strip-symbols))
620endif
616else 621else
617mod_strip_cmd = $(OBJCOPY) $(INSTALL_MOD_STRIP) 622mod_strip_cmd = $(OBJCOPY) $(INSTALL_MOD_STRIP)
618endif # INSTALL_MOD_STRIP=1 623endif # INSTALL_MOD_STRIP=1
@@ -747,6 +752,7 @@ last_kallsyms := 2
747endif 752endif
748 753
749kallsyms.o := .tmp_kallsyms$(last_kallsyms).o 754kallsyms.o := .tmp_kallsyms$(last_kallsyms).o
755kallsyms.h := $(wildcard include/config/kallsyms/*.h) $(wildcard include/config/kallsyms/*/*.h)
750 756
751define verify_kallsyms 757define verify_kallsyms
752 $(Q)$(if $($(quiet)cmd_sysmap), \ 758 $(Q)$(if $($(quiet)cmd_sysmap), \
@@ -771,24 +777,41 @@ endef
771 777
772# Generate .S file with all kernel symbols 778# Generate .S file with all kernel symbols
773quiet_cmd_kallsyms = KSYM $@ 779quiet_cmd_kallsyms = KSYM $@
774 cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) \ 780 cmd_kallsyms = { test $* -eq 0 || $(NM) -n $<; } \
775 $(if $(CONFIG_KALLSYMS_ALL),--all-symbols) > $@ 781 | $(KALLSYMS) $(if $(CONFIG_KALLSYMS_ALL),--all-symbols) >$@
776 782
777.tmp_kallsyms1.o .tmp_kallsyms2.o .tmp_kallsyms3.o: %.o: %.S scripts FORCE 783quiet_cmd_kstrip = STRIP $@
784 cmd_kstrip = $(OBJCOPY) --wildcard $(addprefix --strip$(if $(CONFIG_RELOCATABLE),-unneeded)-symbols ,$(filter %/scripts/strip-symbols,$^)) $< $@
785
786$(foreach n,0 1 2 3,.tmp_kallsyms$(n).o): KBUILD_AFLAGS += -Wa,--strip-local-absolute
787$(foreach n,0 1 2 3,.tmp_kallsyms$(n).o): %.o: %.S scripts FORCE
778 $(call if_changed_dep,as_o_S) 788 $(call if_changed_dep,as_o_S)
779 789
780.tmp_kallsyms%.S: .tmp_vmlinux% $(KALLSYMS) 790ifeq ($(CONFIG_KALLSYMS_STRIP_GENERATED),y)
791strip-ext := .stripped
792endif
793
794.tmp_kallsyms%.S: .tmp_vmlinux%$(strip-ext) $(KALLSYMS) $(kallsyms.h)
781 $(call cmd,kallsyms) 795 $(call cmd,kallsyms)
782 796
797# make -jN seems to have problems with intermediate files, see bug #3330.
798.SECONDARY: $(foreach n,1 2 3,.tmp_vmlinux$(n).stripped)
799.tmp_vmlinux%.stripped: .tmp_vmlinux% $(strip-symbols) $(kallsyms.h)
800 $(call cmd,kstrip)
801
802ifneq ($(CONFIG_DEBUG_INFO),y)
803.tmp_vmlinux%: LDFLAGS_vmlinux += -S
804endif
783# .tmp_vmlinux1 must be complete except kallsyms, so update vmlinux version 805# .tmp_vmlinux1 must be complete except kallsyms, so update vmlinux version
784.tmp_vmlinux1: $(vmlinux-lds) $(vmlinux-all) FORCE 806.tmp_vmlinux%: $(vmlinux-lds) $(vmlinux-all) FORCE
785 $(call if_changed_rule,ksym_ld) 807 $(if $(filter 1,$*),$(call if_changed_rule,ksym_ld),$(call if_changed,vmlinux__))
786 808
787.tmp_vmlinux2: $(vmlinux-lds) $(vmlinux-all) .tmp_kallsyms1.o FORCE 809.tmp_vmlinux0$(strip-ext):
788 $(call if_changed,vmlinux__) 810 $(Q)echo "placeholder" >$@
789 811
790.tmp_vmlinux3: $(vmlinux-lds) $(vmlinux-all) .tmp_kallsyms2.o FORCE 812.tmp_vmlinux1: .tmp_kallsyms0.o
791 $(call if_changed,vmlinux__) 813.tmp_vmlinux2: .tmp_kallsyms1.o
814.tmp_vmlinux3: .tmp_kallsyms2.o
792 815
793# Needs to visit scripts/ before $(KALLSYMS) can be used. 816# Needs to visit scripts/ before $(KALLSYMS) can be used.
794$(KALLSYMS): scripts ; 817$(KALLSYMS): scripts ;