From c89a1770572654ef01ea9b12519c7f9fe05514f1 Mon Sep 17 00:00:00 2001 From: Milton Miller Date: Wed, 11 Apr 2007 03:30:00 -0500 Subject: kexec-tools: ppc64: correct @ha relocation The @ha relocation is supposed to account for the @l relocation being a signed quantity by adding 1 if the msb of @l is set. The trick of adding 0x8000 stolen from the linux kernel file arch/powerpc/kernel/module_64.c which credits binutils. Signed-off-by: Milton Miller Acked-by: Mohan Kumar M Signed-off-by: Simon Horman --- kexec/arch/ppc64/kexec-elf-rel-ppc64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kexec/arch/ppc64/kexec-elf-rel-ppc64.c b/kexec/arch/ppc64/kexec-elf-rel-ppc64.c index a0d1750..c5fd561 100644 --- a/kexec/arch/ppc64/kexec-elf-rel-ppc64.c +++ b/kexec/arch/ppc64/kexec-elf-rel-ppc64.c @@ -97,7 +97,7 @@ void machine_apply_elf_rel(struct mem_ehdr *ehdr, unsigned long r_type, break; case R_PPC64_ADDR16_HA: - *(uint16_t *)location = ((value>>16) & 0xffff); + *(uint16_t *)location = (((value+0x8000)>>16) & 0xffff); break; case R_PPC64_ADDR16_HIGHEST: -- cgit