diff options
| author | Song Liu <song@kernel.org> | 2026-03-05 15:15:30 -0800 |
|---|---|---|
| committer | Josh Poimboeuf <jpoimboe@kernel.org> | 2026-03-06 08:08:33 -0800 |
| commit | cdea5cadb0ca403b1929f8d29929c0eda0f715d6 (patch) | |
| tree | 0395cd61a0fa60afe7b5941032a1fa7319695ab2 /tools/objtool/elf.c | |
| parent | 020b71dcafeeececb78d9ee9e5a2e68e8e05e922 (diff) | |
| download | linux-next-cdea5cadb0ca403b1929f8d29929c0eda0f715d6.tar.gz linux-next-cdea5cadb0ca403b1929f8d29929c0eda0f715d6.zip | |
objtool/klp: Match symbols based on demangled_name for global variables
correlate_symbols() will always try to match full name first. If there is
no match, try match only demangled_name.
In very rare cases, it is possible to have multiple foo.llvm.<hash> in
the same kernel. Whenever there is ambiguity like this, fail the klp diff.
Signed-off-by: Song Liu <song@kernel.org>
Link: https://patch.msgid.link/20260305231531.3847295-7-song@kernel.org
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Diffstat (limited to 'tools/objtool/elf.c')
| -rw-r--r-- | tools/objtool/elf.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index feaec45a14a0..8122c5f5141c 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -323,6 +323,19 @@ struct symbol *find_global_symbol_by_name(const struct elf *elf, const char *nam return NULL; } +void iterate_global_symbol_by_demangled_name(const struct elf *elf, + const char *demangled_name, + void (*process)(struct symbol *sym, void *data), + void *data) +{ + struct symbol *sym; + + elf_hash_for_each_possible(symbol_name, sym, name_hash, str_hash(demangled_name)) { + if (!strcmp(sym->demangled_name, demangled_name) && !is_local_sym(sym)) + process(sym, data); + } +} + struct reloc *find_reloc_by_dest_range(const struct elf *elf, struct section *sec, unsigned long offset, unsigned int len) { |
