[RFC] SHF_GNU_RETAIN ELF Section Flag
Florian Weimer
fweimer@redhat.com
Tue Sep 15 12:37:04 GMT 2020
* Jozef Lawrynowicz:
> On Tue, Sep 15, 2020 at 02:09:22PM +0200, Florian Weimer wrote:
>> * Jozef Lawrynowicz:
>>
>> > I'd like to propose a new ELF section flag, SHF_GNU_RETAIN, for addition
>> > to the GNU gABI.
>> >
>> > This flag instructs the linker to "retain" the section in the output
>> > file, even if garbage collection would remove it because it appears
>> > unused.
>>
>> How does this flag interaction with libraries (.a files)?
>
> If a section in a library has SHF_GNU_RETAIN set, and that library gets
> searched by the linker for some undefined symbol, then the
> SHF_GNU_RETAIN section will also be pulled into the program, and
> retained in the linked output file.
Sorry, that's not quite what I meant. What happens if the .o file with
SHF_GNU_RETAIN in an .a library is not otherwise referenced and thus
never loaded by the link editor? How would the link editor realize that
it is even there?
Thanks,
Florian
--
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill
More information about the Gnu-gabi
mailing list