RFC: Add GNU_PROPERTY_NEED_PHDRS

H.J. Lu hjl.tools@gmail.com
Thu Oct 4 16:34:00 GMT 2018


On Thu, Oct 4, 2018 at 8:10 AM Cary Coutant <ccoutant@gmail.com> wrote:
>
> > If you specify PHDRS in a script, ld uses exactly those program
> > headers, and I believe it should continue to operate that way.  So to
> > add PT_GNU_EH_FRAME, say, when an executable has .eh_frame_hdr, you'd
> > need a script with PT_GNU_EH_FRAME specified in PHDRS.  And another
> > without PT_GNU_EH_FRAME when the executable doesn't have
> > .eh_frame_hdr.  That soon becomes impractial considering the number of
> > optional headers, requiring auto-generation of the PHDRS script
> > snippet.
>
> Oh, I see. Yeah, that does make it impractical.
>
> Still, I'd like to understand why HJ claims it's intrusive to have ld
> create a PT_LOAD segment for the headers. I haven't tried it yet in
> gold (don't support -z separate-code), but it doesn't seem like it
> would be at all difficult or intrusive.

The linker part is relatively easy.  The problems are with strip and
objcopy.  They aren't prepared to deal with it.

-- 
H.J.



More information about the Binutils mailing list