summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorDaniel Jacobowitz <dan@debian.org>2005-06-10 20:22:23 +0000
committerDaniel Jacobowitz <dan@debian.org>2005-06-10 20:22:23 +0000
commitc3148b6799ed1ab262fb1ef6414fc0e09a006ab3 (patch)
tree80abc3ebb62f69ce76fd67016781b5cbd6ae6b93 /bfd
parent0ff46f59e292d312f96e6d687082526d6afe9a1e (diff)
downloadbinutils-redhat-c3148b6799ed1ab262fb1ef6414fc0e09a006ab3.tar.gz
* elfcode.h (elf_write_relocs): Do nothing if there are no
relocations.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elfcode.h6
2 files changed, 11 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 407820ae64..91240207f5 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2005-06-10 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * elfcode.h (elf_write_relocs): Do nothing if there are no
+ relocations.
+
2005-06-10 Alan Modra <amodra@bigpond.net.au>
* dwarf2.c (decode_line_info): Revert last change. Instead set
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index 6cb3ca299a..ed0da32591 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;