Fix segfault when .plt section does not exist

Maciej W. Rozycki macro@imgtec.com
Wed Feb 8 09:30:00 GMT 2017


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.

  Maciej



More information about the Binutils mailing list