ANDROID: RISC-V: Support 32_PCREL relocation type in kernel module
Update the kernel module loader to handle R_RISCV_32_PCREL which LLVM is generating for some modules now. Bug: 286415667 Link: https://github.com/google/android-riscv64/issues/86 Change-Id: I396dc13fa9833fa35c4d883fadb116eed76da9d3 Signed-off-by: nylon chen <nylon.chen@sifive.com> Signed-off-by: Alistair Delva <adelva@google.com>
This commit is contained in:
committed by
Treehugger Robot
parent
b0acbba3f4
commit
a0695ef898
@@ -310,6 +310,15 @@ static int apply_r_riscv_sub64_rela(struct module *me, u32 *location,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int apply_r_riscv_pcrel_32_rela(struct module *me, u32 *location,
|
||||
Elf_Addr v)
|
||||
{
|
||||
ptrdiff_t offset = (void *)v - (void *)location;
|
||||
|
||||
*location = (*location & 0xffff0000) | (offset & 0xffff);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int (*reloc_handlers_rela[]) (struct module *me, u32 *location,
|
||||
Elf_Addr v) = {
|
||||
[R_RISCV_32] = apply_r_riscv_32_rela,
|
||||
@@ -335,6 +344,7 @@ static int (*reloc_handlers_rela[]) (struct module *me, u32 *location,
|
||||
[R_RISCV_SUB16] = apply_r_riscv_sub16_rela,
|
||||
[R_RISCV_SUB32] = apply_r_riscv_sub32_rela,
|
||||
[R_RISCV_SUB64] = apply_r_riscv_sub64_rela,
|
||||
[R_RISCV_32_PCREL] = apply_r_riscv_pcrel_32_rela,
|
||||
};
|
||||
|
||||
int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
|
||||
|
||||
Reference in New Issue
Block a user