powerpc: Handle new ELFv2 module relocations
The new ELF ABI tends to use R_PPC64_REL16_LO and R_PPC64_REL16_HA relocations (PC-relative), so implement them. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:

committed by
Anton Blanchard

parent
4edebbeae3
commit
0906584a0a
@@ -491,6 +491,23 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
|
||||
*/
|
||||
break;
|
||||
|
||||
case R_PPC64_REL16_HA:
|
||||
/* Subtract location pointer */
|
||||
value -= (unsigned long)location;
|
||||
value = ((value + 0x8000) >> 16);
|
||||
*((uint16_t *) location)
|
||||
= (*((uint16_t *) location) & ~0xffff)
|
||||
| (value & 0xffff);
|
||||
break;
|
||||
|
||||
case R_PPC64_REL16_LO:
|
||||
/* Subtract location pointer */
|
||||
value -= (unsigned long)location;
|
||||
*((uint16_t *) location)
|
||||
= (*((uint16_t *) location) & ~0xffff)
|
||||
| (value & 0xffff);
|
||||
break;
|
||||
|
||||
default:
|
||||
printk("%s: Unknown ADD relocation: %lu\n",
|
||||
me->name,
|
||||
|
Reference in New Issue
Block a user