objtool: Fix off-by-one in symbol_by_offset()
authorJulien Thierry <jthierry@redhat.com>
Fri, 3 Apr 2020 13:17:30 +0000 (14:17 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Wed, 22 Apr 2020 21:14:46 +0000 (23:14 +0200)
commit7f9b34f36cf6b2099f19e679a9e8315c955ef2ee
tree1ef18a8b85549cc38e021ba4104c8b84bc32f8a6
parentdf2b384366fc427eeaa8bd0e761390180b311df0
objtool: Fix off-by-one in symbol_by_offset()

Sometimes, WARN_FUNC() and other users of symbol_by_offset() will
associate the first instruction of a symbol with the symbol preceding
it.  This is because symbol->offset + symbol->len is already outside of
the symbol's range.

Fixes: 2a362ecc3ec9 ("objtool: Optimize find_symbol_*() and read_symbols()")
Signed-off-by: Julien Thierry <jthierry@redhat.com>
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
tools/objtool/elf.c