* elf-m10300.c (mn10300_elf_relax_delete_bytes): Do not look for align

relocs when there are no relocs attached to the section.
This commit is contained in:
Nick Clifton
2007-10-31 11:33:27 +00:00
parent ebc056ca1b
commit cf4a529b63
2 changed files with 25 additions and 17 deletions

View File

@ -1,3 +1,8 @@
2007-10-31 Nick Clifton <nickc@redhat.com>
* 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 <amodra@bigpond.net.au> 2007-10-31 Alan Modra <amodra@bigpond.net.au>
* elf-bfd.h (bfd_elf_match_symbols_in_sections): Don't declare. * elf-bfd.h (bfd_elf_match_symbols_in_sections): Don't declare.

View File

@ -1847,24 +1847,27 @@ mn10300_elf_relax_delete_bytes (bfd *abfd,
irel = elf_section_data (sec)->relocs; irel = elf_section_data (sec)->relocs;
irelend = irel + sec->reloc_count; irelend = irel + sec->reloc_count;
/* If there is an align reloc at the end of the section ignore it. if (sec->reloc_count > 0)
GAS creates these relocs for reasons of its own, and they just {
serve to keep the section artifically inflated. */ /* If there is an align reloc at the end of the section ignore it.
if (ELF32_R_TYPE ((irelend - 1)->r_info) == (int) R_MN10300_ALIGN) GAS creates these relocs for reasons of its own, and they just
--irelend; 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 /* The deletion must stop at the next ALIGN reloc for an aligment
power larger than the number of bytes we are deleting. */ power larger than the number of bytes we are deleting. */
for (; irel < irelend; irel++) for (; irel < irelend; irel++)
if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_ALIGN if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_ALIGN
&& irel->r_offset > addr && irel->r_offset > addr
&& irel->r_offset < toaddr && irel->r_offset < toaddr
&& count < (1 << irel->r_addend)) && count < (1 << irel->r_addend))
{ {
irelalign = irel; irelalign = irel;
toaddr = irel->r_offset; toaddr = irel->r_offset;
break; break;
} }
}
/* Actually delete the bytes. */ /* Actually delete the bytes. */
memmove (contents + addr, contents + addr + count, memmove (contents + addr, contents + addr + count,