From def5b60dcd2256efab0e66f598419b17c425b8f5 Mon Sep 17 00:00:00 2001 From: Josh Poimboeuf Date: Mon, 30 Mar 2026 21:31:47 -0700 Subject: objtool/klp: Fix --debug-checksum for duplicate symbol names find_symbol_by_name() only returns the first match, so --debug-checksum= 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 Reviewed-by: Miroslav Benes Signed-off-by: Josh Poimboeuf --- tools/objtool/include/objtool/elf.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tools/objtool/include') diff --git a/tools/objtool/include/objtool/elf.h b/tools/objtool/include/objtool/elf.h index b142984eb9b5..00b04029023e 100644 --- a/tools/objtool/include/objtool/elf.h +++ b/tools/objtool/include/objtool/elf.h @@ -489,6 +489,11 @@ static inline void set_sym_next_reloc(struct reloc *reloc, struct reloc *next) #define for_each_sym_continue(elf, sym) \ list_for_each_entry_continue(sym, &elf->symbols, global_list) +#define for_each_sym_by_name(elf, _name, sym) \ + elf_hash_for_each_possible(elf, symbol_name, sym, name_hash, \ + str_hash_demangled(_name)) \ + if (strcmp(sym->name, _name)) {} else + #define for_each_sym_by_demangled_name(elf, name, sym) \ elf_hash_for_each_possible(elf, symbol_name, sym, name_hash, \ str_hash(name)) \ -- cgit