[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAEf4BzZ4JvrnXYdE7YP06b574b5QKiU-asy_jtnP=JGH-5uR3g@mail.gmail.com>
Date: Thu, 30 May 2024 14:17:22 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Masahiro Yamada <masahiroy@...nel.org>
Cc: linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
bpf@...r.kernel.org, Ard Biesheuvel <ardb@...nel.org>,
Nathan Chancellor <nathan@...nel.org>, Nicolas Schier <nicolas@...sle.eu>
Subject: Re: [PATCH 3/3] kbuild: merge temp vmlinux for CONFIG_DEBUG_INFO_BTF
and CONFIG_KALLSYMS
On Wed, May 22, 2024 at 4:48 AM Masahiro Yamada <masahiroy@...nel.org> wrote:
>
> CONFIG_DEBUG_INFO_BTF=y requires one additional link step.
> (.tmp_vmlinux.btf)
>
> CONFIG_KALLSYMS=y requires two additional link steps.
> (.tmp_vmlinux.kallsyms1 and .tmp_vmlinux.kallsyms2)
>
> Enabling both requires three additional link steps.
>
> When CONFIG_DEBUG_INFO_BTF=y and CONFIG_KALLSYMS=y, the build step looks
> as follows:
>
> KSYMS .tmp_vmlinux.kallsyms0.S
> AS .tmp_vmlinux.kallsyms0.o
> LD .tmp_vmlinux.btf # temp vmlinux for BTF
> BTF .btf.vmlinux.bin.o
> LD .tmp_vmlinux.kallsyms1 # temp vmlinux for kallsyms step 1
> NM .tmp_vmlinux.kallsyms1.syms
> KSYMS .tmp_vmlinux.kallsyms1.S
> AS .tmp_vmlinux.kallsyms1.o
> LD .tmp_vmlinux.kallsyms2 # temp vmlinux for kallsyms step 2
> NM .tmp_vmlinux.kallsyms2.syms
> KSYMS .tmp_vmlinux.kallsyms2.S
> AS .tmp_vmlinux.kallsyms2.o
> LD vmlinux # final vmlinux
>
> This is redundant because the BTF generation and the kallsyms step 1 can
> be performed against the same temporary vmlinux.
>
> When both CONFIG_DEBUG_INFO_BTF and CONFIG_KALLSYMS are enabled, we can
> reduce the number of link steps.
>
> The build step will look as follows:
>
> KSYMS .tmp_vmlinux0.kallsyms.S
> AS .tmp_vmlinux0.kallsyms.o
> LD .tmp_vmlinux1 # temp vmlinux for BTF and kallsyms step 1
> BTF .tmp_vmlinux1.btf.o
> NM .tmp_vmlinux1.syms
> KSYMS .tmp_vmlinux1.kallsyms.S
> AS .tmp_vmlinux1.kallsyms.o
> LD .tmp_vmlinux2 # temp vmlinux for kallsyms step 2
> NM .tmp_vmlinux2.syms
> KSYMS .tmp_vmlinux2.kallsyms.S
> AS .tmp_vmlinux2.kallsyms.o
> LD vmlinux # final link
>
> Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
> ---
>
LGTM, thanks!
Acked-by: Andrii Nakryiko <andrii@...nel.org>
> scripts/link-vmlinux.sh | 45 +++++++++++++++++++++--------------------
> 1 file changed, 23 insertions(+), 22 deletions(-)
>
[...]
Powered by blists - more mailing lists