[tip: objtool/core] objtool/klp: Fix vmlinux .klp.symid link error for .no_trim_symbol symbols

tip-bot2 for Josh Poimboeuf posted 1 patch 1 month, 2 weeks ago
tools/objtool/klp-symid.c | 1 +
1 file changed, 1 insertion(+)
[tip: objtool/core] objtool/klp: Fix vmlinux .klp.symid link error for .no_trim_symbol symbols
Posted by tip-bot2 for Josh Poimboeuf 1 month, 2 weeks ago
The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     3a83d9cd3d0e66c0ef99ce84f972ed26f50c990f
Gitweb:        https://git.kernel.org/tip/3a83d9cd3d0e66c0ef99ce84f972ed26f50c990f
Author:        Josh Poimboeuf <jpoimboe@kernel.org>
AuthorDate:    Fri, 07 Aug 2026 14:37:46 -07:00
Committer:     Josh Poimboeuf <jpoimboe@kernel.org>
CommitterDate: Tue, 11 Aug 2026 15:04:57 -07:00

objtool/klp: Fix vmlinux .klp.symid link error for .no_trim_symbol symbols

Testing klp-build with arm64 produced the following linker error during
the original kernel build:

  `__notrim.1' referenced in section `.klp.symid' of vmlinux.o: defined in discarded section `.no_trim_symbol' of vmlinux.o

symbol_get() puts a static __notrim[] in .no_trim_symbol, which GCC
names __notrim.1, __notrim.2, etc.  Two or more built-in translation
units calling symbol_get() thus produce duplicate names, resulting in
corresponding .klp.symid references which trigger the above error.

Add .no_trim_symbol to the discarded section list so its symbols don't
get symids.

Note this issue is not specific to arm64: it just needs two built-in
symbol_get() callers.  arm64 trips over it easily because it has KVM
always compiled in vmlinux, whereas on x86 it's typically a module.

Fixes: 029223d30162 ("objtool/klp: Add .klp.symid for sympos disambiguation")
Acked-by: Song Liu <song@kernel.org>
Acked-by: Joe Lawrence <joe.lawrence@redhat.com>
Link: https://patch.msgid.link/5a3cc4cded743167dd0878220201d80f7e48e5d7.1786138493.git.jpoimboe@kernel.org
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
 tools/objtool/klp-symid.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/objtool/klp-symid.c b/tools/objtool/klp-symid.c
index cf188cd..21d8708 100644
--- a/tools/objtool/klp-symid.c
+++ b/tools/objtool/klp-symid.c
@@ -31,6 +31,7 @@
 static const char * const discarded_secs[] = {
 	".discard",
 	".modinfo",
+	".no_trim_symbol",
 	"__tracepoint_check",
 };