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)


On Tue, Sep 26, 2006 at 10:26:05AM -0400, Vivek Goyal wrote:
> 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;
> 

I think for --emit-relocs, we can keep an empty output section if its
address is taken.

Of course, we need to update linker doc.

H.J.


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