[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r7931 - in /trunk/libc: ChangeLog.eglibc sysdeps/sparc/sparc64/dl-machine.h



Author: joseph
Date: Sat Feb 14 15:33:46 2009
New Revision: 7931

Log:
	* sysdeps/sparc/sparc64/dl-machine.h (elf_machine_runtime_setup):
	Adjust rela->r_offset by l->l_addr when rewriting PLT.

Modified:
    trunk/libc/ChangeLog.eglibc
    trunk/libc/sysdeps/sparc/sparc64/dl-machine.h

Modified: trunk/libc/ChangeLog.eglibc
==============================================================================
--- trunk/libc/ChangeLog.eglibc (original)
+++ trunk/libc/ChangeLog.eglibc Sat Feb 14 15:33:46 2009
@@ -1,3 +1,8 @@
+2009-02-14  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* sysdeps/sparc/sparc64/dl-machine.h (elf_machine_runtime_setup):
+	Adjust rela->r_offset by l->l_addr when rewriting PLT.
+
 2009-01-26  Julian Brown  <julian@xxxxxxxxxxxxxxxx>
 
 	* elf/Makefile ($(objpfx)ld.so): Add sed pattern to recognize text

Modified: trunk/libc/sysdeps/sparc/sparc64/dl-machine.h
==============================================================================
--- trunk/libc/sysdeps/sparc/sparc64/dl-machine.h (original)
+++ trunk/libc/sysdeps/sparc/sparc64/dl-machine.h Sat Feb 14 15:33:46 2009
@@ -352,7 +352,7 @@
 	    {
 	      if (__builtin_expect (rela->r_addend, 0) != 0)
 		{
-                  Elf64_Addr slot = ((rela->r_offset + 0x400
+		  Elf64_Addr slot = ((rela->r_offset + l->l_addr + 0x400
 				      - (Elf64_Addr) plt)
 				     / 0x1400) * 0x1400
 				    + (Elf64_Addr) plt - 0x400;
@@ -360,20 +360,23 @@
 		  unsigned int first_ldx = *(unsigned int *)(slot + 12);
 		  Elf64_Addr ptr = slot + (first_ldx & 0xfff) + 4;
 
-		  *(Elf64_Addr *) rela->r_offset
+		  *(Elf64_Addr *) (rela->r_offset + l->l_addr)
 		    = (Elf64_Addr) plt
-		      - (slot + ((rela->r_offset - ptr) / 8) * 24 + 4);
+		      - (slot + ((rela->r_offset + l->l_addr - ptr) / 8) * 24
+			 + 4);
 		  ++rela;
 		  continue;
 		}
 
-	      *(unsigned int *) rela->r_offset
-		= 0x03000000 | (rela->r_offset - (Elf64_Addr) plt);
-	      *(unsigned int *) (rela->r_offset + 4)
-		= 0x30680000 | ((((Elf64_Addr) plt + 32
-				  - rela->r_offset - 4) >> 2) & 0x7ffff);
-	      __asm __volatile ("flush %0" : : "r" (rela->r_offset));
-	      __asm __volatile ("flush %0+4" : : "r" (rela->r_offset));
+	      *(unsigned int *) (rela->r_offset + l->l_addr)
+		= 0x03000000 | (rela->r_offset + l->l_addr - (Elf64_Addr) plt);
+	      *(unsigned int *) (rela->r_offset + l->l_addr + 4)
+		= 0x30680000 | ((((Elf64_Addr) plt + 32 - rela->r_offset
+				  - l->l_addr - 4) >> 2) & 0x7ffff);
+	      __asm __volatile ("flush %0" : : "r" (rela->r_offset
+						    + l->l_addr));
+	      __asm __volatile ("flush %0+4" : : "r" (rela->r_offset
+						      + l->l_addr));
 	      ++rela;
 	    }
 	}