This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Fix segfault when .plt section does not exist
- From: Palmer Dabbelt <palmer at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 8 Feb 2017 02:02:44 -0000
- Subject: [binutils-gdb] Fix segfault when .plt section does not exist
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=cc16242794b13a5f942badcfffb03be5d81f14f7
commit cc16242794b13a5f942badcfffb03be5d81f14f7
Author: Andrew Waterman <andrew@sifive.com>
Date: Mon Jan 23 12:58:30 2017 -0800
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.
Diff:
---
bfd/ChangeLog | 5 +++++
bfd/elfnn-riscv.c | 6 +++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 8d21e04..f21d654 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+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.
+
2017-02-06 Sheldon Lobo <sheldon.lobo@oracle.com>
Fix sparc64 dynamic relocation processing to use the dynamic
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c
index 320d318..b8dd1f2 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)