This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Linker Bug or Design Intent (Absolute symbols in zero sized sections)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]