summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorDmitry Diky <diwil@spec.ru>2005-08-12 11:45:26 +0000
committerDmitry Diky <diwil@spec.ru>2005-08-12 11:45:26 +0000
commitcbb2a5e194816359efc9d324abba3ac84f98b559 (patch)
tree8131d69c3629af87f7e560cbbea1fd134b495d23 /bfd
parentf717be4fbf0d56953b0eb27f61355a43240f69c3 (diff)
downloadgdb-cbb2a5e194816359efc9d324abba3ac84f98b559.tar.gz
2005-08-12 Dmitry Diky <diwil@spec.ru>
* elf32-msp430.c (msp430_elf_relax_delete_bytes): Adjust relocations referenced by .section + DISPLACEMENT.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf32-msp430.c18
2 files changed, 20 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index a7a7608d5ad..aa15d4cb447 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2005-08-12 Dmitry Diky <diwil@spec.ru>
+
+ * elf32-msp430.c (msp430_elf_relax_delete_bytes): Adjust relocations
+ referenced by .section + DISPLACEMENT.
+
2005-08-10 James E. Wilson <wilson@specifix.com>
* dwarf2.c (scan_unit_for_symbols, case DT_AT_location): Verify that
diff --git a/bfd/elf32-msp430.c b/bfd/elf32-msp430.c
index da4278267c3..3aec7aaebe6 100644
--- a/bfd/elf32-msp430.c
+++ b/bfd/elf32-msp430.c
@@ -868,10 +868,22 @@ msp430_elf_relax_delete_bytes (bfd * abfd, asection * sec, bfd_vma addr,
sec->size -= count;
/* Adjust all the relocs. */
+ symtab_hdr = & elf_tdata (abfd)->symtab_hdr;
+ isym = (Elf_Internal_Sym *) symtab_hdr->contents;
for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++)
- /* Get the new reloc address. */
- if ((irel->r_offset > addr && irel->r_offset < toaddr))
- irel->r_offset -= count;
+ {
+ int sidx = ELF32_R_SYM(irel->r_info);
+ Elf_Internal_Sym *lsym = isym + sidx;
+
+ /* Get the new reloc address. */
+ if ((irel->r_offset > addr && irel->r_offset < toaddr))
+ irel->r_offset -= count;
+
+ /* Adjust symbols referenced by .sec+0xXX */
+ if (irel->r_addend > addr && irel->r_addend < toaddr
+ && lsym->st_shndx == sec_shndx)
+ irel->r_addend -= count;
+ }
/* Adjust the local symbols defined in this section. */
symtab_hdr = & elf_tdata (abfd)->symtab_hdr;