[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251119042708.27658-1-yangtiezhu@loongson.cn>
Date: Wed, 19 Nov 2025 12:27:08 +0800
From: Tiezhu Yang <yangtiezhu@...ngson.cn>
To: Nathan Chancellor <nathan@...nel.org>,
Josh Poimboeuf <jpoimboe@...nel.org>,
Ard Biesheuvel <ardb@...nel.org>,
Huacai Chen <chenhuacai@...nel.org>
Cc: linux-kbuild@...r.kernel.org,
linux-efi@...r.kernel.org,
loongarch@...ts.linux.dev,
linux-arm-kernel@...ts.infradead.org,
linux-riscv@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v1] kbuild: Add KBUILD_VMLINUX_LIBS_PRELINK
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@...nel.org>
Signed-off-by: Tiezhu Yang <yangtiezhu@...ngson.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
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
Powered by blists - more mailing lists