Signed-off-by: Tim Abbott <[email protected]>
Cc: Greg Ungerer <[email protected]>
---
arch/m68knommu/kernel/vmlinux.lds.S | 37 +++++++---------------------------
1 files changed, 8 insertions(+), 29 deletions(-)
diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index b7fe505..979acb5 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -8,6 +8,8 @@
*/
#include <asm-generic/vmlinux.lds.h>
+#include <asm/page.h>
+#include <asm/thread_info.h>
#if defined(CONFIG_RAMKERNEL)
#define RAM_START CONFIG_KERNELBASE
@@ -147,40 +149,17 @@ SECTIONS {
. = ALIGN(4);
_sdata = . ;
DATA_DATA
- . = ALIGN(32);
- *(.data.cacheline_aligned)
- . = ALIGN(8192) ;
- *(.data.init_task)
+ CACHELINE_ALIGNED_DATA(32)
+ INIT_TASK_DATA(THREAD_SIZE)
_edata = . ;
} > DATA
.init : {
- . = ALIGN(4096);
+ . = ALIGN(PAGE_SIZE);
__init_begin = .;
- _sinittext = .;
- INIT_TEXT
- _einittext = .;
- INIT_DATA
- . = ALIGN(16);
- __setup_start = .;
- *(.init.setup)
- __setup_end = .;
- __initcall_start = .;
- INITCALLS
- __initcall_end = .;
- __con_initcall_start = .;
- *(.con_initcall.init)
- __con_initcall_end = .;
- __security_initcall_start = .;
- *(.security_initcall.init)
- __security_initcall_end = .;
-#ifdef CONFIG_BLK_DEV_INITRD
- . = ALIGN(4);
- __initramfs_start = .;
- *(.init.ramfs)
- __initramfs_end = .;
-#endif
- . = ALIGN(4096);
+ INIT_TEXT_SECTION(PAGE_SIZE)
+ INIT_DATA_SECTION(16)
+ . = ALIGN(PAGE_SIZE);
__init_end = .;
} > INIT
--
1.6.3.3
Hi Tim,
Tim Abbott wrote:
> Signed-off-by: Tim Abbott <[email protected]>
> Cc: Greg Ungerer <[email protected]>
> ---
> arch/m68knommu/kernel/vmlinux.lds.S | 37 +++++++---------------------------
> 1 files changed, 8 insertions(+), 29 deletions(-)
>
> diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
> index b7fe505..979acb5 100644
> --- a/arch/m68knommu/kernel/vmlinux.lds.S
> +++ b/arch/m68knommu/kernel/vmlinux.lds.S
> @@ -8,6 +8,8 @@
> */
>
> #include <asm-generic/vmlinux.lds.h>
> +#include <asm/page.h>
> +#include <asm/thread_info.h>
>
> #if defined(CONFIG_RAMKERNEL)
> #define RAM_START CONFIG_KERNELBASE
> @@ -147,40 +149,17 @@ SECTIONS {
> . = ALIGN(4);
> _sdata = . ;
> DATA_DATA
> - . = ALIGN(32);
> - *(.data.cacheline_aligned)
> - . = ALIGN(8192) ;
> - *(.data.init_task)
> + CACHELINE_ALIGNED_DATA(32)
> + INIT_TASK_DATA(THREAD_SIZE)
> _edata = . ;
> } > DATA
>
> .init : {
> - . = ALIGN(4096);
> + . = ALIGN(PAGE_SIZE);
This fails for me with:
LD vmlinux
/usr/local/bin/m68k-uclinux-ld:arch/m68knommu/kernel/vmlinux.lds:287:
syntax error
due to PAGE_SIZE evaluating to:
. = ALIGN((1UL << (12)));
The linker doesn't like the 'UL' suffix.
Regards
Greg
> __init_begin = .;
> - _sinittext = .;
> - INIT_TEXT
> - _einittext = .;
> - INIT_DATA
> - . = ALIGN(16);
> - __setup_start = .;
> - *(.init.setup)
> - __setup_end = .;
> - __initcall_start = .;
> - INITCALLS
> - __initcall_end = .;
> - __con_initcall_start = .;
> - *(.con_initcall.init)
> - __con_initcall_end = .;
> - __security_initcall_start = .;
> - *(.security_initcall.init)
> - __security_initcall_end = .;
> -#ifdef CONFIG_BLK_DEV_INITRD
> - . = ALIGN(4);
> - __initramfs_start = .;
> - *(.init.ramfs)
> - __initramfs_end = .;
> -#endif
> - . = ALIGN(4096);
> + INIT_TEXT_SECTION(PAGE_SIZE)
> + INIT_DATA_SECTION(16)
> + . = ALIGN(PAGE_SIZE);
> __init_end = .;
> } > INIT
>
--
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected]
SnapGear Group, McAfee PHONE: +61 7 3435 2888
825 Stanley St, FAX: +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com
On Mon, 7 Sep 2009, Greg Ungerer wrote:
> This fails for me with:
>
> LD vmlinux
> /usr/local/bin/m68k-uclinux-ld:arch/m68knommu/kernel/vmlinux.lds:287: syntax
> error
>
> due to PAGE_SIZE evaluating to:
>
> . = ALIGN((1UL << (12)));
>
> The linker doesn't like the 'UL' suffix.
Yeah, sorry, I didn't have a cross-compiler for this one to test. The fix
is to use _AC(1,UL), like most of the other architectures (including m68k
with an mmu) do.
-Tim Abbott
m68knommu: Make PAGE_SIZE available to assembly files.
Signed-off-by: Tim Abbott <[email protected]>
---
arch/m68k/include/asm/page_no.h | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/arch/m68k/include/asm/page_no.h b/arch/m68k/include/asm/page_no.h
index 9aa3f90..1f31b06 100644
--- a/arch/m68k/include/asm/page_no.h
+++ b/arch/m68k/include/asm/page_no.h
@@ -1,10 +1,12 @@
#ifndef _M68KNOMMU_PAGE_H
#define _M68KNOMMU_PAGE_H
+#include <linux/const.h>
+
/* PAGE_SHIFT determines the page size */
#define PAGE_SHIFT (12)
-#define PAGE_SIZE (1UL << PAGE_SHIFT)
+#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1))
#include <asm/setup.h>
--
1.6.3.3
Hi Tim,
Tim Abbott wrote:
> On Mon, 7 Sep 2009, Greg Ungerer wrote:
>
>> This fails for me with:
>>
>> LD vmlinux
>> /usr/local/bin/m68k-uclinux-ld:arch/m68knommu/kernel/vmlinux.lds:287: syntax
>> error
>>
>> due to PAGE_SIZE evaluating to:
>>
>> . = ALIGN((1UL << (12)));
>>
>> The linker doesn't like the 'UL' suffix.
>
> Yeah, sorry, I didn't have a cross-compiler for this one to test. The fix
> is to use _AC(1,UL), like most of the other architectures (including m68k
> with an mmu) do.
Yep, that fixes that. I'll push this patch into the for-linus
branch of the m68knommu git tree.
Now, back to the original patch. Now fails with another syntax error
at the last line in this:
.init : {
. = ALIGN((1 << (12)));
__init_begin = .;
. = ALIGN((1 << (12))); .init.text : AT(ADDR(.init.text) - 0) {
_sinittext = .; *(.init.text) *(.devinit.text) *(.cpuinit.text)
*(.meminit.text) _einittext = .; }
Regards
Greg
> -Tim Abbott
>
> m68knommu: Make PAGE_SIZE available to assembly files.
>
> Signed-off-by: Tim Abbott <[email protected]>
> ---
> arch/m68k/include/asm/page_no.h | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/arch/m68k/include/asm/page_no.h b/arch/m68k/include/asm/page_no.h
> index 9aa3f90..1f31b06 100644
> --- a/arch/m68k/include/asm/page_no.h
> +++ b/arch/m68k/include/asm/page_no.h
> @@ -1,10 +1,12 @@
> #ifndef _M68KNOMMU_PAGE_H
> #define _M68KNOMMU_PAGE_H
>
> +#include <linux/const.h>
> +
> /* PAGE_SHIFT determines the page size */
>
> #define PAGE_SHIFT (12)
> -#define PAGE_SIZE (1UL << PAGE_SHIFT)
> +#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
> #define PAGE_MASK (~(PAGE_SIZE-1))
>
> #include <asm/setup.h>
--
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected]
SnapGear Group, McAfee PHONE: +61 7 3435 2888
825 Stanley St, FAX: +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com
On Mon, 7 Sep 2009, Greg Ungerer wrote:
> Now, back to the original patch. Now fails with another syntax error
> at the last line in this:
>
> .init : {
> . = ALIGN((1 << (12)));
> __init_begin = .;
> . = ALIGN((1 << (12))); .init.text : AT(ADDR(.init.text) - 0) { _sinittext =
> .; *(.init.text) *(.devinit.text) *(.cpuinit.text) *(.meminit.text) _einittext
> = .; }
Oops. The ".init : { }" wrapping the new macros there should have been
removed.
The following patch should fix this issue (obviously, you'll want to
squash it with the original patch, but I figure sending the diff will be
easier to review).
-Tim Abbott
Signed-off-by: Tim Abbott <[email protected]>
---
arch/m68knommu/kernel/vmlinux.lds.S | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index 979acb5..c380040 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -154,14 +154,12 @@ SECTIONS {
_edata = . ;
} > DATA
- .init : {
- . = ALIGN(PAGE_SIZE);
- __init_begin = .;
- INIT_TEXT_SECTION(PAGE_SIZE)
- INIT_DATA_SECTION(16)
- . = ALIGN(PAGE_SIZE);
- __init_end = .;
- } > INIT
+ . = ALIGN(PAGE_SIZE);
+ __init_begin = .;
+ INIT_TEXT_SECTION(PAGE_SIZE) > INIT
+ INIT_DATA_SECTION(16) > INIT
+ . = ALIGN(PAGE_SIZE);
+ __init_end = .;
/DISCARD/ : {
EXIT_TEXT
--
1.6.3.3
Hi Tim,
Tim Abbott wrote:
> On Mon, 7 Sep 2009, Greg Ungerer wrote:
>
>> Now, back to the original patch. Now fails with another syntax error
>> at the last line in this:
>>
>> .init : {
>> . = ALIGN((1 << (12)));
>> __init_begin = .;
>> . = ALIGN((1 << (12))); .init.text : AT(ADDR(.init.text) - 0) { _sinittext =
>> .; *(.init.text) *(.devinit.text) *(.cpuinit.text) *(.meminit.text) _einittext
>> = .; }
>
> Oops. The ".init : { }" wrapping the new macros there should have been
> removed.
>
> The following patch should fix this issue (obviously, you'll want to
> squash it with the original patch, but I figure sending the diff will be
> easier to review).
Ok, yes, that fixes that problem. I had to also make THREAD_SIZE
available to the linker with:
diff --git a/arch/m68k/include/asm/thread_info_no.h
b/arch/m68k/include/asm/thre
index c2bde5e..a6512bf 100644
--- a/arch/m68k/include/asm/thread_info_no.h
+++ b/arch/m68k/include/asm/thread_info_no.h
@@ -12,8 +12,6 @@
#ifdef __KERNEL__
-#ifndef __ASSEMBLY__
-
/*
* Size of kernel stack for each process. This must be a power of 2...
*/
@@ -28,6 +26,8 @@
*/
#define THREAD_SIZE (PAGE_SIZE<<THREAD_SIZE_ORDER)
+#ifndef __ASSEMBLY__
+
/*
* low level task data.
*/
But now the bss section doesn't looked properly aligned (at
least it is not on a page boundary any longer after the init.data):
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00124ab8 40020000 40020000 00002000 2**4
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 00011540 40144ac0 40144ac0 00126ac0 2**4
CONTENTS, ALLOC, LOAD, DATA
2 .init.text 0000a96c 40156000 40156000 00138000 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
3 .init.data 00000b7c 4016096c 4016096c 0014296c 2**2
CONTENTS, ALLOC, LOAD, DATA
4 .bss 0000a9e8 401614f0 401614f0 001434e8 2**4
ALLOC
5 .comment 00001c8c 00000000 00000000 001434e8 2**0
CONTENTS, READONLY
Seems kind of odd because:
40156000 A __init_begin
40162000 A __init_end
401614f0 B _sbss
The resulting kernels don't boot.
Regards
Greg
> Signed-off-by: Tim Abbott <[email protected]>
> ---
> arch/m68knommu/kernel/vmlinux.lds.S | 14 ++++++--------
> 1 files changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
> index 979acb5..c380040 100644
> --- a/arch/m68knommu/kernel/vmlinux.lds.S
> +++ b/arch/m68knommu/kernel/vmlinux.lds.S
> @@ -154,14 +154,12 @@ SECTIONS {
> _edata = . ;
> } > DATA
>
> - .init : {
> - . = ALIGN(PAGE_SIZE);
> - __init_begin = .;
> - INIT_TEXT_SECTION(PAGE_SIZE)
> - INIT_DATA_SECTION(16)
> - . = ALIGN(PAGE_SIZE);
> - __init_end = .;
> - } > INIT
> + . = ALIGN(PAGE_SIZE);
> + __init_begin = .;
> + INIT_TEXT_SECTION(PAGE_SIZE) > INIT
> + INIT_DATA_SECTION(16) > INIT
> + . = ALIGN(PAGE_SIZE);
> + __init_end = .;
>
> /DISCARD/ : {
> EXIT_TEXT
--
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected]
SnapGear Group, McAfee PHONE: +61 7 3435 2888
825 Stanley St, FAX: +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com
On Tue, 8 Sep 2009, Greg Ungerer wrote:
> But now the bss section doesn't looked properly aligned (at
> least it is not on a page boundary any longer after the init.data):
>
> Sections:
> Idx Name Size VMA LMA File off Algn
> 0 .text 00124ab8 40020000 40020000 00002000 2**4
> CONTENTS, ALLOC, LOAD, READONLY, CODE
> 1 .data 00011540 40144ac0 40144ac0 00126ac0 2**4
> CONTENTS, ALLOC, LOAD, DATA
> 2 .init.text 0000a96c 40156000 40156000 00138000 2**2
> CONTENTS, ALLOC, LOAD, READONLY, CODE
> 3 .init.data 00000b7c 4016096c 4016096c 0014296c 2**2
> CONTENTS, ALLOC, LOAD, DATA
> 4 .bss 0000a9e8 401614f0 401614f0 001434e8 2**4
> ALLOC
> 5 .comment 00001c8c 00000000 00000000 001434e8 2**0
> CONTENTS, READONLY
>
> Seems kind of odd because:
>
> 40156000 A __init_begin
> 40162000 A __init_end
> 401614f0 B _sbss
Yes, that is quite odd.
> The resulting kernels don't boot.
Right, presumably a big chunk of the .sbss code is being freed since _sbss
is before __init_end.
I'm guessing the issue here is that the __init_begin and __init_end
markers are now not actually in a section (and thus don't have a memory
region marker attached). Does the following patch cause _sbss to not
overlap the init region?
-Tim Abbott
diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index c380040..81b54cb 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -154,12 +154,16 @@ SECTIONS {
_edata = . ;
} > DATA
- . = ALIGN(PAGE_SIZE);
- __init_begin = .;
+ .init_begin : {
+ . = ALIGN(PAGE_SIZE);
+ __init_begin = .;
+ } > INIT
INIT_TEXT_SECTION(PAGE_SIZE) > INIT
INIT_DATA_SECTION(16) > INIT
- . = ALIGN(PAGE_SIZE);
- __init_end = .;
+ .init_end : {
+ . = ALIGN(PAGE_SIZE);
+ __init_end = .;
+ } > INIT
/DISCARD/ : {
EXIT_TEXT