summaryrefslogtreecommitdiff
path: root/tools/objtool/elf.c
diff options
context:
space:
mode:
authorJosh Poimboeuf <jpoimboe@kernel.org>2025-09-17 09:04:03 -0700
committerJosh Poimboeuf <jpoimboe@kernel.org>2025-10-14 14:50:18 -0700
commit164c9201e1dad8d5c0c38f583dba81e4b6da9cc7 (patch)
tree0450426a0f0e5b73d640fe4419064db6d1507a1a /tools/objtool/elf.c
parent2058f6d1660edc4a9bda9bee627792b352121b10 (diff)
objtool: Add base objtool support for livepatch modules
In preparation for klp-build, enable "classic" objtool to work on livepatch modules: - Avoid duplicate symbol/section warnings for prefix symbols and the .static_call_sites and __mcount_loc sections which may have already been extracted by klp diff. - Add __klp_funcs to the IBT function pointer section whitelist. - Prevent KLP symbols from getting incorrectly classified as cold subfunctions. Acked-by: Petr Mladek <pmladek@suse.com> Tested-by: Joe Lawrence <joe.lawrence@redhat.com> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Diffstat (limited to 'tools/objtool/elf.c')
-rw-r--r--tools/objtool/elf.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index 4bb7ce994b6a..5feeefc7fc8f 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -499,7 +499,10 @@ static int elf_add_symbol(struct elf *elf, struct symbol *sym)
strstarts(sym->name, "__pi___cfi_")))
sym->prefix = 1;
- if (is_func_sym(sym) && strstr(sym->name, ".cold"))
+ if (strstarts(sym->name, ".klp.sym"))
+ sym->klp = 1;
+
+ if (!sym->klp && is_func_sym(sym) && strstr(sym->name, ".cold"))
sym->cold = 1;
sym->pfunc = sym->cfunc = sym;