about summary refs log tree commit diff
path: root/sysdeps/powerpc
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2003-03-05 03:27:24 +0000
committerRoland McGrath <roland@gnu.org>2003-03-05 03:27:24 +0000
commit790eed83d16363ef9d1241f366e0f3559b7f5c90 (patch)
tree44008915820c8315645a1c131a96b821b107ca29 /sysdeps/powerpc
parent510793fd95ba91303b052c0db5c30cf291035ee9 (diff)
downloadglibc-790eed83d16363ef9d1241f366e0f3559b7f5c90.tar.gz
glibc-790eed83d16363ef9d1241f366e0f3559b7f5c90.tar.xz
glibc-790eed83d16363ef9d1241f366e0f3559b7f5c90.zip
* 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>.
Diffstat (limited to 'sysdeps/powerpc')
-rw-r--r--sysdeps/powerpc/powerpc64/dl-machine.h18
1 files changed, 5 insertions, 13 deletions
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.  */