File tree Expand file tree Collapse file tree 3 files changed +29
-21
lines changed Expand file tree Collapse file tree 3 files changed +29
-21
lines changed Original file line number Diff line number Diff line change @@ -1477,7 +1477,7 @@ endif # CONFIG_MODULES
14771477# Directories & files removed with 'make clean'
14781478CLEAN_FILES += include/ksym vmlinux.symvers modules-only.symvers \
14791479 modules.builtin modules.builtin.modinfo modules.nsdeps \
1480- compile_commands.json .thinlto-cache
1480+ compile_commands.json .thinlto-cache .vmlinux.objs
14811481
14821482# Directories & files removed with 'make mrproper'
14831483MRPROPER_FILES += include/config include/generated \
Original file line number Diff line number Diff line change @@ -57,6 +57,32 @@ vmlinux.symvers: vmlinux.o
5757
5858__modpost: vmlinux.symvers
5959
60+ # Generate the list of in-tree objects in vmlinux
61+ # ---------------------------------------------------------------------------
62+
63+ # This is used to retrieve symbol versions generated by genksyms.
64+ ifdef CONFIG_MODVERSIONS
65+ vmlinux.symvers: .vmlinux.objs
66+ endif
67+
68+ # Ignore libgcc.a
69+ # Some architectures do '$(CC) --print-libgcc-file-name' to borrow libgcc.a
70+ # from the toolchain, but there is no EXPORT_SYMBOL in it.
71+
72+ quiet_cmd_vmlinux_objs = GEN $@
73+ cmd_vmlinux_objs = \
74+ for f in $(real-prereqs); do \
75+ case $${f} in \
76+ *libgcc.a) ;; \
77+ *.a) $(AR) t $${f} ;; \
78+ *) echo $${f} ;; \
79+ esac \
80+ done > $@
81+
82+ targets += .vmlinux.objs
83+ .vmlinux.objs: $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS) FORCE
84+ $(call if_changed,vmlinux_objs)
85+
6086else
6187
6288ifeq ($(KBUILD_EXTMOD),)
@@ -134,13 +160,13 @@ ifneq ($(KBUILD_MODPOST_NOFINAL),1)
134160 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal
135161endif
136162
163+ endif
164+
137165PHONY += FORCE
138166FORCE:
139167
140168existing-targets := $(wildcard $(sort $(targets)))
141169
142170-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
143171
144- endif
145-
146172.PHONY: $(PHONY)
Original file line number Diff line number Diff line change @@ -199,7 +199,6 @@ cleanup()
199199 rm -f System.map
200200 rm -f vmlinux
201201 rm -f vmlinux.map
202- rm -f .vmlinux.objs
203202 rm -f .vmlinux.export.c
204203}
205204
218217# link vmlinux.o
219218${MAKE} -f " ${srctree} /scripts/Makefile.vmlinux_o"
220219
221- # Generate the list of in-tree objects in vmlinux
222- #
223- # This is used to retrieve symbol versions generated by genksyms.
224- for f in ${KBUILD_VMLINUX_OBJS} ${KBUILD_VMLINUX_LIBS} ; do
225- case ${f} in
226- * libgcc.a)
227- # Some architectures do '$(CC) --print-libgcc-file-name' to
228- # borrow libgcc.a from the toolchain.
229- # There is no EXPORT_SYMBOL in external objects. Ignore this.
230- ;;
231- * .a)
232- ${AR} t ${f} ;;
233- * )
234- echo ${f} ;;
235- esac
236- done > .vmlinux.objs
237-
238220# modpost vmlinux.o to check for section mismatches
239221${MAKE} -f " ${srctree} /scripts/Makefile.modpost" MODPOST_VMLINUX=1
240222
You can’t perform that action at this time.
0 commit comments