mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-10 15:10:38 +00:00
RISC-V: fix R_RISCV_ADD32/R_RISCV_SUB32 relocations
The R_RISCV_ADD32/R_RISCV_SUB32 relocations should add/subtract the address of the symbol (without overflow check), not its contents. Signed-off-by: Andreas Schwab <schwab@suse.de> Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
This commit is contained in:
parent
021c91791a
commit
781c8fe2da
@ -263,14 +263,14 @@ static int apply_r_riscv_align_rela(struct module *me, u32 *location,
|
||||
static int apply_r_riscv_add32_rela(struct module *me, u32 *location,
|
||||
Elf_Addr v)
|
||||
{
|
||||
*(u32 *)location += (*(u32 *)v);
|
||||
*(u32 *)location += (u32)v;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int apply_r_riscv_sub32_rela(struct module *me, u32 *location,
|
||||
Elf_Addr v)
|
||||
{
|
||||
*(u32 *)location -= (*(u32 *)v);
|
||||
*(u32 *)location -= (u32)v;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user