Re: [PATCH 3/12] i386: Force section size to be non-zero to prevent a symbol becoming absolute

Andrew Morton
2006-10-04T16:10:27Z

On Tue, 3 Oct 2006 13:09:08 -0400
Vivek Goyal <vgoyal@in.ibm.com> wrote:

> o Relocation patches for i386, moved the symbols in vmlinux.lds.S inside
> sections so that these symbols become section relative and are no more
> absolute. If these symbols become absolute, its bad as they are not
> relocated if kernel is not loaded at the address it has been compiled
> for.
>
> o Ironically, just moving the symbols inside the section does not
> gurantee that symbols inside will not become absolute. Recent
> versions of linkers, do some optimization, and if section size is
> zero, it gets rid of the section and makes any defined symbol as absolute.
>
> o This leads to a failure while second kernel is booting.
> arch/i386/alternative.c frees any pages present between __smp_alt_begin
> and __smp_alt_end. In my case size of section .smp_altinstructions is
> zero and symbol __smpt_alt_begin becomes absolute and is not relocated
> and system crashes while it is trying to free the memory starting
> from __smp_alt_begin.
>
> o This issue is being fixed by the linker guys and they are making sure
> that linker does not get rid of an empty section if there is any
> section relative symbol defined in it. But we need to fix it at
> kernel level too so that people using the linker version without fix,
> are not affected.
>
> o One of the possible solutions is that force the section size to be
> non zero to make sure these symbols don't become absolute. This
> patch implements that.

Would it be reasonable to omit this patch and require that the small number
of people who want to build relocatable kernels install binutils
2.17.50.0.5 or later?