--gc-sections and C library linkage issues (?)
Alan Modra
alan@linuxcare.com.au
Thu Aug 24 20:41:00 GMT 2000
On 24 Aug 2000, Ulrich Drepper wrote:
> Alan Modra <alan@linuxcare.com.au> writes:
>
> > You should be able to do this with a reference to the section symbol
> > from any section that you know will escape garbage collection.
>
> No, this is not how it's supposed to work. Different .o files
> constribute to special sections but only if the functions in those .o
> files are used.
Oh yeah, that's right, garbage collection is on an input section basis, so
my idea of referencing the section symbol is completely bogus.
That leaves us with either
a) deciding on a set of specially named sections that will have the
KEEP attribute set, modifying the linker script to suit, and
ensuring glibc uses these sections.
or b) defining a new section attribute that sets SEC_KEEP.
or c) something else I haven't thought of.
I don't particularly like a). Adding support in gas/config/obj-elf.c for
a "k" section attribute letter and corresponding "keep" section attribute
word is trivial. The only tricky thing to decide is whether such an
attribute needs to appear in the elf section flags (ie. needs a new SHF_
flag), or should just affect the BFD section flags. I'm inclined to think
there is no need for a new SHF_ flag.
Comments?
Alan Modra
--
Linuxcare. Support for the Revolution.
More information about the Binutils
mailing list