History

kbuild: move .vmlinux.objs rule to Makefile.modpost

.vmlinux.objs is used by modpost, so scripts/Makefile.modpost is a better place to generate it. It is used only when CONFIG_MODVERSIONS=y. It should be guarded by "ifdef CONFIG_MODVERSIONS".

Masahiro Yamada committed 4 years ago

Commit 26ef40d1 parent 57501213 files · +29 −21Browse files

Showing the changes to scripts (2 of 3 files). Show all

Unified · Split

2 files
  1. scripts/Makefile.modpost +28 −2
  2. scripts/link-vmlinux.sh +0 −18
scripts/Makefile.modpost+28−2
@@ -57,6 +57,32 @@ vmlinux.symvers: vmlinux.o · 56 unmodified lines
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+
6086 else
6187
6288 ifeq ($(KBUILD_EXTMOD),)
@@ -134,6 +160,8 @@ ifneq ($(KBUILD_MODPOST_NOFINAL),1) · 71 unmodified lines
134160 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal
135161 endif
136162
163+endif
164+
137165 PHONY += FORCE
138166 FORCE:
139167
@@ -141,6 +169,4 @@ existing-targets := $(wildcard $(sort $(targets))) · 1 unmodified line
141169
142170 -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
143171
144−endif
145−
146172 .PHONY: $(PHONY)
scripts/link-vmlinux.sh+0−18
@@ -199,7 +199,6 @@ cleanup() · 198 unmodified lines
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
@@ -218,23 +217,6 @@ fi · 12 unmodified lines
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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t