From 7d51b8c6a1ea30610636a81926212fed375a639e Mon Sep 17 00:00:00 2001 From: Benjamin Donnachie Date: Sat, 15 Aug 2026 23:49:13 +0100 Subject: [PATCH] create-diff-object: handle R_X86_64_32 in rela_target_offset rela_target_offset() treats R_X86_64_64 and R_X86_64_32S as absolute (non-PC-relative) relocations needing no instruction-decode-based offset adjustment, but was missing R_X86_64_32 (ELF reloc type 10). Any file containing one hits "ERROR: unhandled rela type 10" and aborts the whole build. R_X86_64_32 and R_X86_64_32S are both absolute relocations; per the x86-64 psABI they differ only in how the linker validates/truncates the value during relocation *application* (zero- vs sign-extension), which has no bearing on add_off here -- the instruction-decode adjustment this function computes only matters for PC-relative encodings. So R_X86_64_32 belongs in the same branch as R_X86_64_32S. R_X86_64_32 shows up in low-level x86 code that still executes in 32-bit protected mode before the switch to long mode (observed in arch/x86/platform/pvh/head.o, Xen PVH boot entry), where the usual 64-bit-oriented relocations don't apply. Reproduced and fixed while building a real cumulative EL9 5.14 kernel livepatch. Co-authored-by: Claude --- kpatch-build/kpatch-elf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kpatch-build/kpatch-elf.c b/kpatch-build/kpatch-elf.c index d418ecda..190a3f94 100755 --- a/kpatch-build/kpatch-elf.c +++ b/kpatch-build/kpatch-elf.c @@ -229,6 +229,7 @@ long rela_target_offset(struct kpatch_elf *kelf, struct section *relasec, case X86_64: if (!is_text_section(sec) || rela->type == R_X86_64_64 || + rela->type == R_X86_64_32 || rela->type == R_X86_64_32S) add_off = 0; else if (rela->type == R_X86_64_PC32 ||