Skip to content

Commit 23c6e90

Browse files
committed
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 <[email protected]>
1 parent 26f53f2 commit 23c6e90

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

arch/openrisc/kernel/module.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
5555
value |= *location & 0xfc000000;
5656
*location = value;
5757
break;
58+
case R_OR1K_AHI16:
59+
/* Adjust the operand to match with a signed LO16. */
60+
value += 0x8000;
61+
*((uint16_t *)location + 1) = value >> 16;
62+
break;
63+
case R_OR1K_SLO16:
64+
/* Split value lower 16-bits. */
65+
value = ((value & 0xf800) << 10) | (value & 0x7ff);
66+
*location = (*location & ~0x3e007ff) | value;
67+
break;
5868
default:
5969
pr_err("module %s: Unknown relocation: %u\n",
6070
me->name, ELF32_R_TYPE(rel[i].r_info));

0 commit comments

Comments
 (0)