aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2009-08-14 03:44:21 +0000
committerDJ Delorie <dj@redhat.com>2009-08-14 03:44:21 +0000
commita109e2f5583d186cb85203cf65900b6dd138993d (patch)
tree6d2d77cb405655a1cf21f190ccef75190c3ad03f
parent759ef83693911e20efd389b20cbf8f3a8eec30eb (diff)
downloadfsf-binutils-gdb-a109e2f5583d186cb85203cf65900b6dd138993d.zip
fsf-binutils-gdb-a109e2f5583d186cb85203cf65900b6dd138993d.tar.gz
fsf-binutils-gdb-a109e2f5583d186cb85203cf65900b6dd138993d.tar.bz2
* elf32-m32c.c (m32c_elf_relax_delete_bytes): Adjust symbol sizes
if needed.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf32-m32c.c31
2 files changed, 30 insertions, 6 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index fd54cb9..ecca9ca 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2009-08-13 DJ Delorie <dj@redhat.com>
+
+ * elf32-m32c.c (m32c_elf_relax_delete_bytes): Adjust symbol sizes
+ if needed.
+
2009-08-12 Nick Clifton <nickc@redhat.com>
* po/fi.po: Updated Finnish translation.
diff --git a/bfd/elf32-m32c.c b/bfd/elf32-m32c.c
index 5f45784..8805d61 100644
--- a/bfd/elf32-m32c.c
+++ b/bfd/elf32-m32c.c
@@ -1951,13 +1951,24 @@ m32c_elf_relax_delete_bytes
for (; isym < isymend; isym++, shndx = (shndx ? shndx + 1 : NULL))
{
-
+ /* If the symbol is in the range of memory we just moved, we
+ have to adjust its value. */
if ((int) isym->st_shndx == sec_shndx
&& isym->st_value > addr
&& isym->st_value < toaddr)
{
isym->st_value -= count;
}
+ /* If the symbol *spans* the bytes we just deleted (i.e. it's
+ *end* is in the moved bytes but it's *start* isn't), then we
+ must adjust its size. */
+ if ((int) isym->st_shndx == sec_shndx
+ && isym->st_value < addr
+ && isym->st_value + isym->st_size > addr
+ && isym->st_value + isym->st_size < toaddr)
+ {
+ isym->st_size -= count;
+ }
}
/* Now adjust the global symbols defined in this section. */
@@ -1972,13 +1983,21 @@ m32c_elf_relax_delete_bytes
struct elf_link_hash_entry * sym_hash = * sym_hashes;
if (sym_hash &&
- ( sym_hash->root.type == bfd_link_hash_defined
+ (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.section == sec)
{
- sym_hash->root.u.def.value -= count;
+ if (sym_hash->root.u.def.value > addr
+ && sym_hash->root.u.def.value < toaddr)
+ {
+ sym_hash->root.u.def.value -= count;
+ }
+ if (sym_hash->root.u.def.value < addr
+ && sym_hash->root.u.def.value + sym_hash->size > addr
+ && sym_hash->root.u.def.value + sym_hash->size < toaddr)
+ {
+ sym_hash->size -= count;
+ }
}
}