Subject: Re: [PATCH 27/33] powerpc: Handle new ELFv2 module relocations

From: Alan Modra <[email-masked]>
Date: Wed, 26 Mar 2014 20:58:45 +1030

On Tue, Mar 25, 2014 at 10:44:33PM +1100, Anton Blanchard wrote:
> From: Rusty Russell <[email-masked]>
> +		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);

There's not much point reading the uint16_t.

			*(uint16_t *) location = value;

> +			break;
> +
> +		case R_PPC64_REL16_LO:
> +			/* Subtract location pointer */
> +			value -= (unsigned long)location;
> +			*((uint16_t *) location)
> +				= (*((uint16_t *) location) & ~0xffff)
> +				| (value & 0xffff);

and again.

> +			break;
> +
>  		default:
>  			printk("%s: Unknown ADD relocation: %lu\n",
>  			       me->name,

-- 
Alan Modra
Australia Development Lab, IBM