This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Linker Bug or Design Intent (Absolute symbols in zero sized sections)
- From: Vivek Goyal <vgoyal at redhat dot com>
- To: "H. J. Lu" <hjl at lucon dot org>
- Cc: binutils at sources dot redhat dot com
- Date: Tue, 26 Sep 2006 10:26:05 -0400
- Subject: Re: Linker Bug or Design Intent (Absolute symbols in zero sized sections)
- References: <4519350D.2090208@redhat.com> <20060926142709.GA8543@lucon.org>
- Reply-to: vgoyal at redhat dot com
H. J. Lu wrote:
On Tue, Sep 26, 2006 at 10:11:25AM -0400, Vivek Goyal wrote:
Now, above compiler makes some symbols absolute and these symbols are
not relocated and kernel code fails at some point. In this case kernel
fails because it is trying to free memory between symbol __smp_alt_begin
and another symbol present in other section. __smp_alt_begin is now
absolute and does not get relocated and kernel ends up trying to free a
wrong portion of memory.
Why do you want to free a memory which doesn't exist?
Well, based on various CONFIG options, some init sections might be
created when kernel is compiled. Memory belonging to these sections is
freed once initialization is over.
In the above case, kernel defines following three sections in ld script
and tries to free up memory __smp_alt_being and __smp_alt_end. From a
programming perspective one can always do.
If (__smp_alt_being < __smp_alt_end)
Free up memory;
.smp_altinstructions : AT(ADDR(.smp_altinstructions) - LOAD_OFFSET) {
__smp_alt_begin = .;
__smp_alt_instructions = .;
*(.smp_altinstructions)
__smp_alt_instructions_end = .;
}
. = ALIGN(4);
.smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
__smp_locks = .;
*(.smp_locks)
__smp_locks_end = .;
}
.smp_altinstr_replacement : AT(ADDR(.smp_altinstr_replacement) -
LOAD_OFFSET) {
*(.smp_altinstr_replacement)
. = ALIGN(4096);
__smp_alt_end = .;
}
Thanks
Vivek