aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf-m10300.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2007-10-31 11:33:27 +0000
committerNick Clifton <nickc@redhat.com>2007-10-31 11:33:27 +0000
commitcf4a529b63dcef6386b6c96712b4fe5bf84cfa05 (patch)
treea31eeee8728746c2ec097e31131e575abbd31696 /bfd/elf-m10300.c
parentebc056ca1b4add6e9658353f339e71db7c69890c (diff)
downloadgdb-cf4a529b63dcef6386b6c96712b4fe5bf84cfa05.zip
gdb-cf4a529b63dcef6386b6c96712b4fe5bf84cfa05.tar.gz
gdb-cf4a529b63dcef6386b6c96712b4fe5bf84cfa05.tar.bz2
* elf-m10300.c (mn10300_elf_relax_delete_bytes): Do not look for align
relocs when there are no relocs attached to the section.
Diffstat (limited to 'bfd/elf-m10300.c')
-rw-r--r--bfd/elf-m10300.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index db8114e..7c51498 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,