diff options
-rw-r--r-- | Makefile | 22 | ||||
-rw-r--r-- | scripts/Makefile.modpost | 4 | ||||
-rw-r--r-- | scripts/mod/modpost.c | 3 |
3 files changed, 23 insertions, 6 deletions
@@ -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 |
618 | quiet_cmd_vmlinux_version = GEN .version | 618 | quiet_cmd_vmlinux_version = GEN .version |
@@ -736,15 +736,31 @@ debug_kallsyms: .tmp_map$(last_kallsyms) | |||
736 | 736 | ||
737 | endif # ifdef CONFIG_KALLSYMS | 737 | endif # 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. | ||
741 | quiet_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 ,$^) | ||
745 | define 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 | ||
750 | endef | ||
751 | |||
739 | # vmlinux image - including updated kernel symbols | 752 | # vmlinux image - including updated kernel symbols |
740 | vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE | 753 | vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) vmlinux.o FORCE |
741 | ifdef CONFIG_HEADERS_CHECK | 754 | ifdef CONFIG_HEADERS_CHECK |
742 | $(Q)$(MAKE) -f $(srctree)/Makefile headers_check | 755 | $(Q)$(MAKE) -f $(srctree)/Makefile headers_check |
743 | endif | 756 | endif |
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 | ||
761 | vmlinux.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 | ||
72 | quiet_cmd_kernel-mod = MODPOST $@ | 72 | quiet_cmd_kernel-mod = MODPOST $@ |
73 | cmd_kernel-mod = $(cmd_modpost) $(KBUILD_VMLINUX_OBJS) | 73 | cmd_kernel-mod = $(cmd_modpost) $@ |
74 | 74 | ||
75 | PHONY += vmlinux | 75 | PHONY += vmlinux |
76 | vmlinux: FORCE | 76 | vmlinux.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 | ||
81 | void *do_nofail(void *ptr, const char *expr) | 82 | void *do_nofail(void *ptr, const char *expr) |