RFC: Add SHT_GNU_PHDRS

Michael Matz matz@suse.de
Fri Sep 28 13:28:00 GMT 2018


Hi,

On Fri, 28 Sep 2018, Florian Weimer wrote:

> > This section hack isn't necessary at all for what we need.  The link 
> > editor merely needs to ensure that the program headers are part of 
> > some loadable segment, either by placing it not at the start of the 
> > file (though that would mean the ELF header isn't part of the loaded 
> > image, which is desirable to have), or by creating such loadble 
> > segment if necessary.
> >
> > No gABI extensions are needed.
> 
> That would certainly be nice.
> 
> Can we try to update the ELF specification to clarify this?

Maybe.

> That should give us additional feedback whether this reading of the 
> specification is correct.

Well, at least the part about sections being purely optional is undeniably 
true.  The section headers themself were never part of the loaded 
image (nor part of any section for that matter).

Now the but: I would agree that it would be nice if all file contents 
would be covered by some section if section headers are in the file at 
all, simply because the named sections are easier for humans to deal with 
than numbered program headers, so that their use in tools (like e.g. 
readelf -x) is comfortable.  But that's independend and outside of what's 
required by ELF.  If we go down that route then we should go the full way 
and cover the ELF header, the program headers and the section headers with 
sections as well.  I don't see why they would need their own type though, 
PROGBITS is just fine.  And again, all that would be optional and a pure 
QoI issue.


Ciao,
Michael.



More information about the Binutils mailing list