Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

objtool: Return canonical symbol when aliases exist in symbol finding helpers

When symbol alias ambiguity exists in the symbol finding helper
functions, return the canonical sym->alias, as that's the one which gets
used by validate_branch() and elsewhere.

This doesn't fix any known issues, just makes the symbol alias behavior
more robust.

Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/450470a4897706af77453ad333e18af5ebab653c.1763671318.git.jpoimboe@kernel.org

authored by

Josh Poimboeuf and committed by
Peter Zijlstra
9205a322 16f366c5

+13 -13
+13 -13
tools/objtool/elf.c
··· 172 172 struct symbol *find_symbol_by_offset(struct section *sec, unsigned long offset) 173 173 { 174 174 struct rb_root_cached *tree = (struct rb_root_cached *)&sec->symbol_tree; 175 - struct symbol *iter; 175 + struct symbol *sym; 176 176 177 - __sym_for_each(iter, tree, offset, offset) { 178 - if (iter->offset == offset && !is_sec_sym(iter)) 179 - return iter; 177 + __sym_for_each(sym, tree, offset, offset) { 178 + if (sym->offset == offset && !is_sec_sym(sym)) 179 + return sym->alias; 180 180 } 181 181 182 182 return NULL; ··· 185 185 struct symbol *find_func_by_offset(struct section *sec, unsigned long offset) 186 186 { 187 187 struct rb_root_cached *tree = (struct rb_root_cached *)&sec->symbol_tree; 188 - struct symbol *iter; 188 + struct symbol *func; 189 189 190 - __sym_for_each(iter, tree, offset, offset) { 191 - if (iter->offset == offset && is_func_sym(iter)) 192 - return iter; 190 + __sym_for_each(func, tree, offset, offset) { 191 + if (func->offset == offset && is_func_sym(func)) 192 + return func->alias; 193 193 } 194 194 195 195 return NULL; ··· 220 220 } 221 221 } 222 222 223 - return sym; 223 + return sym ? sym->alias : NULL; 224 224 } 225 225 226 226 /* ··· 266 266 struct symbol *find_func_containing(struct section *sec, unsigned long offset) 267 267 { 268 268 struct rb_root_cached *tree = (struct rb_root_cached *)&sec->symbol_tree; 269 - struct symbol *iter; 269 + struct symbol *func; 270 270 271 - __sym_for_each(iter, tree, offset, offset) { 272 - if (is_func_sym(iter)) 273 - return iter; 271 + __sym_for_each(func, tree, offset, offset) { 272 + if (is_func_sym(func)) 273 + return func->alias; 274 274 } 275 275 276 276 return NULL;