This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH]: relaxation fix.
- From: Dmitry Diky <ddiky at alarity dot com>
- To: binutils at sources dot redhat dot com
- Date: Fri, 12 Aug 2005 15:10:46 +0400
- Subject: [PATCH]: relaxation fix.
- Reply-to: ddiky at alarity dot com
Fellows,
the following patch fixes the problem with relaxation when local label
referenced by .sectionname+DISPLACEMENT (.text+0x10 for example).
Cheers,
Dmitry.
2005-08-10 Dmitry Diky <diwil@spec.ru>
* elf32-msp430.c (msp430_elf_relax_delete_bytes): Adjust relocations
referenced by .section + DISPLACEMENT.
Index: elf32-msp430.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-msp430.c,v
retrieving revision 1.11
diff -c -3 -p -r1.11 elf32-msp430.c
*** elf32-msp430.c 20 Jun 2005 18:12:07 -0000 1.11
--- elf32-msp430.c 12 Aug 2005 11:05:19 -0000
*************** msp430_elf_relax_delete_bytes (bfd * abf
*** 868,877 ****
sec->size -= count;
/* Adjust all the relocs. */
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;
/* Adjust the local symbols defined in this section. */
symtab_hdr = & elf_tdata (abfd)->symtab_hdr;
--- 868,889 ----
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++)
! {
! 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;