This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Section garbage collection problem
- From: Andi Kleen <andi at firstfloor dot org>
- To: Denys Vlasenko <vda dot linux at googlemail dot com>
- Cc: binutils at sourceware dot org, "H.J. Lu" <hjl at lucon dot org>, Alan Modra <amodra at bigpond dot net dot au>
- Date: 19 Sep 2007 14:07:27 +0200
- Subject: Re: Section garbage collection problem
- References: <200709161942.25443.vda.linux@googlemail.com>
Denys Vlasenko <vda.linux@googlemail.com> writes:
>
> Otherwise, ld will discard .smp_locks sections, because
> there is no references to them from anywhere.
Actually there should be a reference to it in the start/end labels
which are referenced by the patching code.
Unfortunately they are currently outside the section. All you need
to do is to move them inside.
e.g.
__smp_locks = .;
.smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
*(.smp_locks)
}
__smp_locks_end = .;
to (untested)
.smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
__smp_locks = .;
*(.smp_locks)
__smp_locks_end = .;
}
The only exception are modules; but you can't do the section
GC there anyways.
The bigger problem is telling ld that it can drop smp_locks
snippets which only points to otherwise unused functions. Don't know
of a solution for that. But if it's not done then any function
with any such section refering to it couldn't be discarded.
-Andi