]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
objtool/klp: Fix relocation conversion failures for R_X86_64_NONE
authorJosh Poimboeuf <jpoimboe@kernel.org>
Tue, 21 Apr 2026 05:59:12 +0000 (22:59 -0700)
committerJosh Poimboeuf <jpoimboe@kernel.org>
Tue, 5 May 2026 04:16:01 +0000 (21:16 -0700)
Objtool has some hacks which NOP out certain calls/jumps and replace
their relocations with R_X86_64_NONE.  The klp-diff relocation
extraction code will error out when trying to copy these relocations due
to their negative addend, which would only makes sense for a PC-relative
branch instruction.  Just ignore them.

Fixes: dd590d4d57eb ("objtool/klp: Introduce klp diff subcommand for diffing object files")
Acked-by: Song Liu <song@kernel.org>
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
tools/objtool/klp-diff.c

index dd0e51dfc621d7c2edf9d24a9e32c3d4eb85d33e..19bc811db39635bbebe9aa576982e806ead744b5 100644 (file)
@@ -1033,6 +1033,9 @@ found_sym:
  */
 static int convert_reloc_sym(struct elf *elf, struct reloc *reloc)
 {
+       if (reloc_type(reloc) == R_NONE)
+               return 1;
+
        if (is_reloc_allowed(reloc))
                return 0;