summaryrefslogtreecommitdiff
path: root/tools/objtool/check.c
diff options
context:
space:
mode:
authorJosh Poimboeuf <jpoimboe@kernel.org>2026-03-31 07:31:47 +0300
committerJosh Poimboeuf <jpoimboe@kernel.org>2026-05-05 07:16:00 +0300
commitdef5b60dcd2256efab0e66f598419b17c425b8f5 (patch)
tree383f05bec554a0ae64c3a0d12520997f261988d8 /tools/objtool/check.c
parent0333b7399587ee0aaa863ed0d13a00a6c7c64068 (diff)
downloadlinux-def5b60dcd2256efab0e66f598419b17c425b8f5.tar.xz
objtool/klp: Fix --debug-checksum for duplicate symbol names
find_symbol_by_name() only returns the first match, so --debug-checksum=<func> silently ignores any subsequent duplicately named functions after the first. Fix that, along with a new for_each_sym_by_name() helper. Acked-by: Song Liu <song@kernel.org> Reviewed-by: Miroslav Benes <mbenes@suse.cz> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Diffstat (limited to 'tools/objtool/check.c')
-rw-r--r--tools/objtool/check.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 9b11cf3193b9..e3604b1201f9 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -3677,18 +3677,23 @@ static int checksum_debug_init(struct objtool_file *file)
s = dup;
while (*s) {
- struct symbol *func;
+ bool found = false;
+ struct symbol *sym;
char *comma;
comma = strchr(s, ',');
if (comma)
*comma = '\0';
- func = find_symbol_by_name(file->elf, s);
- if (!func || !is_func_sym(func))
+ for_each_sym_by_name(file->elf, s, sym) {
+ if (!is_func_sym(sym))
+ continue;
+ sym->debug_checksum = 1;
+ found = true;
+ }
+
+ if (!found)
WARN("--debug-checksum: can't find '%s'", s);
- else
- func->debug_checksum = 1;
if (!comma)
break;