about summary refs log tree commit diff
path: root/sysdeps/powerpc/powerpc32
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-10-17 22:22:42 +0000
committerUlrich Drepper <drepper@redhat.com>2002-10-17 22:22:42 +0000
commitb51b47f4ec6708735abd90c38f8725421d4224e2 (patch)
treed056cf9c32c5b953ac81dc78710963905ce7b3c0 /sysdeps/powerpc/powerpc32
parentfbb185220e30cc30a57d62aef6fefeff2d65ccdc (diff)
downloadglibc-b51b47f4ec6708735abd90c38f8725421d4224e2.tar.gz
glibc-b51b47f4ec6708735abd90c38f8725421d4224e2.tar.xz
glibc-b51b47f4ec6708735abd90c38f8725421d4224e2.zip
(__process_machine_rela): Store R_PPC_UADDR32 and R_PPC_UADDR16 one byte at a time. Use __builtin_expect for R_PPC_ADDR24 overflow check. Fix R_PPC_ADDR16, R_PPC_UADDR16 and R_PPC_ADDR14* overflow check, use __builtin_expect.
Diffstat (limited to 'sysdeps/powerpc/powerpc32')
-rw-r--r--sysdeps/powerpc/powerpc32/dl-machine.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/sysdeps/powerpc/powerpc32/dl-machine.c b/sysdeps/powerpc/powerpc32/dl-machine.c
index 28a31f6d91..d444aa5da9 100644
--- a/sysdeps/powerpc/powerpc32/dl-machine.c
+++ b/sysdeps/powerpc/powerpc32/dl-machine.c
@@ -409,25 +409,37 @@ __process_machine_rela (struct link_map *map,
       return;
 
     case R_PPC_ADDR32:
-    case R_PPC_UADDR32:
     case R_PPC_GLOB_DAT:
     case R_PPC_RELATIVE:
       *reloc_addr = finaladdr;
       return;
 
+    case R_PPC_UADDR32:
+      ((char *) reloc_addr)[0] = value >> 24;
+      ((char *) reloc_addr)[1] = value >> 16;
+      ((char *) reloc_addr)[2] = value >> 8;
+      ((char *) reloc_addr)[3] = value;
+      break;
+
     case R_PPC_ADDR24:
-      if (finaladdr > 0x01fffffc && finaladdr < 0xfe000000)
+      if (__builtin_expect (finaladdr > 0x01fffffc && finaladdr < 0xfe000000, 0))
 	dl_reloc_overflow (map,  "R_PPC_ADDR24", reloc_addr, sym, refsym);
       *reloc_addr = (*reloc_addr & 0xfc000003) | (finaladdr & 0x3fffffc);
       break;
 
     case R_PPC_ADDR16:
-    case R_PPC_UADDR16:
-      if (finaladdr > 0x7fff && finaladdr < 0x8000)
+      if (__builtin_expect (finaladdr > 0x7fff && finaladdr < 0xffff8000, 0))
 	dl_reloc_overflow (map,  "R_PPC_ADDR16", reloc_addr, sym, refsym);
       *(Elf32_Half*) reloc_addr = finaladdr;
       break;
 
+    case R_PPC_UADDR16:
+      if (__builtin_expect (finaladdr > 0x7fff && finaladdr < 0xffff8000, 0))
+	dl_reloc_overflow (map,  "R_PPC_UADDR16", reloc_addr, sym, refsym);
+      ((char *) reloc_addr)[0] = value >> 8;
+      ((char *) reloc_addr)[1] = value;
+      break;
+
     case R_PPC_ADDR16_LO:
       *(Elf32_Half*) reloc_addr = finaladdr;
       break;
@@ -443,7 +455,7 @@ __process_machine_rela (struct link_map *map,
     case R_PPC_ADDR14:
     case R_PPC_ADDR14_BRTAKEN:
     case R_PPC_ADDR14_BRNTAKEN:
-      if (finaladdr > 0x7fff && finaladdr < 0x8000)
+      if (__builtin_expect (finaladdr > 0x7fff && finaladdr < 0xffff8000, 0))
 	dl_reloc_overflow (map,  "R_PPC_ADDR14", reloc_addr, sym, refsym);
       *reloc_addr = (*reloc_addr & 0xffff0003) | (finaladdr & 0xfffc);
       if (rinfo != R_PPC_ADDR14)