From: Nick Clifton Date: Wed, 31 Oct 2007 11:33:27 +0000 (+0000) Subject: * elf-m10300.c (mn10300_elf_relax_delete_bytes): Do not look for align X-Git-Tag: insight_6_8-branchpoint~649 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=793528ff798c5324efcb57f1242c27b6eb017eb7;p=pf3gnuchains%2Fpf3gnuchains4x.git * elf-m10300.c (mn10300_elf_relax_delete_bytes): Do not look for align relocs when there are no relocs attached to the section. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 6647eae540..7543f62e26 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2007-10-31 Nick Clifton + + * elf-m10300.c (mn10300_elf_relax_delete_bytes): Do not look for + align relocs when there are no relocs attached to the section. + 2007-10-31 Alan Modra * elf-bfd.h (bfd_elf_match_symbols_in_sections): Don't declare. diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index db8114e53d..7c51498aa1 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -1847,24 +1847,27 @@ mn10300_elf_relax_delete_bytes (bfd *abfd, irel = elf_section_data (sec)->relocs; irelend = irel + sec->reloc_count; - /* If there is an align reloc at the end of the section ignore it. - GAS creates these relocs for reasons of its own, and they just - serve to keep the section artifically inflated. */ - if (ELF32_R_TYPE ((irelend - 1)->r_info) == (int) R_MN10300_ALIGN) - --irelend; + if (sec->reloc_count > 0) + { + /* If there is an align reloc at the end of the section ignore it. + GAS creates these relocs for reasons of its own, and they just + serve to keep the section artifically inflated. */ + if (ELF32_R_TYPE ((irelend - 1)->r_info) == (int) R_MN10300_ALIGN) + --irelend; - /* The deletion must stop at the next ALIGN reloc for an aligment - power larger than the number of bytes we are deleting. */ - for (; irel < irelend; irel++) - if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_ALIGN - && irel->r_offset > addr - && irel->r_offset < toaddr - && count < (1 << irel->r_addend)) - { - irelalign = irel; - toaddr = irel->r_offset; - break; - } + /* The deletion must stop at the next ALIGN reloc for an aligment + power larger than the number of bytes we are deleting. */ + for (; irel < irelend; irel++) + if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_ALIGN + && irel->r_offset > addr + && irel->r_offset < toaddr + && count < (1 << irel->r_addend)) + { + irelalign = irel; + toaddr = irel->r_offset; + break; + } + } /* Actually delete the bytes. */ memmove (contents + addr, contents + addr + count,