Re: 2.5.59 vmlinux.lds.S change broke modules

Sam Ravnborg (sam@ravnborg.org)
Sat, 18 Jan 2003 10:23:31 +0100


On Sat, Jan 18, 2003 at 09:00:51AM +0100, Mike Galbraith wrote:
> At 01:55 PM 1/17/2003 +0100, Mikael Pettersson wrote:
>
> >Reverting 2.5.59's patch to arch/i386/vmlinux.lds.S cured the
> >problem and modules now load correctly for me.
>
> Hi,
>
> Putting . = ALIGN(64) back in front of __start___ksymtab = .
> (vmlinux.lds.h) fixed it here.

But that is just a way to hide the real problem.

With . = ALIGN(64);
you make sure that the linker does not do any alignment of .
when entering the section.
It is much better to let the linker do proper alignment, and not
to rely on a magic number in the .lds file.

Now consider if we decide to put in a new symbol with alignment 128 for
some reason. A little gcc magic is used to sepecy the alignment of
the symbol, but the resulting kernel oopses. Why?
Because the ALIGN() preceeding the section was not adjusted properly.
Only sane way is to move the labels inside the block, or at least let
them depend on the address of the section. The lables should not
be assigned the value of ., when we know the linker may adjust it.

The solution that Russell used for ARM is IMO the best way to do it.

The only issue remaining here is what the linker will do for an empty
section, as Eric points out. I have not investigated that.

Sam
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/