summaryrefslogtreecommitdiff
path: root/bfd/elf32-avr.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2009-02-18 15:28:56 +0000
committerNick Clifton <nickc@redhat.com>2009-02-18 15:28:56 +0000
commitd22b21de4df9cc2d217d2623748c03ce2d88b75c (patch)
treefaafa77b95dbdea45c4cf9d5d40610acc8d16404 /bfd/elf32-avr.c
parente45cbcf9c5a25ccbdd76e996e31656b6af883624 (diff)
downloadbinutils-redhat-d22b21de4df9cc2d217d2623748c03ce2d88b75c.tar.gz
PR 9841
* elf32-avr.c: Handle case where no local symbos exist correctly.
Diffstat (limited to 'bfd/elf32-avr.c')
-rw-r--r--bfd/elf32-avr.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c
index afcef18aa3..9190db35d5 100644
--- a/bfd/elf32-avr.c
+++ b/bfd/elf32-avr.c
@@ -1415,7 +1415,6 @@ elf32_avr_relax_delete_bytes (bfd *abfd,
Elf_Internal_Rela *irelalign;
Elf_Internal_Sym *isym;
Elf_Internal_Sym *isymbuf = NULL;
- Elf_Internal_Sym *isymend;
bfd_vma toaddr;
struct elf_link_hash_entry **sym_hashes;
struct elf_link_hash_entry **end_hashes;
@@ -1553,13 +1552,19 @@ elf32_avr_relax_delete_bytes (bfd *abfd,
/* Adjust the local symbols defined in this section. */
isym = (Elf_Internal_Sym *) symtab_hdr->contents;
- isymend = isym + symtab_hdr->sh_info;
- for (; isym < isymend; isym++)
+ /* Fix PR 9841, there may be no local symbols. */
+ if (isym != NULL)
{
- if (isym->st_shndx == sec_shndx
- && isym->st_value > addr
- && isym->st_value < toaddr)
- isym->st_value -= count;
+ Elf_Internal_Sym *isymend;
+
+ isymend = isym + symtab_hdr->sh_info;
+ for (; isym < isymend; isym++)
+ {
+ if (isym->st_shndx == sec_shndx
+ && isym->st_value > addr
+ && isym->st_value < toaddr)
+ isym->st_value -= count;
+ }
}
/* Now adjust the global symbols defined in this section. */