This is the mail archive of the binutils@sources.redhat.com 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: How to preserve section group for ld -r?


"H. J. Lu" <hjl@lucon.org> writes:

> The current linker doesn't preserve section group for ld -r since
> the group section isn't mentioned in the linker script. But I am
> having difficulty adding the group section to the linker script. The
> plan is
> 
> 1. All group sections should have name of ".group.signature" since
> the linker script doesn't know SHT_GROUP.
> 2. They will be marked with SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD.
> 3. Modify the linker scripte to preserve ".group.*" sections for ld -r.
> 
> How do I express #3 in a linker script?

I think we should steer away from relying on section names where that
is reasonable.  Since ld -r normally preserves input sections which
are not explicitly mentioned in the linker script, and that is more or
less what we want to have happen, I don't see any reason why we should
impose a restriction on section names here.  I think ld -r should just
preserve input SHT_GROUP sections, without relying on the linker
script to make that work.

I haven't followed the SHT_GROUP work much, so I'm not sure how best
to handle this.  It would mainly depend upon how SHT_GROUP is exposed
in the BFD interface.  We may need to address that, so that
lang_place_orphans() do the right thing.

I'm not opposed to adding syntax to linker scripts to permit SHT_GROUP
sections to be defined, but I don't think we should rely on such
syntax to make ld -r work properly.

Ian


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