Use the section symbol's index instead of the old symbol's index when
updating the ELF relocation entry in convert_reloc_sym_to_secsym().

Found by Sashiko review.

Signed-off-by: Josh Poimboeuf <[email protected]>
---
 tools/objtool/klp-diff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/objtool/klp-diff.c b/tools/objtool/klp-diff.c
index ca87bcb9afa3..463b6daa5234 100644
--- a/tools/objtool/klp-diff.c
+++ b/tools/objtool/klp-diff.c
@@ -975,7 +975,7 @@ static int convert_reloc_sym_to_secsym(struct elf *elf, 
struct reloc *reloc)
                return -1;
 
        reloc->sym = sec->sym;
-       set_reloc_sym(elf, reloc, sym->idx);
+       set_reloc_sym(elf, reloc, sec->sym->idx);
        set_reloc_addend(elf, reloc, sym->offset + reloc_addend(reloc));
        return 0;
 }
-- 
2.53.0


Reply via email to