R_PPC_ADDR16_HI relocs in PPC modules ?
Alan Modra
amodra at bigpond.net.au
Wed Jan 3 08:31:51 EST 2007
On Tue, Jan 02, 2007 at 05:25:54PM +0100, Simon Vallet wrote:
> Is there a reason for this ?
I guess no one has needed the reloc before. gcc tends to use
"li, addis" pairs to load 32-bit constants. Your code must be using
"lis, ori".
> If there are no reasons, then how about the following patch ?
Looks good to me.
> --- arch/powerpc/kernel/module_32.c.orig 2007-01-02 17:07:21.000000000 +0100
> +++ arch/powerpc/kernel/module_32.c 2007-01-02 17:11:55.000000000 +0100
> @@ -222,6 +222,11 @@ int apply_relocate_add(Elf32_Shdr *sechd
> *(uint16_t *)location = value;
> break;
>
> + case R_PPC_ADDR16_HI:
> + /* Higher half of the symbol */
> + *(uint16_t *)location = (value >> 16);
> + break;
> +
> case R_PPC_ADDR16_HA:
> /* Sign-adjusted lower 16 bits: PPC ELF ABI says:
> (((x >> 16) + ((x & 0x8000) ? 1 : 0))) & 0xFFFF.
--
Alan Modra
IBM OzLabs - Linux Technology Centre
More information about the Linuxppc-dev
mailing list