aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-h8300.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2013-03-22 15:53:36 +0000
committerNick Clifton <nickc@redhat.com>2013-03-22 15:53:36 +0000
commit5c0df4846e5e0f668376c153ff69fd8bf1461df3 (patch)
treed7f9dee01fff6ab93df32fe77bd31fc2dcd02c06 /bfd/elf32-h8300.c
parent3e74e146f297ec074e10c2b9a9e5869ec536649d (diff)
downloadgdb-5c0df4846e5e0f668376c153ff69fd8bf1461df3.zip
gdb-5c0df4846e5e0f668376c153ff69fd8bf1461df3.tar.gz
gdb-5c0df4846e5e0f668376c153ff69fd8bf1461df3.tar.bz2
PR ld/14902
* elf32-h8300.c (elf32_h8_relax_delete_bytes): Fix off by one errors adjusting relocs and symbols.
Diffstat (limited to 'bfd/elf32-h8300.c')
-rw-r--r--bfd/elf32-h8300.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c
index 4cfc30e..67bca3f 100644
--- a/bfd/elf32-h8300.c
+++ b/bfd/elf32-h8300.c
@@ -1518,7 +1518,7 @@ elf32_h8_relax_delete_bytes (bfd *abfd, asection *sec, bfd_vma addr, int count)
{
/* Get the new reloc address. */
if ((irel->r_offset > addr
- && irel->r_offset < toaddr))
+ && irel->r_offset <= toaddr))
irel->r_offset -= count;
}
@@ -1530,7 +1530,7 @@ elf32_h8_relax_delete_bytes (bfd *abfd, asection *sec, bfd_vma addr, int count)
{
if (isym->st_shndx == sec_shndx
&& isym->st_value > addr
- && isym->st_value < toaddr)
+ && isym->st_value <= toaddr)
isym->st_value -= count;
}
@@ -1542,14 +1542,13 @@ elf32_h8_relax_delete_bytes (bfd *abfd, asection *sec, bfd_vma addr, int count)
for (; sym_hashes < end_hashes; sym_hashes++)
{
struct elf_link_hash_entry *sym_hash = *sym_hashes;
+
if ((sym_hash->root.type == bfd_link_hash_defined
|| sym_hash->root.type == bfd_link_hash_defweak)
&& sym_hash->root.u.def.section == sec
&& sym_hash->root.u.def.value > addr
- && sym_hash->root.u.def.value < toaddr)
- {
- sym_hash->root.u.def.value -= count;
- }
+ && sym_hash->root.u.def.value <= toaddr)
+ sym_hash->root.u.def.value -= count;
}
return TRUE;