diff options
author | Ulrich Drepper <drepper@redhat.com> | 2001-02-05 05:59:49 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2001-02-05 05:59:49 +0000 |
commit | b8f7c6f761f47c68d757a211505827020c71c4f9 (patch) | |
tree | 3a86f3309f4f5c341d639fc6c8b4e8be5901f5b6 /sysdeps/arm | |
parent | 1ed6488cdb8fbdfd0b00e237e234b778cdd1aa7d (diff) | |
download | glibc-b8f7c6f761f47c68d757a211505827020c71c4f9.tar glibc-b8f7c6f761f47c68d757a211505827020c71c4f9.tar.gz glibc-b8f7c6f761f47c68d757a211505827020c71c4f9.tar.bz2 glibc-b8f7c6f761f47c68d757a211505827020c71c4f9.zip |
(elf_machine_rel): Correct handling of PC24 relocs with negative value.
Diffstat (limited to 'sysdeps/arm')
-rw-r--r-- | sysdeps/arm/dl-machine.h | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h index 9b40e6f98b..36ae4cf47c 100644 --- a/sysdeps/arm/dl-machine.h +++ b/sysdeps/arm/dl-machine.h @@ -478,17 +478,25 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, case R_ARM_PC24: { Elf32_Sword addend; - Elf32_Addr newvalue; + Elf32_Addr newvalue, topbits; addend = *reloc_addr & 0x00ffffff; if (addend & 0x00800000) addend |= 0xff000000; newvalue = value - (Elf32_Addr)reloc_addr + (addend << 2); - if (newvalue & 0xfc000003) - newvalue = fix_bad_pc24(reloc_addr, value) - - (Elf32_Addr)reloc_addr + (addend << 2); - - newvalue = newvalue >> 2; + topbits = newvalue & 0xfe000000; + if (topbits != 0xfe000000 && topbits != 0x00000000) + { + newvalue = fix_bad_pc24(reloc_addr, value) + - (Elf32_Addr)reloc_addr + (addend << 2); + topbits = newvalue & 0xfe000000; + if (topbits != 0xfe000000 && topbits != 0x00000000) + { + _dl_signal_error (0, map->l_name, + "R_ARM_PC24 relocation out of range"); + } + } + newvalue >>= 2; value = (*reloc_addr & 0xff000000) | (newvalue & 0x00ffffff); *reloc_addr = value; } |