]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
kbuild,objtool: Defer objtool validation step for CONFIG_KLP_BUILD
authorJosh Poimboeuf <jpoimboe@kernel.org>
Wed, 17 Sep 2025 16:04:05 +0000 (09:04 -0700)
committerJosh Poimboeuf <jpoimboe@kernel.org>
Tue, 14 Oct 2025 21:50:19 +0000 (14:50 -0700)
In preparation for klp-build, defer objtool validation for
CONFIG_KLP_BUILD kernels until the final pre-link archive (e.g.,
vmlinux.o, module-foo.o) is built.  This will simplify the process of
generating livepatch modules.

Delayed objtool is generally preferred anyway, and is already standard
for IBT and LTO.  Eventually the per-translation-unit mode will be
phased out.

Acked-by: Petr Mladek <pmladek@suse.com>
Tested-by: Joe Lawrence <joe.lawrence@redhat.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
scripts/Makefile.lib
scripts/link-vmlinux.sh

index 15fee73e9289554e2f6896d5edd283c8837ff733..28a1c08e3b221e7e4e967d64a051f6f684140b2d 100644 (file)
@@ -197,7 +197,7 @@ objtool-args = $(objtool-args-y)                                    \
        $(if $(delay-objtool), --link)                                  \
        $(if $(part-of-module), --module)
 
-delay-objtool := $(or $(CONFIG_LTO_CLANG),$(CONFIG_X86_KERNEL_IBT))
+delay-objtool := $(or $(CONFIG_LTO_CLANG),$(CONFIG_X86_KERNEL_IBT),$(CONFIG_KLP_BUILD))
 
 cmd_objtool = $(if $(objtool-enabled), ; $(objtool) $(objtool-args) $@)
 cmd_gen_objtooldep = $(if $(objtool-enabled), { echo ; echo '$@: $$(wildcard $(objtool))' ; } >> $(dot-target).cmd)
index 433849ff7529e1fb8bb24e01163455844c8a4c88..2df714ba51a9e0d7eca1c55ac9c37a227e645754 100755 (executable)
@@ -60,7 +60,8 @@ vmlinux_link()
        # skip output file argument
        shift
 
-       if is_enabled CONFIG_LTO_CLANG || is_enabled CONFIG_X86_KERNEL_IBT; then
+       if is_enabled CONFIG_LTO_CLANG || is_enabled CONFIG_X86_KERNEL_IBT ||
+          is_enabled CONFIG_KLP_BUILD; then
                # Use vmlinux.o instead of performing the slow LTO link again.
                objs=vmlinux.o
                libs=