This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Fix segfault when .plt section does not exist
- From: Palmer Dabbelt <palmer at dabbelt dot com>
- To: binutils at sourceware dot org
- Cc: macro at imgtec dot com
- Cc: Andrew Waterman <andrew at sifive dot com>
- Date: Tue, 07 Feb 2017 18:05:54 -0800 (PST)
- Subject: Re: [PATCH] Fix segfault when .plt section does not exist
- Authentication-results: sourceware.org; auth=none
On Fri, 03 Feb 2017 13:12:14 PST (-0800), Palmer Dabbelt wrote:
> From: Andrew Waterman <andrew@sifive.com>
>
> bfd/ChangeLog
>
> 2017-01-09 Andrew Waterman <andrew@sifive.com>
>
> * elfnn-riscv.c (riscv_elf_finish_dynamic_sections): Only write PLT
> entry size if PLT header is written.
> ---
> bfd/elfnn-riscv.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> 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)
Committed.