public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kbuild: do not generate .tmp_vmlinux*.map when CONFIG_VMLINUX_MAP=y
@ 2025-03-13 10:26 Masahiro Yamada
  2025-03-13 10:40 ` Ard Biesheuvel
  2025-03-15  7:08 ` Masahiro Yamada
  0 siblings, 2 replies; 3+ messages in thread
From: Masahiro Yamada @ 2025-03-13 10:26 UTC (permalink / raw)
  To: linux-kbuild
  Cc: linux-kernel, Ard Biesheuvel, Rasmus Villemoes, Masahiro Yamada,
	Nathan Chancellor, Nicolas Schier

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 name of the map file.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/link-vmlinux.sh | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index e55026128e05..7cbbfa3efbca 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -98,8 +98,8 @@ vmlinux_link()
 		ldflags="${ldflags} ${wl}--strip-debug"
 	fi
 
-	if is_enabled CONFIG_VMLINUX_MAP; then
-		ldflags="${ldflags} ${wl}-Map=${output}.map"
+	if [ -n "${generate_map}" ];  then
+		ldflags="${ldflags} ${wl}-Map=vmlinux.map"
 	fi
 
 	${ld} ${ldflags} -o ${output}					\
@@ -211,6 +211,7 @@ fi
 btf_vmlinux_bin_o=
 kallsymso=
 strip_debug=
+generate_map=
 
 if is_enabled CONFIG_KALLSYMS; then
 	true > .tmp_vmlinux0.syms
@@ -279,6 +280,10 @@ fi
 
 strip_debug=
 
+if is_enabled CONFIG_VMLINUX_MAP; then
+	generate_map=1
+fi
+
 vmlinux_link "${VMLINUX}"
 
 # fill in BTF IDs
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kbuild: do not generate .tmp_vmlinux*.map when CONFIG_VMLINUX_MAP=y
  2025-03-13 10:26 [PATCH] kbuild: do not generate .tmp_vmlinux*.map when CONFIG_VMLINUX_MAP=y Masahiro Yamada
@ 2025-03-13 10:40 ` Ard Biesheuvel
  2025-03-15  7:08 ` Masahiro Yamada
  1 sibling, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2025-03-13 10:40 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-kbuild, linux-kernel, Ard Biesheuvel, Rasmus Villemoes,
	Nathan Chancellor, Nicolas Schier

On Thu, Mar 13, 2025 at 11:26 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> 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 name of the map file.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Acked-by: Ard Biesheuvel <ardb@kernel.org>

> ---
>
>  scripts/link-vmlinux.sh | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> index e55026128e05..7cbbfa3efbca 100755
> --- a/scripts/link-vmlinux.sh
> +++ b/scripts/link-vmlinux.sh
> @@ -98,8 +98,8 @@ vmlinux_link()
>                 ldflags="${ldflags} ${wl}--strip-debug"
>         fi
>
> -       if is_enabled CONFIG_VMLINUX_MAP; then
> -               ldflags="${ldflags} ${wl}-Map=${output}.map"
> +       if [ -n "${generate_map}" ];  then
> +               ldflags="${ldflags} ${wl}-Map=vmlinux.map"
>         fi
>
>         ${ld} ${ldflags} -o ${output}                                   \
> @@ -211,6 +211,7 @@ fi
>  btf_vmlinux_bin_o=
>  kallsymso=
>  strip_debug=
> +generate_map=
>
>  if is_enabled CONFIG_KALLSYMS; then
>         true > .tmp_vmlinux0.syms
> @@ -279,6 +280,10 @@ fi
>
>  strip_debug=
>
> +if is_enabled CONFIG_VMLINUX_MAP; then
> +       generate_map=1
> +fi
> +
>  vmlinux_link "${VMLINUX}"
>
>  # fill in BTF IDs
> --
> 2.43.0
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kbuild: do not generate .tmp_vmlinux*.map when CONFIG_VMLINUX_MAP=y
  2025-03-13 10:26 [PATCH] kbuild: do not generate .tmp_vmlinux*.map when CONFIG_VMLINUX_MAP=y Masahiro Yamada
  2025-03-13 10:40 ` Ard Biesheuvel
@ 2025-03-15  7:08 ` Masahiro Yamada
  1 sibling, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2025-03-15  7:08 UTC (permalink / raw)
  To: linux-kbuild
  Cc: linux-kernel, Ard Biesheuvel, Rasmus Villemoes, Nathan Chancellor,
	Nicolas Schier

On Thu, Mar 13, 2025 at 7:26 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> 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.

I fixed this typo:

.tmp_vmlinux.map*  -> .tmp_vmlinux*.map


>
> 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 name of the map file.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---

Inserted before Ard's patch set.




-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-03-15  7:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-13 10:26 [PATCH] kbuild: do not generate .tmp_vmlinux*.map when CONFIG_VMLINUX_MAP=y Masahiro Yamada
2025-03-13 10:40 ` Ard Biesheuvel
2025-03-15  7:08 ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox