diff options
author | Andreas Schwab <schwab@suse.de> | 2018-06-07 06:27:27 -0400 |
---|---|---|
committer | Palmer Dabbelt <palmer@sifive.com> | 2018-06-11 12:04:34 -0400 |
commit | 77aa85de16aeefd75d639737c7bfcf0d2604e471 (patch) | |
tree | 1fac74156aa7eb48dcc9d5a888067f53fc81fac2 | |
parent | 1dd985229d5fc19359250bc0e4235aff217672b2 (diff) |
RISC-V: Handle R_RISCV_32 in modules
With CONFIG_MODVERSIONS=y the R_RISCV_32 relocation is used by the
__kcrctab section.
Signed-off-by: Andreas Schwab <schwab@suse.de>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
-rw-r--r-- | arch/riscv/kernel/module.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/riscv/kernel/module.c b/arch/riscv/kernel/module.c index 5dddba301d0a..1d5e9b934b8c 100644 --- a/arch/riscv/kernel/module.c +++ b/arch/riscv/kernel/module.c | |||
@@ -17,6 +17,17 @@ | |||
17 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
18 | #include <linux/moduleloader.h> | 18 | #include <linux/moduleloader.h> |
19 | 19 | ||
20 | static int apply_r_riscv_32_rela(struct module *me, u32 *location, Elf_Addr v) | ||
21 | { | ||
22 | if (v != (u32)v) { | ||
23 | pr_err("%s: value %016llx out of range for 32-bit field\n", | ||
24 | me->name, v); | ||
25 | return -EINVAL; | ||
26 | } | ||
27 | *location = v; | ||
28 | return 0; | ||
29 | } | ||
30 | |||
20 | static int apply_r_riscv_64_rela(struct module *me, u32 *location, Elf_Addr v) | 31 | static int apply_r_riscv_64_rela(struct module *me, u32 *location, Elf_Addr v) |
21 | { | 32 | { |
22 | *(u64 *)location = v; | 33 | *(u64 *)location = v; |
@@ -265,6 +276,7 @@ static int apply_r_riscv_sub32_rela(struct module *me, u32 *location, | |||
265 | 276 | ||
266 | static int (*reloc_handlers_rela[]) (struct module *me, u32 *location, | 277 | static int (*reloc_handlers_rela[]) (struct module *me, u32 *location, |
267 | Elf_Addr v) = { | 278 | Elf_Addr v) = { |
279 | [R_RISCV_32] = apply_r_riscv_32_rela, | ||
268 | [R_RISCV_64] = apply_r_riscv_64_rela, | 280 | [R_RISCV_64] = apply_r_riscv_64_rela, |
269 | [R_RISCV_BRANCH] = apply_r_riscv_branch_rela, | 281 | [R_RISCV_BRANCH] = apply_r_riscv_branch_rela, |
270 | [R_RISCV_JAL] = apply_r_riscv_jal_rela, | 282 | [R_RISCV_JAL] = apply_r_riscv_jal_rela, |