Skip to content

Commit ba4d705

Browse files
committed
kbuild: do not generate .tmp_vmlinux*.map when CONFIG_VMLINUX_MAP=y
Commit 5cc1247 ("kbuild: add CONFIG_VMLINUX_MAP expert option") mentioned that "the .map file can be rather large (several MB), and that's a waste of space when one isn't interested in these things." If that is the case, generating map files for the intermediate tmp_vmlinux* files is also a waste of space. It is unlikely that anyone would be interested in the .tmp_vmlinux*.map files. This commit stops passing the -Map= option when linking the .tmp_vmlinux* intermediates. I also hard-coded the file name 'vmlinux.map' instead of ${output}.map because a later commit will introduce vmlinux.unstripped but I want to keep the current name of the map file. Signed-off-by: Masahiro Yamada <[email protected]> Acked-by: Ard Biesheuvel <[email protected]>
1 parent 479fde4 commit ba4d705

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

scripts/link-vmlinux.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ vmlinux_link()
9797
ldflags="${ldflags} ${wl}--strip-debug"
9898
fi
9999

100-
if is_enabled CONFIG_VMLINUX_MAP; then
101-
ldflags="${ldflags} ${wl}-Map=${output}.map"
100+
if [ -n "${generate_map}" ]; then
101+
ldflags="${ldflags} ${wl}-Map=vmlinux.map"
102102
fi
103103

104104
${ld} ${ldflags} -o ${output} \
@@ -210,6 +210,7 @@ fi
210210
btf_vmlinux_bin_o=
211211
kallsymso=
212212
strip_debug=
213+
generate_map=
213214

214215
if is_enabled CONFIG_KALLSYMS; then
215216
true > .tmp_vmlinux0.syms
@@ -278,6 +279,10 @@ fi
278279

279280
strip_debug=
280281

282+
if is_enabled CONFIG_VMLINUX_MAP; then
283+
generate_map=1
284+
fi
285+
281286
vmlinux_link vmlinux
282287

283288
# fill in BTF IDs

0 commit comments

Comments
 (0)