[PATCH] ppc64: Add R_PPC64_TOC16 module reloc

Anton Blanchard anton at samba.org
Tue Oct 11 22:18:54 EST 2005


From: Peter Bergner <bergner at vnet.ibm.com>

Just to be safe, I verified the patch still applies to Linus' tree.
There was a little fuzz, so I'm attaching a new patch that applies
cleanly with no fuzz.

Signed-off-by: Peter Bergner <bergner at vnet.ibm.com>
Signed-off-by: Anton Blanchard <anton at samba.org>

--- arch/ppc64/kernel/module.c.orig	2005-10-10 21:55:00.404946024 -0400
+++ arch/ppc64/kernel/module.c	2005-10-10 22:03:02.073931824 -0400
@@ -341,6 +341,19 @@
 			*(unsigned long *)location = my_r2(sechdrs, me);
 			break;
 
+		case R_PPC64_TOC16:
+			/* Subtact TOC pointer */
+			value -= my_r2(sechdrs, me);
+			if (value + 0x8000 > 0xffff) {
+				printk("%s: bad TOC16 relocation (%lu)\n",
+				       me->name, value);
+				return -ENOEXEC;
+			}
+			*((uint16_t *) location)
+				= (*((uint16_t *) location) & ~0xffff)
+				| (value & 0xffff);
+			break;
+
 		case R_PPC64_TOC16_DS:
 			/* Subtact TOC pointer */
 			value -= my_r2(sechdrs, me);




More information about the Linuxppc64-dev mailing list