modpost: refactor find_fromsym() and find_tosym()
authorMasahiro Yamada <masahiroy@kernel.org>
Thu, 1 Jun 2023 12:09:58 +0000 (21:09 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Fri, 2 Jun 2023 13:45:59 +0000 (22:45 +0900)
commitb1a9651d48b42f3eddf095123c09f93e4df23060
tree43ca17aae923e268087200f2d627d8a5cf0fdc13
parent12ca2c67d742d390c0aa1f8c1cfc49469df55ddf
modpost: refactor find_fromsym() and find_tosym()

find_fromsym() and find_tosym() are similar - both of them iterate
in the .symtab section and return the nearest symbol.

The difference between them is that find_tosym() allows a negative
distance, but the distance must be less than 20.

Factor out the common part into find_nearest_sym().

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
scripts/mod/modpost.c