Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 781c8fe2 authored by Andreas Schwab's avatar Andreas Schwab Committed by Palmer Dabbelt
Browse files

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: default avatarAndreas Schwab <schwab@suse.de>
Signed-off-by: default avatarPalmer Dabbelt <palmer@sifive.com>
parent 021c9179
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;
}