This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: --gc-sections and C library linkage issues (?)
- To: alan at linuxcare dot com dot au
- Subject: Re: --gc-sections and C library linkage issues (?)
- From: Geoff Keating <geoffk at cygnus dot com>
- Date: Fri, 25 Aug 2000 01:04:36 -0700
- CC: drepper at cygnus dot com, bkoz at redhat dot com, bug-glibc at gnu dot org, binutils at sources dot redhat dot com
- References: <Pine.LNX.4.21.0008251144540.12108-100000@front.linuxcare.com.au>
> Date: Fri, 25 Aug 2000 12:09:29 +1000 (EST)
> From: Alan Modra <alan@linuxcare.com.au>
> --gc-sections discards a section which isn't referenced via any of
> it's symbols. That seems quite a proper implementation. The problem
> really is that glibc doesn't make such a symbol reference. You should be
> able to do this with a reference to the section symbol from any section
> that you know will escape garbage collection.
>
> Hmm, I suppose it would be nice if you could tell the assembler to keep
> a section via a section attribute. If you would like to suggest
> semantics, I'll implement it.
The usual way this is done is with a special reloc, like
BFD_RELOC_PPC_EMB_MRKREF, which doesn't actually relocate anything.
You can attach the reloc to, say, the global data item which is
constructed, so that if the data item is included so will the
constructor be. It would be helpful if the assembler had a way to ask
for such a reloc to be emitted...
If you always wanted a section included, you could just add such a
reloc to the text section, or some section that you knew would be
included in the final link (I think).
--
- Geoffrey Keating <geoffk@cygnus.com>