aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfnn-riscv.c
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2017-01-23 12:58:30 -0800
committerPalmer Dabbelt <palmer@dabbelt.com>2017-02-07 18:02:12 -0800
commitcc16242794b13a5f942badcfffb03be5d81f14f7 (patch)
tree2f52c0af27139e52bd71653ceb63703e358d2e22 /bfd/elfnn-riscv.c
parentb2680bc51cf0f30c0222972170c42c8dce1ba444 (diff)
Fix segfault when .plt section does not exist
bfd/ChangeLog 2017-02-07 Andrew Waterman <andrew@sifive.com> * elfnn-riscv.c (riscv_elf_finish_dynamic_sections): Only write PLT entry size if PLT header is written.
Diffstat (limited to 'bfd/elfnn-riscv.c')
-rw-r--r--bfd/elfnn-riscv.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c
index 320d318ce5..b8dd1f23aa 100644
--- a/bfd/elfnn-riscv.c
+++ b/bfd/elfnn-riscv.c
@@ -2502,10 +2502,10 @@ riscv_elf_finish_dynamic_sections (bfd *output_bfd,
for (i = 0; i < PLT_HEADER_INSNS; i++)
bfd_put_32 (output_bfd, plt_header[i], splt->contents + 4*i);
- }
- elf_section_data (splt->output_section)->this_hdr.sh_entsize
- = PLT_ENTRY_SIZE;
+ elf_section_data (splt->output_section)->this_hdr.sh_entsize
+ = PLT_ENTRY_SIZE;
+ }
}
if (htab->elf.sgotplt)