lkml.org 
[lkml]   [2009]   [Oct]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 6/7] m68knommu: Move __init_end out of the .init section.
On Wed, Oct 14, 2009 at 02:41:38PM +1000, Greg Ungerer wrote:
> Hi Tim,
>
> Tim Abbott wrote:
>> Signed-off-by: Tim Abbott <tabbott@ksplice.com>
>> ---
>> arch/m68knommu/kernel/vmlinux.lds.S | 2 ++
>> 1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
>> index 73fe172..49d5c4d 100644
>> --- a/arch/m68knommu/kernel/vmlinux.lds.S
>> +++ b/arch/m68knommu/kernel/vmlinux.lds.S
>> @@ -169,6 +169,8 @@ SECTIONS {
>> CON_INITCALL
>> SECURITY_INITCALL
>> INIT_RAM_FS
>> + } > INIT
>> + .init_end : {
>> . = ALIGN(PAGE_SIZE);
>> __init_end = .;
>> } > INIT
>
>
> After applying this I can no longer boot.
>
> Resulting headers for vmlinux are:
>
> vmlinux: file format elf32-m68k
>
> Sections:
> Idx Name Size VMA LMA File off Algn
> 0 .text 00125ff0 40020000 40020000 00002000 2**4
> CONTENTS, ALLOC, LOAD, READONLY, CODE
> 1 .data 00012010 40145ff0 40145ff0 00127ff0 2**4
> CONTENTS, ALLOC, LOAD, DATA
> 2 .init 0000b608 40158000 40158000 0013a000 2**2
> CONTENTS, ALLOC, LOAD, CODE
> 3 .init_end 000009f8 40163608 40163608 00145608 2**0
> ALLOC
> 4 .bss 0000a9ec 40164000 40164000 00145608 2**4
> ALLOC
> 5 .comment 00001c56 00000000 00000000 00145608 2**0
> CONTENTS, READONLY

Took a look at this trying to understand why this
caused a non-booting system.

The previous post should have created a section named "init_begin",
but it is not present in the above.
I think this is beacuse the section had a zero size and thus
got ignored by the linker.

An the linker is allowed to rearrange sections so the concept
with a init_begin, init_end sections looks wrongs.
We do not know the order of these sections and they may
be linked in a different order than what we expect.

I think the better solution is to use the same section name
several times like this:

.init : {
. = ALIGN(PAGE_SIZE);
__init_end = .;
} > INIT
We should do this both for begin and end.
Then the linker will not fool us and try to rearrange stuff.
And we do not end up with zero sized sections.

Greg - I assume the boot failed when it tried to free initmem.

Sam


\
 
 \ /
  Last update: 2009-10-14 17:19    [from the cache]
©2003-2011 Jasper Spaans