diff options
| author | chenmiao <chenmiao.ku@gmail.com> | 2025-09-05 18:12:56 +0000 |
|---|---|---|
| committer | Stafford Horne <shorne@gmail.com> | 2025-09-11 11:27:59 +0100 |
| commit | 9d0cb6d00be891586261a35da7f8c3c956825c39 (patch) | |
| tree | 57d60ad91f99130708d83226bd553851aafc1ba0 /arch/openrisc/kernel/module.c | |
| parent | 4735037b5d9b0f809c51976c87d737fa2c48fdea (diff) | |
openrisc: Add R_OR1K_32_PCREL relocation type module support
To ensure the proper functioning of the jump_label test module, this patch
adds support for the R_OR1K_32_PCREL relocation type for any modules. The
implementation calculates the PC-relative offset by subtracting the
instruction location from the target value and stores the result at the
specified location.
Signed-off-by: chenmiao <chenmiao.ku@gmail.com>
Signed-off-by: Stafford Horne <shorne@gmail.com>
Diffstat (limited to 'arch/openrisc/kernel/module.c')
| -rw-r--r-- | arch/openrisc/kernel/module.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/openrisc/kernel/module.c b/arch/openrisc/kernel/module.c index c9ff4c4a0b29..4ac4fbaa827c 100644 --- a/arch/openrisc/kernel/module.c +++ b/arch/openrisc/kernel/module.c @@ -55,6 +55,10 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, value |= *location & 0xfc000000; *location = value; break; + case R_OR1K_32_PCREL: + value -= (uint32_t)location; + *location = value; + break; case R_OR1K_AHI16: /* Adjust the operand to match with a signed LO16. */ value += 0x8000; |