summaryrefslogtreecommitdiff
path: root/arch/openrisc
diff options
context:
space:
mode:
authorStafford Horne <shorne@gmail.com>2024-04-11 19:23:25 +0300
committerStafford Horne <shorne@gmail.com>2024-04-15 17:20:39 +0300
commit23c6e901c7112295d5ff0e1d90fed7be102433b9 (patch)
treede9d5ac666bed8a13ca48606f33a7e4fbd59d759 /arch/openrisc
parent26f53f23957f996daa7328f96263011c09cf8552 (diff)
downloadlinux-23c6e901c7112295d5ff0e1d90fed7be102433b9.tar.xz
openrisc: Add support for more module relocations
When testing modules in OpenRISC I found R_OR1K_AHI16 (signed adjusted high 16-bit) and R_OR1K_SLO16 (split low 16-bit) relocations are used in modules but not implemented yet. This patch implements the relocations. I have tested with a few modules. Signed-off-by: Stafford Horne <shorne@gmail.com>
Diffstat (limited to 'arch/openrisc')
-rw-r--r--arch/openrisc/kernel/module.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/openrisc/kernel/module.c b/arch/openrisc/kernel/module.c
index 292f0afe27b9..c9ff4c4a0b29 100644
--- a/arch/openrisc/kernel/module.c
+++ b/arch/openrisc/kernel/module.c
@@ -55,6 +55,16 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
value |= *location & 0xfc000000;
*location = value;
break;
+ case R_OR1K_AHI16:
+ /* Adjust the operand to match with a signed LO16. */
+ value += 0x8000;
+ *((uint16_t *)location + 1) = value >> 16;
+ break;
+ case R_OR1K_SLO16:
+ /* Split value lower 16-bits. */
+ value = ((value & 0xf800) << 10) | (value & 0x7ff);
+ *location = (*location & ~0x3e007ff) | value;
+ break;
default:
pr_err("module %s: Unknown relocation: %u\n",
me->name, ELF32_R_TYPE(rel[i].r_info));