[RFC] SHF_GNU_RETAIN ELF Section Flag
Michael Matz
matz@suse.de
Wed Sep 16 13:46:38 GMT 2020
Hello,
On Wed, 16 Sep 2020, Florian Weimer via Gnu-gabi wrote:
> * Jozef Lawrynowicz:
>
> > I suppose the most compelling use cases for SHF_GNU_RETAIN are when the
> > dependency cannot be expressed with references to ELF sections. You
> > can't use SHF_GROUP because there is nothing to group the section with.
>
> But if there is nothing to group the section with, why would the link
> editor load the object?
>
> That's the part I don't understand.
Hmm? By putting it on the command line:
% ld --gc-sections needed.o
should retain the RETAIN sections from needed.o, even if otherwise not
seemingly referenced.
(I'm not sure if doing this via a group flag, or via a section flag would
be better here. In a way I find the section flag more appealing, it's the
less complicated way to state "don't GC this section").
Ciao,
Michael.
More information about the Gnu-gabi
mailing list