This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: Add GNU_PROPERTY_NEED_PHDRS


On Thu, Oct 04, 2018 at 09:33:43AM -0700, H.J. Lu wrote:
> 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.

Can you elaborate on what would go wrong with them? AIUI they can't
remove anything from segments; they can only remove non-loaded
sections. (I found this out the hard way a long time ago trying to get
strip to remove unneeded .eh_frame)

Rich


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]