about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--sysdeps/powerpc/powerpc64/dl-machine.h18
2 files changed, 11 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 1a7ae320da..2b7f720f06 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2003-03-04  Roland McGrath  <roland@redhat.com>
 
+	* sysdeps/powerpc/powerpc64/dl-machine.h: Include <dl-tls.h>.
+	(elf_machine_rela): Always use RESOLVE_MAP, needed for
+	R_PPC64_JMP_SLOT as well as TLS cases.
+	(BIT_INSERT): Move parenthesis where it ought to have been.
+	Reported by Steven Munroe <sjmunroe@us.ibm.com>.
+
 	* posix/confstr.c (confstr): Correct STRING_LEN values for
 	_CS_GNU_LIBC_VERSION and _CS_GNU_LIBPTHREAD_VERSION, add missing
 	break.  Reported by Alexandre Julliard <julliard@winehq.com>.
diff --git a/sysdeps/powerpc/powerpc64/dl-machine.h b/sysdeps/powerpc/powerpc64/dl-machine.h
index 93cbc8b168..fc673fc6cb 100644
--- a/sysdeps/powerpc/powerpc64/dl-machine.h
+++ b/sysdeps/powerpc/powerpc64/dl-machine.h
@@ -26,6 +26,7 @@
 
 #include <assert.h>
 #include <sys/param.h>
+#include <dl-tls.h>
 
 /* Translate a processor specific dynamic tag to the index
    in l_info array.  */
@@ -526,7 +527,7 @@ elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc,
 #define PPC_HIGHEST(v) (((v) >> 48) & 0xffff)
 #define PPC_HIGHESTA(v) PPC_HIGHEST ((v) + 0x8000)
 #define BIT_INSERT(var, val, mask) \
-  ((var) = ((var) & ~(Elf64_Addr) (mask) | ((val) & (mask))))
+  ((var) = ((var) & ~(Elf64_Addr) (mask)) | ((val) & (mask)))
 
 #define dont_expect(X) __builtin_expect ((X), 0)
 
@@ -554,8 +555,6 @@ elf_machine_rela (struct link_map *map,
 		  Elf64_Addr *const reloc_addr)
 {
   const int r_type = ELF64_R_TYPE (reloc->r_info);
-  struct link_map *sym_map;
-  Elf64_Addr value;
 #ifndef RTLD_BOOTSTRAP
   const Elf64_Sym *const refsym = sym;
 #endif
@@ -569,17 +568,10 @@ elf_machine_rela (struct link_map *map,
   if (__builtin_expect (r_type == R_PPC64_NONE, 0))
     return;
 
-#if defined USE_TLS && !defined RTLD_BOOTSTRAP
+  /* We need SYM_MAP even in the absence of TLS, for elf_machine_fixup_plt.  */
   struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);
-  value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value;
-#else
-  value = RESOLVE (&sym, version, r_type);
-# ifndef RTLD_BOOTSTRAP
-  if (sym != NULL)
-# endif
-    value += sym->st_value;
-#endif
-  value += reloc->r_addend;
+  Elf64_Addr value = ((sym == NULL ? 0 : sym_map->l_addr + sym->st_value)
+		      + reloc->r_addend);
 
   /* For relocs that don't edit code, return.
      For relocs that might edit instructions, break from the switch.  */