aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile22
-rw-r--r--scripts/Makefile.modpost4
-rw-r--r--scripts/mod/modpost.c3
3 files changed, 23 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index ddbfcac299c1..4f0bd65a38d8 100644
--- a/Makefile
+++ b/Makefile
@@ -612,7 +612,7 @@ quiet_cmd_vmlinux__ ?= LD $@
612 cmd_vmlinux__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) -o $@ \ 612 cmd_vmlinux__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) -o $@ \
613 -T $(vmlinux-lds) $(vmlinux-init) \ 613 -T $(vmlinux-lds) $(vmlinux-init) \
614 --start-group $(vmlinux-main) --end-group \ 614 --start-group $(vmlinux-main) --end-group \
615 $(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) FORCE ,$^) 615 $(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) vmlinux.o FORCE ,$^)
616 616
617# Generate new vmlinux version 617# Generate new vmlinux version
618quiet_cmd_vmlinux_version = GEN .version 618quiet_cmd_vmlinux_version = GEN .version
@@ -736,15 +736,31 @@ debug_kallsyms: .tmp_map$(last_kallsyms)
736 736
737endif # ifdef CONFIG_KALLSYMS 737endif # ifdef CONFIG_KALLSYMS
738 738
739# Do modpost on a prelinked vmlinux. The finally linked vmlinux has
740# relevant sections renamed as per the linker script.
741quiet_cmd_vmlinux-modpost = LD $@
742 cmd_vmlinux-modpost = $(LD) $(LDFLAGS) -r -o $@ \
743 $(vmlinux-init) --start-group $(vmlinux-main) --end-group \
744 $(filter-out $(vmlinux-init) $(vmlinux-main) $(vmlinux-lds) FORCE ,$^)
745define rule_vmlinux-modpost
746 :
747 +$(call cmd,vmlinux-modpost)
748 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $@
749 $(Q)echo 'cmd_$@ := $(cmd_vmlinux-modpost)' > $(dot-target).cmd
750endef
751
739# vmlinux image - including updated kernel symbols 752# vmlinux image - including updated kernel symbols
740vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE 753vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) vmlinux.o FORCE
741ifdef CONFIG_HEADERS_CHECK 754ifdef CONFIG_HEADERS_CHECK
742 $(Q)$(MAKE) -f $(srctree)/Makefile headers_check 755 $(Q)$(MAKE) -f $(srctree)/Makefile headers_check
743endif 756endif
757 $(call vmlinux-modpost)
744 $(call if_changed_rule,vmlinux__) 758 $(call if_changed_rule,vmlinux__)
745 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $@
746 $(Q)rm -f .old_version 759 $(Q)rm -f .old_version
747 760
761vmlinux.o: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE
762 $(call if_changed_rule,vmlinux-modpost)
763
748# The actual objects are generated when descending, 764# The actual objects are generated when descending,
749# make sure no implicit rule kicks in 765# make sure no implicit rule kicks in
750$(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ; 766$(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ;
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index d5bbbcce31ef..c6fcc597b3be 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -70,10 +70,10 @@ __modpost: $(modules:.ko=.o) FORCE
70 $(call cmd,modpost) $(wildcard vmlinux) $(filter-out FORCE,$^) 70 $(call cmd,modpost) $(wildcard vmlinux) $(filter-out FORCE,$^)
71 71
72quiet_cmd_kernel-mod = MODPOST $@ 72quiet_cmd_kernel-mod = MODPOST $@
73 cmd_kernel-mod = $(cmd_modpost) $(KBUILD_VMLINUX_OBJS) 73 cmd_kernel-mod = $(cmd_modpost) $@
74 74
75PHONY += vmlinux 75PHONY += vmlinux
76vmlinux: FORCE 76vmlinux.o: FORCE
77 $(call cmd,kernel-mod) 77 $(call cmd,kernel-mod)
78 78
79# Declare generated files as targets for modpost 79# Declare generated files as targets for modpost
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index bb895b13c170..ec036c261fb1 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -75,7 +75,8 @@ static int is_vmlinux(const char *modname)
75 else 75 else
76 myname = modname; 76 myname = modname;
77 77
78 return strcmp(myname, "vmlinux") == 0; 78 return (strcmp(myname, "vmlinux") == 0) ||
79 (strcmp(myname, "vmlinux.o") == 0);
79} 80}
80 81
81void *do_nofail(void *ptr, const char *expr) 82void *do_nofail(void *ptr, const char *expr)