summaryrefslogtreecommitdiffstats
path: root/scripts/link-vmlinux.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/link-vmlinux.sh')
-rwxr-xr-xscripts/link-vmlinux.sh40
1 files changed, 21 insertions, 19 deletions
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index 8c59970a09dc..06495379fcd8 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -64,6 +64,8 @@ vmlinux_link()
64 local output=${1} 64 local output=${1}
65 local objects 65 local objects
66 66
67 info LD ${output}
68
67 # skip output file argument 69 # skip output file argument
68 shift 70 shift
69 71
@@ -157,6 +159,18 @@ kallsyms()
157 ${CC} ${aflags} -c -o ${2} ${afile} 159 ${CC} ${aflags} -c -o ${2} ${afile}
158} 160}
159 161
162# Perform one step in kallsyms generation, including temporary linking of
163# vmlinux.
164kallsyms_step()
165{
166 kallsymso_prev=${kallsymso}
167 kallsymso=.tmp_kallsyms${1}.o
168 kallsyms_vmlinux=.tmp_vmlinux${1}
169
170 vmlinux_link ${kallsyms_vmlinux} "${kallsymso_prev}" ${btf_vmlinux_bin_o}
171 kallsyms ${kallsyms_vmlinux} ${kallsymso}
172}
173
160# Create map file with all symbols from ${1} 174# Create map file with all symbols from ${1}
161# See mksymap for additional details 175# See mksymap for additional details
162mksysmap() 176mksysmap()
@@ -243,6 +257,7 @@ if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then
243fi 257fi
244 258
245kallsymso="" 259kallsymso=""
260kallsymso_prev=""
246kallsyms_vmlinux="" 261kallsyms_vmlinux=""
247if [ -n "${CONFIG_KALLSYMS}" ]; then 262if [ -n "${CONFIG_KALLSYMS}" ]; then
248 263
@@ -269,32 +284,19 @@ if [ -n "${CONFIG_KALLSYMS}" ]; then
269 # a) Verify that the System.map from vmlinux matches the map from 284 # a) Verify that the System.map from vmlinux matches the map from
270 # ${kallsymso}. 285 # ${kallsymso}.
271 286
272 kallsymso=.tmp_kallsyms2.o 287 kallsyms_step 1
273 kallsyms_vmlinux=.tmp_vmlinux2 288 kallsyms_step 2
274
275 # step 1
276 vmlinux_link .tmp_vmlinux1 ${btf_vmlinux_bin_o}
277 kallsyms .tmp_vmlinux1 .tmp_kallsyms1.o
278
279 # step 2
280 vmlinux_link .tmp_vmlinux2 .tmp_kallsyms1.o ${btf_vmlinux_bin_o}
281 kallsyms .tmp_vmlinux2 .tmp_kallsyms2.o
282 289
283 # step 3 290 # step 3
284 size1=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" .tmp_kallsyms1.o) 291 size1=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso_prev})
285 size2=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" .tmp_kallsyms2.o) 292 size2=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso})
286 293
287 if [ $size1 -ne $size2 ] || [ -n "${KALLSYMS_EXTRA_PASS}" ]; then 294 if [ $size1 -ne $size2 ] || [ -n "${KALLSYMS_EXTRA_PASS}" ]; then
288 kallsymso=.tmp_kallsyms3.o 295 kallsyms_step 3
289 kallsyms_vmlinux=.tmp_vmlinux3
290
291 vmlinux_link .tmp_vmlinux3 .tmp_kallsyms2.o ${btf_vmlinux_bin_o}
292 kallsyms .tmp_vmlinux3 .tmp_kallsyms3.o
293 fi 296 fi
294fi 297fi
295 298
296info LD vmlinux 299vmlinux_link vmlinux "${kallsymso}" ${btf_vmlinux_bin_o}
297vmlinux_link vmlinux "${kallsymso}" "${btf_vmlinux_bin_o}"
298 300
299if [ -n "${CONFIG_BUILDTIME_EXTABLE_SORT}" ]; then 301if [ -n "${CONFIG_BUILDTIME_EXTABLE_SORT}" ]; then
300 info SORTEX vmlinux 302 info SORTEX vmlinux