From: Daniel Jacobowitz Date: Fri, 10 Jun 2005 20:22:23 +0000 (+0000) Subject: * elfcode.h (elf_write_relocs): Do nothing if there are no X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9a44bbd9a91ae803253982ac762d7f8454f37652;p=binutils-gdb.git * elfcode.h (elf_write_relocs): Do nothing if there are no relocations. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 407820ae643..91240207f5a 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2005-06-10 Daniel Jacobowitz + + * elfcode.h (elf_write_relocs): Do nothing if there are no + relocations. + 2005-06-10 Alan Modra * dwarf2.c (decode_line_info): Revert last change. Instead set diff --git a/bfd/elfcode.h b/bfd/elfcode.h index 6cb3ca299ab..ed0da32591c 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -875,6 +875,12 @@ elf_write_relocs (bfd *abfd, asection *sec, void *data) if (sec->reloc_count == 0) return; + /* If we have opened an existing file for update, reloc_count may be + set even though we are not linking. In that case we have nothing + to do. */ + if (sec->orelocation == NULL) + return; + rela_hdr = &elf_section_data (sec)->rel_hdr; rela_hdr->sh_size = rela_hdr->sh_entsize * sec->reloc_count;