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.
This commit is contained in:
Jim Ma 2023-03-10 17:08:41 +08:00 committed by GitHub
parent 69a8d200f8
commit ac1c30d109
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -344,9 +344,14 @@ static int _apply_relocate_add(Elf64_Shdr *sechdrs, const char *strtab, unsigned
goto overflow; goto overflow;
break; break;
case R_X86_64_PC32: case R_X86_64_PC32:
case R_X86_64_PLT32:
val -= (u64)loc; val -= (u64)loc;
*(u32 *)loc = val; *(u32 *)loc = val;
break; break;
case R_X86_64_PC64:
val -= (u64)loc;
*(u64 *)loc = val;
break;
default: default:
pr_err("%s: Unknown rela relocation: %llu\n", pr_err("%s: Unknown rela relocation: %llu\n",
me->name, ELF64_R_TYPE(rel[i].r_info)); me->name, ELF64_R_TYPE(rel[i].r_info));