From ac1c30d10986372909b167e70c6efa9ccf82a09b Mon Sep 17 00:00:00 2001 From: Jim Ma Date: Fri, 10 Mar 2023 17:08:41 +0800 Subject: [PATCH] update apply_relocate_add for R_X86_64_PC64 and R_X86_64_PLT32 (#11) For SA6400 DSM 7.2, there are many errors when load modules: "Unknown rela relocation: 4" The root cause is that the apply_relocate_add is outdated, so update it here. --- shim/bios_shim.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shim/bios_shim.c b/shim/bios_shim.c index db4a835..55f7c34 100644 --- a/shim/bios_shim.c +++ b/shim/bios_shim.c @@ -344,9 +344,14 @@ static int _apply_relocate_add(Elf64_Shdr *sechdrs, const char *strtab, unsigned goto overflow; break; case R_X86_64_PC32: + case R_X86_64_PLT32: val -= (u64)loc; *(u32 *)loc = val; break; + case R_X86_64_PC64: + val -= (u64)loc; + *(u64 *)loc = val; + break; default: pr_err("%s: Unknown rela relocation: %llu\n", me->name, ELF64_R_TYPE(rel[i].r_info));