Thread (13 messages) flat view 13 messages, 5 authors, 2007-01-03

Re: R_PPC_ADDR16_HI relocs in PPC modules ?

From: Alan Modra <hidden>
Date: 2007-01-02 21:31:52

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.
quoted hunk ↗ jump to hunk
--- 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help