aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfcode.h
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2005-06-10 20:22:23 +0000
committerDaniel Jacobowitz <drow@false.org>2005-06-10 20:22:23 +0000
commit9a44bbd9a91ae803253982ac762d7f8454f37652 (patch)
treee6f5f4c5313dfd3329e839676a98e43363472388 /bfd/elfcode.h
parenta345bcaad9967e3c978ab5aa4418ae905a418b89 (diff)
downloadgdb-9a44bbd9a91ae803253982ac762d7f8454f37652.zip
gdb-9a44bbd9a91ae803253982ac762d7f8454f37652.tar.gz
gdb-9a44bbd9a91ae803253982ac762d7f8454f37652.tar.bz2
* elfcode.h (elf_write_relocs): Do nothing if there are no
relocations.
Diffstat (limited to 'bfd/elfcode.h')
-rw-r--r--bfd/elfcode.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index 6cb3ca2..ed0da32 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;