From: Joe Lawrence <joe.lawrence@redhat.com>
To: Song Liu <song@kernel.org>
Cc: live-patching@vger.kernel.org, jpoimboe@kernel.org,
jikos@kernel.org, mbenes@suse.cz, pmladek@suse.com,
kernel-team@meta.com
Subject: Re: [PATCH 0/8] objtool/klp: klp-build LTO support and tests
Date: Wed, 18 Feb 2026 18:00:29 -0500 [thread overview]
Message-ID: <aZZEjfxgLWTWODE7@redhat.com> (raw)
In-Reply-To: <20260212192201.3593879-1-song@kernel.org>
On Thu, Feb 12, 2026 at 11:21:53AM -0800, Song Liu wrote:
> Add support for LTO in klp-build toolchain. The key changes are to the
> symbol correlation logic.Basically, we want to:
>
> 1. Match symbols with differerent .llvm.<hash> suffixes, e.g., foo.llvm.123
> to foo.llvm.456.
> 2. Match local symbols with promoted global symbols, e.g., local foo
> with global foo.llvm.123.
>
> 1/8 and 2/8 are small cleanup/fix for existing code.
> 3/8 through 7/8 contains the core logic changes to correlate_symbols().
> 8/8 contains tests for klp-build toolchain.
>
> Song Liu (8):
> objtool/klp: Remove redundent strcmp in correlate_symbols
> objtool/klp: Remove trailing '_' in demangle_name()
> objtool/klp: Use sym->demangled_name for symbol_name hash
> objtool/klp: Also demangle global objects
> objtool/klp: Remove .llvm suffix in demangle_name()
> objtool/klp: Match symbols based on demangled_name for global
> variables
> objtool/klp: Correlate locals to globals
> livepatch: Add tests for klp-build toolchain
>
Hi Song,
One of the tests that Josh had suggested running to validate "no
changes" and git apply --recount / recountdiff was to touch most of the
.c files in the tree like so:
$ find . -type f -name '*.c' ! -path "./lib/*" -print0 | xargs -0 sed -i '1iasm("nop");'
$ git checkout tools arch/x86/lib/inat.c arch/x86/lib/insn.c kernel/configs.c
$ git diff > /tmp/oneline.patch
which results in "klp-build: no changes detected" using gcc, but with
this patchset+llvm thin-LTO results in a few c_start/c_stop/c_next
uncorrelated variables.
Here is a minimal version of a reproducer:
$ grep LTO .config
CONFIG_LTO=y
CONFIG_LTO_CLANG=y
CONFIG_ARCH_SUPPORTS_LTO_CLANG=y
CONFIG_ARCH_SUPPORTS_LTO_CLANG_THIN=y
CONFIG_HAS_LTO_CLANG=y
# CONFIG_LTO_NONE is not set
# CONFIG_LTO_CLANG_FULL is not set
CONFIG_LTO_CLANG_THIN=y
$ cat ~/min.patch
diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c
index 6571d432cbe3..96c6c8bb7228 100644
--- a/arch/x86/kernel/cpu/proc.c
+++ b/arch/x86/kernel/cpu/proc.c
@@ -1,3 +1,4 @@
+asm("nop");
// SPDX-License-Identifier: GPL-2.0
#include <linux/smp.h>
#include <linux/timex.h>
diff --git a/crypto/proc.c b/crypto/proc.c
index 82f15b967e85..1474800162bf 100644
--- a/crypto/proc.c
+++ b/crypto/proc.c
@@ -1,3 +1,4 @@
+asm("nop");
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Scatterlist Cryptographic API.
diff --git a/fs/proc/consoles.c b/fs/proc/consoles.c
index b7cab1ad990d..066e625ae14e 100644
--- a/fs/proc/consoles.c
+++ b/fs/proc/consoles.c
@@ -1,3 +1,4 @@
+asm("nop");
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2010 Werner Fink, Jiri Slaby
$ LLVM=1 ./scripts/livepatch/klp-build -T ~/min.patch
Validating patch(es)
Building original kernel
Copying original object files
Fixing patch(es)
Building patched kernel
Copying patched object files
Diffing objects
vmlinux.o: warning: objtool: correlate c_start.llvm.15251198824366928061 (origial) to c_start.llvm.14107081093236395767 (patched)
vmlinux.o: warning: objtool: correlate c_stop.llvm.15251198824366928061 (origial) to c_stop.llvm.14107081093236395767 (patched)
vmlinux.o: warning: objtool: correlate c_next.llvm.15251198824366928061 (origial) to c_next.llvm.14107081093236395767 (patched)
vmlinux.o: warning: objtool: correlate show_cpuinfo.llvm.15251198824366928061 (origial) to show_cpuinfo.llvm.10047843810948474008 (patched)
vmlinux.o: warning: objtool: correlate .str.llvm.1768504738091882651 (origial) to .str.llvm.7814622528726587167 (patched)
vmlinux.o: warning: objtool: correlate crypto_seq_ops.llvm.1768504738091882651 (origial) to crypto_seq_ops.llvm.14107081093236395767 (patched)
vmlinux.o: warning: objtool: correlate c_start.llvm.1768504738091882651 (origial) to c_start.llvm.14107081093236395767 (patched)
vmlinux.o: warning: objtool: correlate c_stop.llvm.1768504738091882651 (origial) to c_stop.llvm.14107081093236395767 (patched)
vmlinux.o: warning: objtool: correlate c_next.llvm.1768504738091882651 (origial) to c_next.llvm.14107081093236395767 (patched)
vmlinux.o: warning: objtool: correlate c_show.llvm.1768504738091882651 (origial) to c_show.llvm.14107081093236395767 (patched)
vmlinux.o: warning: objtool: correlate __pfx_c_start.llvm.15251198824366928061 (origial) to __pfx_c_start.llvm.14107081093236395767 (patched)
vmlinux.o: warning: objtool: correlate __pfx_c_stop.llvm.15251198824366928061 (origial) to __pfx_c_stop.llvm.14107081093236395767 (patched)
vmlinux.o: warning: objtool: correlate __pfx_c_next.llvm.15251198824366928061 (origial) to __pfx_c_next.llvm.14107081093236395767 (patched)
vmlinux.o: warning: objtool: correlate __pfx_show_cpuinfo.llvm.15251198824366928061 (origial) to __pfx_show_cpuinfo.llvm.10047843810948474008 (patched)
vmlinux.o: warning: objtool: correlate __pfx_c_start.llvm.1768504738091882651 (origial) to __pfx_c_start.llvm.14107081093236395767 (patched)
vmlinux.o: warning: objtool: correlate __pfx_c_stop.llvm.1768504738091882651 (origial) to __pfx_c_stop.llvm.14107081093236395767 (patched)
vmlinux.o: warning: objtool: correlate __pfx_c_next.llvm.1768504738091882651 (origial) to __pfx_c_next.llvm.14107081093236395767 (patched)
vmlinux.o: warning: objtool: correlate __pfx_c_show.llvm.1768504738091882651 (origial) to __pfx_c_show.llvm.14107081093236395767 (patched)
vmlinux.o: warning: objtool: no correlation: c_start.llvm.1768504738091882651
vmlinux.o: warning: objtool: no correlation: c_stop.llvm.1768504738091882651
vmlinux.o: warning: objtool: no correlation: c_next.llvm.1768504738091882651
vmlinux.o: new function: c_start.llvm.10047843810948474008
vmlinux.o: new function: c_stop.llvm.10047843810948474008
vmlinux.o: new function: c_next.llvm.10047843810948474008
vmlinux.o: changed function: c_start.llvm.14107081093236395767
vmlinux.o: changed function: c_stop.llvm.14107081093236395767
vmlinux.o: changed function: c_next.llvm.14107081093236395767
Building patch module: livepatch-min.ko
SUCCESS
And since we're here, it looks like there's a type:
s/origial/original/g.
--
Joe
next prev parent reply other threads:[~2026-02-18 23:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-12 19:21 [PATCH 0/8] objtool/klp: klp-build LTO support and tests Song Liu
2026-02-12 19:21 ` [PATCH 1/8] objtool/klp: Remove redundent strcmp in correlate_symbols Song Liu
2026-02-12 19:21 ` [PATCH 2/8] objtool/klp: Remove trailing '_' in demangle_name() Song Liu
2026-02-12 19:21 ` [PATCH 3/8] objtool/klp: Use sym->demangled_name for symbol_name hash Song Liu
2026-02-12 19:21 ` [PATCH 4/8] objtool/klp: Also demangle global objects Song Liu
2026-02-12 19:21 ` [PATCH 5/8] objtool/klp: Remove .llvm suffix in demangle_name() Song Liu
2026-02-12 19:21 ` [PATCH 6/8] objtool/klp: Match symbols based on demangled_name for global variables Song Liu
2026-02-12 19:22 ` [PATCH 7/8] objtool/klp: Correlate locals to globals Song Liu
2026-02-12 19:22 ` [PATCH 8/8] livepatch: Add tests for klp-build toolchain Song Liu
2026-02-18 23:00 ` Joe Lawrence [this message]
2026-02-19 3:08 ` [PATCH 0/8] objtool/klp: klp-build LTO support and tests Song Liu
2026-02-19 20:47 ` Song Liu
2026-02-19 20:51 ` Josh Poimboeuf
2026-02-19 21:31 ` Song Liu
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=aZZEjfxgLWTWODE7@redhat.com \
--to=joe.lawrence@redhat.com \
--cc=jikos@kernel.org \
--cc=jpoimboe@kernel.org \
--cc=kernel-team@meta.com \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=pmladek@suse.com \
--cc=song@kernel.org \
/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.