This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Section garbage collection problem
Hi,
On Sunday 16 September 2007 23:20, H.J. Lu wrote:
> On Sun, Sep 16, 2007 at 07:42:25PM +0100, Denys Vlasenko wrote:
> > I nned to fix it so that it looks like this:
> >
> > ... -> .text.f_used -> .smp_locks.AAAA -> .text.f_used
> > .text.unused -> .smp_locks.BBBB -> .text.unused
> >
> > And ld will throw .text.unused and .smp_locks.BBBB sections away.
> >
> > How to achieve this?
>
> Have you tried comdat group? That is put .text.unused and
> .smp_locks.BBBB in the same comdat group. When ld discards
> .text.unused, it will discard .smp_locks.BBBB automatically
> together.
Well, ... what is comdat group?...
I'm not sure that I explained it well enough, so
a bit of clarification: I don't try to make ld --gc-sections
discard .text.unused and .smp_locks.BBBB in this situation:
... -> .text.f_used -> .smp_locks.AAAA -> .text.f_used
.text.unused -> .smp_locks.BBBB -> .text.unused
because it is already working.
My problem is how to _make section dependency graph look
like above_, because currently it looks like
... -> .text.f_used -> .smp_locks.AAAA -> .text.f_used
.text.unused -> .smp_locks.AAAA -> .text.unused
In this graph, .text.unused is erroneously seen as "used" by ld,
because two ".smp_locks.AAAA" sections are coalesced into one
(because I cannot produce unique section name... see the first
message in the thread).
--
vda