This is the mail archive of the
mailing list for the binutils project.
Re: Fix segfault when .plt section does not exist
- From: Andrew Waterman <andrew at sifive dot com>
- To: "Maciej W. Rozycki" <macro at imgtec dot com>
- Cc: Palmer Dabbelt <palmer at dabbelt dot com>, binutils at sourceware dot org
- Date: Wed, 8 Feb 2017 14:01:49 -0800
- Subject: Re: Fix segfault when .plt section does not exist
- Authentication-results: sourceware.org; auth=none
- References: <alpine.DEB.email@example.com> <firstname.lastname@example.org> <alpine.DEB.email@example.com>
If that is indeed the case, this appears to be handled incorrectly in
several implementations of elf_backend_finish_dynamic_sections -- the
first three I looked at, tilegx, alpha, and ppc64, also seem to rely
only splt->size and do not check if the output section is the absolute
section. (Actually, tilegx looks like it should segfault on
We'll construct a test case and look into this more shortly.
On Wed, Feb 8, 2017 at 1:29 AM, Maciej W. Rozycki <firstname.lastname@example.org> wrote:
> On Fri, 3 Feb 2017, Palmer Dabbelt wrote:
>> Sorry to take a while to get back to you, how does this new version look?
> I see you've committed the change already -- however I'd like to point
> out that I am fairly sure (although not absolutely certain offhand) that
> `splt->size' can actually be non-zero for a discarded `.plt' section, as
> normal processing is done internally as if the section was to be included
> in output, except that ->output_section points to the absolute section.
> You'd have to create a small test case to verify that (mine for PR
> ld/20828 isn't enough as it doesn't actually create a PLT), which could
> then serve as a part of the test suite too.
> NB, although we do handle such a situation in many places across BFD, I
> have identified a couple where we don't, one in the MIPS backend and
> another in generic ELF linker code. I have made patches to adjust those
> places and intend to publish them sometime, however I'm yet thinking what
> to do about some dynamic entries like DT_PLTGOT which are set incorrectly
> when the corresponding section has been removed from output.