From: Andrew Waterman Date: Mon, 23 Jan 2017 20:58:30 +0000 (-0800) Subject: Fix segfault when .plt section does not exist X-Git-Tag: gdb-8.0-release~720 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cc16242794b13a5f942badcfffb03be5d81f14f7;p=thirdparty%2Fbinutils-gdb.git Fix segfault when .plt section does not exist bfd/ChangeLog 2017-02-07 Andrew Waterman * elfnn-riscv.c (riscv_elf_finish_dynamic_sections): Only write PLT entry size if PLT header is written. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 8d21e0401e7..f21d6544c1c 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2017-02-07 Andrew Waterman + + * elfnn-riscv.c (riscv_elf_finish_dynamic_sections): Only write PLT + entry size if PLT header is written. + 2017-02-06 Sheldon Lobo Fix sparc64 dynamic relocation processing to use the dynamic diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c index 320d318ce5b..b8dd1f23aa6 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)