------- Additional Comments From pwilson at scopuli dot com 2009-02-14 18:41 ------- I looked at the context of the call to elf32_avr_relax_delete_bytes() and how symtab_hdr->contents is assigned. I then compared the AVR to other architectures calling their elf32_*_relax_delete_bytes() function, and it appears to me that the AVR relax implementation is based upon the h8300 relax implementation. In fact, I searched for h8300 in elf32-avr.c and found a reference to cut-n-pasting code from the h8300 port.
So I looked at the calls to elf32_h8_relax_delete_bytes(), and before every call there are these lines of code: elf_section_data (sec)->relocs = internal_relocs; elf_section_data (sec)->this_hdr.contents = contents; symtab_hdr->contents = (unsigned char *) isymbuf; Those lines of code also appear before the only other call to elf32_avr_relax_delete_bytes() within elf32-avr.c. These lines are missing before the call to elf32_avr_relax_delete_bytes() where the crash happens, and I believe that is the source of the problem. I placed those assignments within the if (deleting_ret_is_safe) block before the call to elf32_avr_relax_delete_bytes() and that fixes the problem. Here is a proposed patch diff -Nur binutils-2.19-orig/bfd/elf32-avr.c binutils-2.19/bfd/elf32-avr.c --- binutils-2.19-orig/bfd/elf32-avr.c 2009-02-14 12:54:24.000000000 -0500 +++ binutils-2.19/bfd/elf32-avr.c 2009-02-14 13:06:49.000000000 -0500 @@ -2252,6 +2252,12 @@ "at address 0x%x deleted.\n", (int) dot + insn_size); + /* Note that we've changed the relocs, + section contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + /* Delete two bytes of data. */ if (!elf32_avr_relax_delete_bytes (abfd, sec, irel->r_offset + insn_size, 2)) -- http://sourceware.org/bugzilla/show_bug.cgi?id=9841 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils