All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>,
	Ard Biesheuvel <ardb@kernel.org>,
	Huacai Chen <chenhuacai@kernel.org>,
	linux-kbuild@vger.kernel.org, linux-efi@vger.kernel.org,
	loongarch@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] kbuild: Add KBUILD_VMLINUX_LIBS_PRELINK
Date: Fri, 21 Nov 2025 00:01:40 -0700	[thread overview]
Message-ID: <20251121070140.GA780042@ax162> (raw)
In-Reply-To: <20251119042708.27658-1-yangtiezhu@loongson.cn>

On Wed, Nov 19, 2025 at 12:27:08PM +0800, Tiezhu Yang wrote:
> In order to only link libstub to the final vmlinux, it can not use the
> current KBUILD_VMLINUX_LIBS, just add KBUILD_VMLINUX_LIBS_PRELINK. This
> is preparation for later patch, no functionality change.
> 
> Link: https://lore.kernel.org/lkml/pq4h7jgndnt6p45lj4kgubxjd5gidfetugcuf5rcxzxxanzetd@6rrlpjnjsmuy/
> Suggested-by: Josh Poimboeuf <jpoimboe@kernel.org>
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
> There is a long discussion in the previous patch:
> https://lore.kernel.org/lkml/20250928085506.4471-1-yangtiezhu@loongson.cn/
> 
> This version is based on 6.18-rc6, split the generic parts out
> into a separate patch to avoid merge conflicts, the other parts
> will send out after the merge window.
> 
>  Makefile                | 1 +
>  scripts/link-vmlinux.sh | 5 ++---
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index d763c2c75cdb..69485f47b794 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1199,6 +1199,7 @@ KBUILD_VMLINUX_OBJS := built-in.a $(patsubst %/, %/lib.a, $(filter %/, $(libs-y)
>  KBUILD_VMLINUX_LIBS := $(filter-out %/, $(libs-y))
>  
>  export KBUILD_VMLINUX_LIBS
> +export KBUILD_VMLINUX_LIBS_PRELINK

This variable name is a little confusing to me since they do get added
to vmlinux during linking, not before. I am not sure of a better one
though, maybe KBUILD_VMLINUX_LIBS_FINAL? It may also make sense to
introduce similar syntax to the existing libs-y syntax, maybe

  final-libs-y

or something like that?

Also, since these objects are no longer in KBUILD_VMLINUX_LIBS, does
this new variable need to be added to any of the other places in the
build system that use KBUILD_VMLINUX_LIBS for things such as build
dependencies?

>  export KBUILD_LDS          := arch/$(SRCARCH)/kernel/vmlinux.lds
>  
>  ifdef CONFIG_TRIM_UNUSED_KSYMS
> diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> index 433849ff7529..e72d3254b93f 100755
> --- a/scripts/link-vmlinux.sh
> +++ b/scripts/link-vmlinux.sh
> @@ -61,12 +61,11 @@ vmlinux_link()
>  	shift
>  
>  	if is_enabled CONFIG_LTO_CLANG || is_enabled CONFIG_X86_KERNEL_IBT; then
> -		# Use vmlinux.o instead of performing the slow LTO link again.
>  		objs=vmlinux.o
> -		libs=
> +		libs="${KBUILD_VMLINUX_LIBS_PRELINK}"
>  	else
>  		objs=vmlinux.a
> -		libs="${KBUILD_VMLINUX_LIBS}"
> +		libs="${KBUILD_VMLINUX_LIBS} ${KBUILD_VMLINUX_LIBS_PRELINK}"
>  	fi
>  
>  	if is_enabled CONFIG_GENERIC_BUILTIN_DTB; then
> -- 
> 2.42.0
> 


WARNING: multiple messages have this Message-ID (diff)
From: Nathan Chancellor <nathan@kernel.org>
To: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>,
	Ard Biesheuvel <ardb@kernel.org>,
	Huacai Chen <chenhuacai@kernel.org>,
	linux-kbuild@vger.kernel.org, linux-efi@vger.kernel.org,
	loongarch@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] kbuild: Add KBUILD_VMLINUX_LIBS_PRELINK
Date: Fri, 21 Nov 2025 00:01:40 -0700	[thread overview]
Message-ID: <20251121070140.GA780042@ax162> (raw)
In-Reply-To: <20251119042708.27658-1-yangtiezhu@loongson.cn>

On Wed, Nov 19, 2025 at 12:27:08PM +0800, Tiezhu Yang wrote:
> In order to only link libstub to the final vmlinux, it can not use the
> current KBUILD_VMLINUX_LIBS, just add KBUILD_VMLINUX_LIBS_PRELINK. This
> is preparation for later patch, no functionality change.
> 
> Link: https://lore.kernel.org/lkml/pq4h7jgndnt6p45lj4kgubxjd5gidfetugcuf5rcxzxxanzetd@6rrlpjnjsmuy/
> Suggested-by: Josh Poimboeuf <jpoimboe@kernel.org>
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
> There is a long discussion in the previous patch:
> https://lore.kernel.org/lkml/20250928085506.4471-1-yangtiezhu@loongson.cn/
> 
> This version is based on 6.18-rc6, split the generic parts out
> into a separate patch to avoid merge conflicts, the other parts
> will send out after the merge window.
> 
>  Makefile                | 1 +
>  scripts/link-vmlinux.sh | 5 ++---
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index d763c2c75cdb..69485f47b794 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1199,6 +1199,7 @@ KBUILD_VMLINUX_OBJS := built-in.a $(patsubst %/, %/lib.a, $(filter %/, $(libs-y)
>  KBUILD_VMLINUX_LIBS := $(filter-out %/, $(libs-y))
>  
>  export KBUILD_VMLINUX_LIBS
> +export KBUILD_VMLINUX_LIBS_PRELINK

This variable name is a little confusing to me since they do get added
to vmlinux during linking, not before. I am not sure of a better one
though, maybe KBUILD_VMLINUX_LIBS_FINAL? It may also make sense to
introduce similar syntax to the existing libs-y syntax, maybe

  final-libs-y

or something like that?

Also, since these objects are no longer in KBUILD_VMLINUX_LIBS, does
this new variable need to be added to any of the other places in the
build system that use KBUILD_VMLINUX_LIBS for things such as build
dependencies?

>  export KBUILD_LDS          := arch/$(SRCARCH)/kernel/vmlinux.lds
>  
>  ifdef CONFIG_TRIM_UNUSED_KSYMS
> diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> index 433849ff7529..e72d3254b93f 100755
> --- a/scripts/link-vmlinux.sh
> +++ b/scripts/link-vmlinux.sh
> @@ -61,12 +61,11 @@ vmlinux_link()
>  	shift
>  
>  	if is_enabled CONFIG_LTO_CLANG || is_enabled CONFIG_X86_KERNEL_IBT; then
> -		# Use vmlinux.o instead of performing the slow LTO link again.
>  		objs=vmlinux.o
> -		libs=
> +		libs="${KBUILD_VMLINUX_LIBS_PRELINK}"
>  	else
>  		objs=vmlinux.a
> -		libs="${KBUILD_VMLINUX_LIBS}"
> +		libs="${KBUILD_VMLINUX_LIBS} ${KBUILD_VMLINUX_LIBS_PRELINK}"
>  	fi
>  
>  	if is_enabled CONFIG_GENERIC_BUILTIN_DTB; then
> -- 
> 2.42.0
> 

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2025-11-21  7:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-19  4:27 [PATCH v1] kbuild: Add KBUILD_VMLINUX_LIBS_PRELINK Tiezhu Yang
2025-11-19  4:27 ` Tiezhu Yang
2025-11-21  7:01 ` Nathan Chancellor [this message]
2025-11-21  7:01   ` Nathan Chancellor
2025-11-21 18:42   ` Josh Poimboeuf
2025-11-21 18:42     ` Josh Poimboeuf
2025-11-22  0:01     ` Nathan Chancellor
2025-11-22  0:01       ` Nathan Chancellor
2025-11-22  1:35 ` Nathan Chancellor
2025-11-22  1:35   ` Nathan Chancellor
2025-11-22 11:26   ` Tiezhu Yang
2025-11-22 11:26     ` Tiezhu Yang
2025-11-23 21:15     ` Nathan Chancellor
2025-11-23 21:15       ` Nathan Chancellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251121070140.GA780042@ax162 \
    --to=nathan@kernel.org \
    --cc=ardb@kernel.org \
    --cc=chenhuacai@kernel.org \
    --cc=jpoimboe@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=loongarch@lists.linux.dev \
    --cc=yangtiezhu@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.