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
60# ${2} - output file60# ${2} - output file
61vmlinux_link()61vmlinux_link()
62{62{
63 info LD ${2}
63 local lds="${objtree}/${KBUILD_LDS}"64 local lds="${objtree}/${KBUILD_LDS}"
64 local objects65 local objects
65 66
@@ -138,6 +139,18 @@ kallsyms() · 72 unmodified lines
138 ${CC} ${aflags} -c -o ${2} ${afile}139 ${CC} ${aflags} -c -o ${2} ${afile}
139}140}
140 141
142# Perform one step in kallsyms generation, including temporary linking of
143# vmlinux.
144kallsyms_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
141# Create map file with all symbols from ${1}154# Create map file with all symbols from ${1}
142# See mksymap for additional details155# See mksymap for additional details
143mksysmap()156mksysmap()
@@ -216,6 +229,7 @@ info MODINFO modules.builtin.modinfo · 72 unmodified lines
216${OBJCOPY} -j .modinfo -O binary vmlinux.o modules.builtin.modinfo229${OBJCOPY} -j .modinfo -O binary vmlinux.o modules.builtin.modinfo
217 230
218kallsymso=""231kallsymso=""
232kallsymso_prev=""
219kallsyms_vmlinux=""233kallsyms_vmlinux=""
220if [ -n "${CONFIG_KALLSYMS}" ]; then234if [ -n "${CONFIG_KALLSYMS}" ]; then
221 235
@@ -242,32 +256,18 @@ if [ -n "${CONFIG_KALLSYMS}" ]; then · 20 unmodified lines
242 # a) Verify that the System.map from vmlinux matches the map from256 # a) Verify that the System.map from vmlinux matches the map from
243 # ${kallsymso}.257 # ${kallsymso}.
244 258
245 kallsymso=.tmp_kallsyms2.o259 kallsyms_step 1
246 kallsyms_vmlinux=.tmp_vmlinux2260 kallsyms_step 2
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
255 261
256 # step 3262 # step 3
257 size1=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" .tmp_kallsyms1.o)263 size1=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso_prev})
258 size2=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" .tmp_kallsyms2.o)264 size2=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso})
259 265
260 if [ $size1 -ne $size2 ] || [ -n "${KALLSYMS_EXTRA_PASS}" ]; then266 if [ $size1 -ne $size2 ] || [ -n "${KALLSYMS_EXTRA_PASS}" ]; then
261 kallsymso=.tmp_kallsyms3.o267 kallsyms_step 3
262 kallsyms_vmlinux=.tmp_vmlinux3
263
264 vmlinux_link .tmp_kallsyms2.o .tmp_vmlinux3
265
266 kallsyms .tmp_vmlinux3 .tmp_kallsyms3.o
267 fi268 fi
268fi269fi
269 270
270info LD vmlinux
271vmlinux_link "${kallsymso}" vmlinux271vmlinux_link "${kallsymso}" vmlinux
272 272
273if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then273if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then