diff options
author | Andreas Schwab <schwab@suse.de> | 2018-06-12 19:26:36 +0200 |
---|---|---|
committer | Palmer Dabbelt <palmer@sifive.com> | 2018-07-04 14:12:34 -0700 |
commit | 781c8fe2da3d2c7c95cd7ffddbab63b80a79da4d (patch) | |
tree | 5efc5593da2d146efd839604a54bf000e56f8536 /arch | |
parent | 021c91791a5e7e85c567452f1be3e4c2c6cb6063 (diff) | |
download | linux-781c8fe2da3d2c7c95cd7ffddbab63b80a79da4d.tar.bz2 |
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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/riscv/kernel/module.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/riscv/kernel/module.c b/arch/riscv/kernel/module.c index 1d5e9b934b8c..6bb48315c973 100644 --- a/arch/riscv/kernel/module.c +++ b/arch/riscv/kernel/module.c @@ -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; } |