History

kbuild: Parameterize kallsyms generation and correct reporting

When kallsyms generation happens, temporary vmlinux outputs are linked but the quiet make output didn't report it, giving the impression that the prior command is taking longer than expected. Instead, report the linking step explicitly. While at it, this consolidates the repeated "kallsyms generation step" into a single function and removes the existing copy/pasting.

Kees Cook committed 7 years ago

Commit 8959e391 parent c7c0eec1 file · +19 −19Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/link-vmlinux.sh+19−19
@@ -60,6 +60,7 @@ modpost_link() · 59 unmodified lines
6060 # ${2} - output file
6161 vmlinux_link()
6262 {
63+ info LD ${2}
6364 local lds="${objtree}/${KBUILD_LDS}"
6465 local objects
6566
@@ -138,6 +139,18 @@ kallsyms() · 72 unmodified lines
138139 ${CC} ${aflags} -c -o ${2} ${afile}
139140 }
140141
142+# Perform one step in kallsyms generation, including temporary linking of
143+# vmlinux.
144+kallsyms_step()
145+{
146+ kallsymso_prev=${kallsymso}
147+ kallsymso=.tmp_kallsyms${1}.o
148+ kallsyms_vmlinux=.tmp_vmlinux${1}
149+
150+ vmlinux_link "${kallsymso_prev}" ${kallsyms_vmlinux}
151+ kallsyms ${kallsyms_vmlinux} ${kallsymso}
152+}
153+
141154 # Create map file with all symbols from ${1}
142155 # See mksymap for additional details
143156 mksysmap()
@@ -216,6 +229,7 @@ info MODINFO modules.builtin.modinfo · 72 unmodified lines
216229 ${OBJCOPY} -j .modinfo -O binary vmlinux.o modules.builtin.modinfo
217230
218231 kallsymso=""
232+kallsymso_prev=""
219233 kallsyms_vmlinux=""
220234 if [ -n "${CONFIG_KALLSYMS}" ]; then
221235
@@ -242,32 +256,18 @@ if [ -n "${CONFIG_KALLSYMS}" ]; then · 20 unmodified lines
242256 # a) Verify that the System.map from vmlinux matches the map from
243257 # ${kallsymso}.
244258
245− kallsymso=.tmp_kallsyms2.o
246− kallsyms_vmlinux=.tmp_vmlinux2
247−
248− # step 1
249− vmlinux_link "" .tmp_vmlinux1
250− kallsyms .tmp_vmlinux1 .tmp_kallsyms1.o
251−
252− # step 2
253− vmlinux_link .tmp_kallsyms1.o .tmp_vmlinux2
254− kallsyms .tmp_vmlinux2 .tmp_kallsyms2.o
259+ kallsyms_step 1
260+ kallsyms_step 2
255261
256262 # step 3
257− size1=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" .tmp_kallsyms1.o)
258− size2=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" .tmp_kallsyms2.o)
263+ size1=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso_prev})
264+ size2=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso})
259265
260266 if [ $size1 -ne $size2 ] || [ -n "${KALLSYMS_EXTRA_PASS}" ]; then
261− kallsymso=.tmp_kallsyms3.o
262− kallsyms_vmlinux=.tmp_vmlinux3
263−
264− vmlinux_link .tmp_kallsyms2.o .tmp_vmlinux3
265−
266− kallsyms .tmp_vmlinux3 .tmp_kallsyms3.o
267+ kallsyms_step 3
267268 fi
268269 fi
269270
270−info LD vmlinux
271271 vmlinux_link "${kallsymso}" vmlinux
272272
273273 if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then