History

kbuild: do not generate .tmp_vmlinux*.map when CONFIG_VMLINUX_MAP=y

Commit 5cc124720461 ("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.

Masahiro Yamada committed 1 year ago

Commit ba4d7051 parent 479fde41 file · +7 −2Browse files

Unified · Split

scripts/link-vmlinux.sh+7−2
@@ -97,8 +97,8 @@ vmlinux_link() · 96 unmodified lines
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 · 105 unmodified lines
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 · 62 unmodified lines
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