(__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.

This commit is contained in:
Ulrich Drepper 2002-10-17 22:22:42 +00:00
parent fbb185220e
commit b51b47f4ec

View File

@ -409,25 +409,37 @@ __process_machine_rela (struct link_map *map,
return; return;
case R_PPC_ADDR32: case R_PPC_ADDR32:
case R_PPC_UADDR32:
case R_PPC_GLOB_DAT: case R_PPC_GLOB_DAT:
case R_PPC_RELATIVE: case R_PPC_RELATIVE:
*reloc_addr = finaladdr; *reloc_addr = finaladdr;
return; 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: 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); dl_reloc_overflow (map, "R_PPC_ADDR24", reloc_addr, sym, refsym);
*reloc_addr = (*reloc_addr & 0xfc000003) | (finaladdr & 0x3fffffc); *reloc_addr = (*reloc_addr & 0xfc000003) | (finaladdr & 0x3fffffc);
break; break;
case R_PPC_ADDR16: case R_PPC_ADDR16:
case R_PPC_UADDR16: if (__builtin_expect (finaladdr > 0x7fff && finaladdr < 0xffff8000, 0))
if (finaladdr > 0x7fff && finaladdr < 0x8000)
dl_reloc_overflow (map, "R_PPC_ADDR16", reloc_addr, sym, refsym); dl_reloc_overflow (map, "R_PPC_ADDR16", reloc_addr, sym, refsym);
*(Elf32_Half*) reloc_addr = finaladdr; *(Elf32_Half*) reloc_addr = finaladdr;
break; 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: case R_PPC_ADDR16_LO:
*(Elf32_Half*) reloc_addr = finaladdr; *(Elf32_Half*) reloc_addr = finaladdr;
break; break;
@ -443,7 +455,7 @@ __process_machine_rela (struct link_map *map,
case R_PPC_ADDR14: case R_PPC_ADDR14:
case R_PPC_ADDR14_BRTAKEN: case R_PPC_ADDR14_BRTAKEN:
case R_PPC_ADDR14_BRNTAKEN: 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); dl_reloc_overflow (map, "R_PPC_ADDR14", reloc_addr, sym, refsym);
*reloc_addr = (*reloc_addr & 0xffff0003) | (finaladdr & 0xfffc); *reloc_addr = (*reloc_addr & 0xffff0003) | (finaladdr & 0xfffc);
if (rinfo != R_PPC_ADDR14) if (rinfo != R_PPC_ADDR14)