[tip: objtool/core] objtool/klp: Fix relocation conversion failures for R_X86_64_NONE

tip-bot2 for Josh Poimboeuf posted 1 patch 1 month, 1 week ago
tools/objtool/klp-diff.c | 3 +++
1 file changed, 3 insertions(+)
[tip: objtool/core] objtool/klp: Fix relocation conversion failures for R_X86_64_NONE
Posted by tip-bot2 for Josh Poimboeuf 1 month, 1 week ago
The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     3787e82a4e3a0a04aeb5543580ee90bed3a36e55
Gitweb:        https://git.kernel.org/tip/3787e82a4e3a0a04aeb5543580ee90bed3a36e55
Author:        Josh Poimboeuf <jpoimboe@kernel.org>
AuthorDate:    Mon, 20 Apr 2026 22:59:12 -07:00
Committer:     Josh Poimboeuf <jpoimboe@kernel.org>
CommitterDate: Mon, 04 May 2026 21:16:01 -07:00

objtool/klp: Fix relocation conversion failures for R_X86_64_NONE

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 | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/objtool/klp-diff.c b/tools/objtool/klp-diff.c
index dd0e51d..19bc811 100644
--- a/tools/objtool/klp-diff.c
+++ b/tools/objtool/klp-diff.c
@@ -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;