diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 47 |
1 files changed, 35 insertions, 12 deletions
@@ -604,6 +604,9 @@ export INSTALL_PATH ?= /boot | |||
604 | MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) | 604 | MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) |
605 | export MODLIB | 605 | export MODLIB |
606 | 606 | ||
607 | strip-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. |
612 | ifdef INSTALL_MOD_STRIP | 615 | ifdef INSTALL_MOD_STRIP |
613 | ifeq ($(INSTALL_MOD_STRIP),1) | 616 | ifeq ($(INSTALL_MOD_STRIP),1) |
614 | mod_strip_cmd = $(OBJCOPY) --strip-debug --strip-symbols \ | 617 | mod_strip_cmd = $(OBJCOPY) --strip-debug |
615 | $(srctree)/scripts/strip-symbols --wildcard | 618 | ifeq ($(CONFIG_KALLSYMS_ALL),$(CONFIG_KALLSYMS_STRIP_GENERATED)) |
619 | mod_strip_cmd += --wildcard $(addprefix --strip-symbols ,$(strip-symbols)) | ||
620 | endif | ||
616 | else | 621 | else |
617 | mod_strip_cmd = $(OBJCOPY) $(INSTALL_MOD_STRIP) | 622 | mod_strip_cmd = $(OBJCOPY) $(INSTALL_MOD_STRIP) |
618 | endif # INSTALL_MOD_STRIP=1 | 623 | endif # INSTALL_MOD_STRIP=1 |
@@ -747,6 +752,7 @@ last_kallsyms := 2 | |||
747 | endif | 752 | endif |
748 | 753 | ||
749 | kallsyms.o := .tmp_kallsyms$(last_kallsyms).o | 754 | kallsyms.o := .tmp_kallsyms$(last_kallsyms).o |
755 | kallsyms.h := $(wildcard include/config/kallsyms/*.h) $(wildcard include/config/kallsyms/*/*.h) | ||
750 | 756 | ||
751 | define verify_kallsyms | 757 | define 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 |
773 | quiet_cmd_kallsyms = KSYM $@ | 779 | quiet_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 | 783 | quiet_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) | 790 | ifeq ($(CONFIG_KALLSYMS_STRIP_GENERATED),y) |
791 | strip-ext := .stripped | ||
792 | endif | ||
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 | |||
802 | ifneq ($(CONFIG_DEBUG_INFO),y) | ||
803 | .tmp_vmlinux%: LDFLAGS_vmlinux += -S | ||
804 | endif | ||
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 ; |