about summary refs log tree commit diff
diff options
context:
space:
mode:
-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)