Linker script cleanup patches for m68knommu
Subsystems (2)
v2 cover Linker script cleanup patches for m68knommu
Greg,
This patch series is an updated version of the patch I sent you on September 6 cleaning up the m68knommu architecture's linker scripts. Since the original patches had a few bugs, I figured I'd send you a clean copy of state as of when I last hear from you two weeks ago.
This cross-architecture linker script cleanup project is in preparation for adding support for building the kernel with -ffunction-sections -fdata-sections, which is a prerequisite for Ksplice.
Tim Abbott (2):
m68knommu: Make THREAD_SIZE available to assembly files.
m68knommu: Clean up linker script using new linker script macros.
arch/m68k/include/asm/thread_info_no.h | 4 +- arch/m68knommu/kernel/vmlinux.lds.S | 41 ++++++++----------------------- 2 files changed, 13 insertions(+), 32 deletions(-)
PATCH v2 1/2 m68knommu: Make THREAD_SIZE available to assembly files.
--- arch/m68k/include/asm/thread_info_no.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/m68k/include/asm/thread_info_no.h +2 -2
@@ -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. */
Signature · 1 line
1.6.3.3
PATCH v2 2/2 m68knommu: Clean up linker script using new linker script macros.
In reply to Tim Abbott--- arch/m68knommu/kernel/vmlinux.lds.S | 41 +++++++++------------------------- 1 files changed, 11 insertions(+), 30 deletions(-)
arch/m68knommu/kernel/vmlinux.lds.S +11 -30
@@ -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,19 @@ 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); + .init_begin : { + . = 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 + INIT_TEXT_SECTION(PAGE_SIZE) > INIT + INIT_DATA_SECTION(16) > INIT + .init_end : { + . = ALIGN(PAGE_SIZE); __init_end = .; } > INIT
Signature · 1 line
1.6.3.3
Re: [PATCH v2 2/2] m68knommu: Clean up linker script using new linker script macros.
Hi Tim,
Quoted 2 lines · Tim Abbott
Signed-off-by Tim Abbott <[email protected]>Cc Greg Ungerer <[email protected]>
This results in kernels that don't boot for me. I haven't done any more debugging than to just try booting at this time.
Before this patch applied has:
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 0000c000 40158000 40158000 0013a000 2**2
CONTENTS, ALLOC, LOAD, CODE
3 .bss 0000a9ec 40164000 40164000 00146000 2**4
ALLOC
4 .comment 00001c56 00000000 00000000 00146000 2**0
CONTENTS, READONLY
And after applied:
linux-2.6.x/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.text 0000aaac 40158000 40158000 0013a000 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
3 .init.data 00000b5c 40162aac 40162aac 00144aac 2**2
CONTENTS, ALLOC, LOAD, DATA
4 .init_end 000009f8 40163608 40163608 00145608 2**0
ALLOC
5 .bss 0000a9ec 40164000 40164000 00145608 2**4
ALLOC
6 .comment 00001c56 00000000 00000000 00145608 2**0
CONTENTS, READONLY
Does that look like what you would have expected?
I suspect the problem may lie in the binary conversion of this elf file to a raw binary for booting. This uses objcopy with "-O binary". The resulting binary files are different in size with and without the patch by about 2582 bytes. Suspicious me thinks.
Regards
Greg
Quoted 67 lines
--- arch/m68knommu/kernel/vmlinux.lds.S | 41 +++++++++------------------------- 1 files changed, 11 insertions(+), 30 deletions(-)arch/m68knommu/kernel/vmlinux.lds.S +11
-30@@ -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,19 @@ 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); + .init_begin : { + . = 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 + INIT_TEXT_SECTION(PAGE_SIZE) > INIT + INIT_DATA_SECTION(16) > INIT + .init_end : { + . = ALIGN(PAGE_SIZE); __init_end = .; } > INIT
Signature · 5 lines
------------------------------------------------------------------------ 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
Re: [PATCH v2 2/2] m68knommu: Clean up linker script using new linker script macros.
Quoted 8 lines · Greg Ungerer
Hi Tim,
Quoted 2 lines · Tim Abbott
Signed-off-by Tim Abbott <[email protected]>Cc Greg Ungerer <[email protected]>This results in kernels that don't boot for me. I haven't done any more debugging than to just try booting at this time.
[...]
Quoted 2 lines
Does that look like what you would have expected?
Basically. I'm a bit surprised that the .init_begin section doesn't show up, but I'm pretty sure that this is because .init_begin would have had size zero as the previous section's end was already page-aligned.
Quoted 5 lines
I suspect the problem may lie in the binary conversion of this elf file to a raw binary for booting. This uses objcopy with "-O binary". The resulting binary files are different in size with and without the patch by about 2582 bytes. Suspicious me thinks.
I don't any good ideas for what in patch is likely to be responsible. Would it be helpful to debug if I split this into ~5 very small patches so that we can find out what part of the patch is responsible?
-Tim Abbott
Re: [PATCH v2 2/2] m68knommu: Clean up linker script using new linker script macros.
Hi Tim,
Quoted 11 lines · Tim Abbott
Quoted 5 lines · Greg Ungerer
Quoted 2 lines · Tim Abbott
Signed-off-by Tim Abbott <[email protected]>Cc Greg Ungerer <[email protected]>This results in kernels that don't boot for me. I haven't done any more debugging than to just try booting at this time.
[...]
Quoted 1 line
Does that look like what you would have expected?
Basically. I'm a bit surprised that the .init_begin section doesn't show up, but I'm pretty sure that this is because .init_begin would have had size zero as the previous section's end was already page-aligned.
Quoted 7 lines
Quoted 5 lines
I suspect the problem may lie in the binary conversion of this elf file to a raw binary for booting. This uses objcopy with "-O binary". The resulting binary files are different in size with and without the patch by about 2582 bytes. Suspicious me thinks.
I don't any good ideas for what in patch is likely to be responsible. Would it be helpful to debug if I split this into ~5 very small patches so that we can find out what part of the patch is responsible?
Yes, that will make it quick and easy for me.
Thanks
Greg
------------------------------------------------------------------------
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
v3 cover m68knommu: Clean up linker script using new linker script macros.
Quoted 6 lines · Greg Ungerer
Quoted 4 lines · Tim Abbott
I don't any good ideas for what in patch is likely to be responsible. Would it be helpful to debug if I split this into ~5 very small patches so that we can find out what part of the patch is responsible?
Yes, that will make it quick and easy for me.
OK, below's a new patch series that is the same as the previous one but in 7-patch format.
-Tim Abbott
Tim Abbott (7):
m68knommu: Don't hardcode the value of PAGE_SIZE in the linker
script.
m68knommu: Make THREAD_SIZE available to assembly files.
m68knommu: Use INIT_TASK_DATA and CACHELINE_ALIGNED_DATA.
m68knommu: Use more macros inside the .init section.
m68knommu: Move __init_begin out of the .init section.
m68knommu: Move __init_end out of the .init section.
m68knommu: Split the .init section into INIT_TEXT_SECTION and
INIT_DATA_SECTION.
arch/m68k/include/asm/thread_info_no.h | 4 +- arch/m68knommu/kernel/vmlinux.lds.S | 41 ++++++++----------------------- 2 files changed, 13 insertions(+), 32 deletions(-)
PATCH v3 1/7 m68knommu: Don't hardcode the value of PAGE_SIZE in the linker script.
--- arch/m68knommu/kernel/vmlinux.lds.S | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
arch/m68knommu/kernel/vmlinux.lds.S +3 -2
@@ -8,6 +8,7 @@ */ #include <asm-generic/vmlinux.lds.h> +#include <asm/page.h> #if defined(CONFIG_RAMKERNEL) #define RAM_START CONFIG_KERNELBASE
@@ -155,7 +156,7 @@ SECTIONS { } > DATA .init : { - . = ALIGN(4096); + . = ALIGN(PAGE_SIZE); __init_begin = .; _sinittext = .; INIT_TEXT
@@ -180,7 +181,7 @@ SECTIONS { *(.init.ramfs) __initramfs_end = .; #endif - . = ALIGN(4096); + . = ALIGN(PAGE_SIZE); __init_end = .; } > INIT
Signature · 1 line
1.6.4.3
PATCH v3 2/7 m68knommu: Make THREAD_SIZE available to assembly files.
--- arch/m68k/include/asm/thread_info_no.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/m68k/include/asm/thread_info_no.h +2 -2
@@ -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. */
Signature · 1 line
1.6.4.3
PATCH v3 3/7 m68knommu: Use INIT_TASK_DATA and CACHELINE_ALIGNED_DATA.
--- arch/m68knommu/kernel/vmlinux.lds.S | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
arch/m68knommu/kernel/vmlinux.lds.S +3 -4
@@ -9,6 +9,7 @@ #include <asm-generic/vmlinux.lds.h> #include <asm/page.h> +#include <asm/thread_info.h> #if defined(CONFIG_RAMKERNEL) #define RAM_START CONFIG_KERNELBASE
@@ -148,10 +149,8 @@ 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
Signature · 1 line
1.6.4.3
PATCH v3 4/7 m68knommu: Use more macros inside the .init section.
--- arch/m68knommu/kernel/vmlinux.lds.S | 23 +++++------------------ 1 files changed, 5 insertions(+), 18 deletions(-)
arch/m68knommu/kernel/vmlinux.lds.S +5 -18
@@ -161,25 +161,12 @@ SECTIONS { INIT_TEXT _einittext = .; INIT_DATA - . = ALIGN(16); - __setup_start = .; - *(.init.setup) - __setup_end = .; - __initcall_start = .; + INIT_SETUP(16) + INIT_CALL 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 + CON_INITCALL + SECURITY_INITCALL + INIT_RAM_FS . = ALIGN(PAGE_SIZE); __init_end = .; } > INIT
Signature · 1 line
1.6.4.3
PATCH v3 5/7 m68knommu: Move __init_begin out of the .init section.
--- arch/m68knommu/kernel/vmlinux.lds.S | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
arch/m68knommu/kernel/vmlinux.lds.S +3 -1
@@ -154,9 +154,11 @@ SECTIONS { _edata = . ; } > DATA - .init : { + .init_begin : { . = ALIGN(PAGE_SIZE); __init_begin = .; + } > INIT + .init : { _sinittext = .; INIT_TEXT _einittext = .;
Signature · 1 line
1.6.4.3
PATCH v3 6/7 m68knommu: Move __init_end out of the .init section.
--- arch/m68knommu/kernel/vmlinux.lds.S | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/m68knommu/kernel/vmlinux.lds.S +2 -0
@@ -169,6 +169,8 @@ SECTIONS { CON_INITCALL SECURITY_INITCALL INIT_RAM_FS + } > INIT + .init_end : { . = ALIGN(PAGE_SIZE); __init_end = .; } > INIT
Signature · 1 line
1.6.4.3
PATCH v3 7/7 m68knommu: Split the .init section into INIT_TEXT_SECTION and INIT_DATA_SECTION.
--- arch/m68knommu/kernel/vmlinux.lds.S | 14 ++------------ 1 files changed, 2 insertions(+), 12 deletions(-)
arch/m68knommu/kernel/vmlinux.lds.S +2 -12
@@ -158,18 +158,8 @@ SECTIONS { . = ALIGN(PAGE_SIZE); __init_begin = .; } > INIT - .init : { - _sinittext = .; - INIT_TEXT - _einittext = .; - INIT_DATA - INIT_SETUP(16) - INIT_CALL - INITCALLS - CON_INITCALL - SECURITY_INITCALL - INIT_RAM_FS - } > INIT + INIT_TEXT_SECTION(PAGE_SIZE) > INIT + INIT_DATA_SECTION(16) > INIT .init_end : { . = ALIGN(PAGE_SIZE); __init_end = .;
Signature · 1 line
1.6.4.3
Re: [PATCH v3 6/7] m68knommu: Move __init_end out of the .init section.
In reply to Tim AbbottHi Tim,
Quoted 10 lines · Tim Abbott
Signed-off-by Tim Abbott <[email protected]>--- arch/m68knommu/kernel/vmlinux.lds.S | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)arch/m68knommu/kernel/vmlinux.lds.S +0
-0
arch/m68knommu/kernel/vmlinux.lds.S SECTIONS { · line 176
Quoted 8 lines
arch/m68knommu/kernel/vmlinux.lds.S +2
-0@@ -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
Regards
Greg
------------------------------------------------------------------------
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
Re: [PATCH v3 6/7] m68knommu: Move __init_end out of the .init section.
Quoted 32 lines · Greg Ungerer
Hi Tim,
Quoted 10 lines · Tim Abbott
Signed-off-by Tim Abbott <[email protected]>--- arch/m68knommu/kernel/vmlinux.lds.S | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)arch/m68knommu/kernel/vmlinux.lds.S +0
-0arch/m68knommu/kernel/vmlinux.lds.S SECTIONS { · line 176
Quoted 8 lines
arch/m68knommu/kernel/vmlinux.lds.S +2
-0@@ -169,6 +169,8 @@ SECTIONS { CON_INITCALL SECURITY_INITCALL INIT_RAM_FS + } > INIT + .init_end : { . = ALIGN(PAGE_SIZE); __init_end = .; } > INITAfter 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
Quoted 11 lines
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 0001201040145ff040145ff000127ff02**4
CONTENTS, ALLOC, LOAD, DATA
2 .init0000b60840158000 401580000013a0002**2
CONTENTS, ALLOC, LOAD, CODE
3 .init_end000009f840163608 40163608 00145608 2**0
ALLOC
4 .bss0000a9ec40164000 40164000 00145608 2**4
ALLOC
5 .comment00001c5600000000 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 = .;
} > INITWe 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
Re: [PATCH v3 6/7] m68knommu: Move __init_end out of the .init section.
Quoted 2 lines · Sam Ravnborg
Took a look at this trying to understand why this caused a non-booting system.
Thanks, I really appreciate your looking at this!
[...]
Quoted 11 lines
I think the better solution is to use the same section name several times like this:
.init : { . = ALIGN(PAGE_SIZE); __init_end = .; } > INITWe 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.
OK, I have an attempt at implementing this idea. Of course, the final patch which uses INIT_TEXT_SECTION and INIT_DATA_SECTION has multiple output sections (.init.data and .init.text), but I think perhaps including these alignment guards in the adjacent section might work.
-Tim Abbott
PATCH v4 1/7 m68knommu: Don't hardcode the value of PAGE_SIZE in the linker script.
--- arch/m68knommu/kernel/vmlinux.lds.S | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
arch/m68knommu/kernel/vmlinux.lds.S +3 -2
@@ -8,6 +8,7 @@ */ #include <asm-generic/vmlinux.lds.h> +#include <asm/page.h> #if defined(CONFIG_RAMKERNEL) #define RAM_START CONFIG_KERNELBASE
@@ -155,7 +156,7 @@ SECTIONS { } > DATA .init : { - . = ALIGN(4096); + . = ALIGN(PAGE_SIZE); __init_begin = .; _sinittext = .; INIT_TEXT
@@ -180,7 +181,7 @@ SECTIONS { *(.init.ramfs) __initramfs_end = .; #endif - . = ALIGN(4096); + . = ALIGN(PAGE_SIZE); __init_end = .; } > INIT
Signature · 1 line
1.6.4.3
Re: [PATCH v4 1/7] m68knommu: Don't hardcode the value of PAGE_SIZE in the linker script.
Hi Tim,
This one gives me:
arch/m68knommu/kernel/vmlinux.lds.S:19:1: warning: "BSS" redefined
In file included from arch/m68knommu/kernel/vmlinux.lds.S:10:include/asm-generic/vmlinux.lds.h:495:1: warning: this is the location of the previous definition
A define named "BSS" is already used inside of vmlinux.lds.S. No big deal, I just changed that internal one.
But otherwise no problems with this patch.
Regards
Greg
Quoted 35 lines · Tim Abbott
Signed-off-by Tim Abbott <[email protected]>--- arch/m68knommu/kernel/vmlinux.lds.S | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)arch/m68knommu/kernel/vmlinux.lds.S +3
-2@@ -8,6 +8,7 @@ */ #include <asm-generic/vmlinux.lds.h> +#include <asm/page.h> #if defined(CONFIG_RAMKERNEL) #define RAM_START CONFIG_KERNELBASE@@ -155,7 +156,7 @@ SECTIONS { } > DATA .init : { - . = ALIGN(4096); + . = ALIGN(PAGE_SIZE); __init_begin = .; _sinittext = .; INIT_TEXT@@ -180,7 +181,7 @@ SECTIONS { *(.init.ramfs) __initramfs_end = .; #endif - . = ALIGN(4096); + . = ALIGN(PAGE_SIZE); __init_end = .; } > INIT
Signature · 5 lines
------------------------------------------------------------------------ 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
Re: [PATCH v4 1/7] m68knommu: Don't hardcode the value of PAGE_SIZE in the linker script.
Quoted 9 lines · Greg Ungerer
Hi Tim,
This one gives me:
arch/m68knommu/kernel/vmlinux.lds.S:19:1: warning: "BSS" redefined In file included fromarch/m68knommu/kernel/vmlinux.lds.S:10:include/asm-generic/vmlinux.lds.h:495:1: warning: this is the location of the previous definition
Quoted 4 lines
A define named "BSS" is already used inside of
vmlinux.lds.S. No big deal, I just changed that internal one.But otherwise no problems with this patch.
This actually wasn't introduced by this patch -- it was introduced when the BSS macro was merged into include/asm-generic/vmlinux.lds.h in commit ef53dae8658cf0e93d380983824a661067948d87.
Regardless, changing the internal one was the right fix.
-Tim Abbott
Re: [PATCH v4 1/7] m68knommu: Don't hardcode the value of PAGE_SIZE in the linker script.
Hi Tim,
Quoted 11 lines · Tim Abbott
Quoted 9 lines · Greg Ungerer
Hi Tim,
This one gives me:
arch/m68knommu/kernel/vmlinux.lds.S:19:1: warning: "BSS" redefined In file included fromarch/m68knommu/kernel/vmlinux.lds.S:10:include/asm-generic/vmlinux.lds.h:495:1: warning: this is the location of the previous definition
Quoted 8 lines
Quoted 4 lines
A define named "BSS" is already used inside of
vmlinux.lds.S. No big deal, I just changed that internal one.But otherwise no problems with this patch.
This actually wasn't introduced by this patch -- it was introduced when the BSS macro was merged into
include/asm-generic/vmlinux.lds.hin commitef53dae8658cf0e93d380983824a661067948d87.Regardless, changing the internal one was the right fix.
Indeed. Yep. I'll commit a fix for this first.
Regards
Greg
------------------------------------------------------------------------
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
PATCH v4 2/7 m68knommu: Make THREAD_SIZE available to assembly files.
In reply to Tim Abbott--- arch/m68k/include/asm/thread_info_no.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/m68k/include/asm/thread_info_no.h +2 -2
@@ -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. */
Signature · 1 line
1.6.4.3
PATCH v4 3/7 m68knommu: Use INIT_TASK_DATA and CACHELINE_ALIGNED_DATA.
In reply to Tim Abbott--- arch/m68knommu/kernel/vmlinux.lds.S | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
arch/m68knommu/kernel/vmlinux.lds.S +3 -4
@@ -9,6 +9,7 @@ #include <asm-generic/vmlinux.lds.h> #include <asm/page.h> +#include <asm/thread_info.h> #if defined(CONFIG_RAMKERNEL) #define RAM_START CONFIG_KERNELBASE
@@ -148,10 +149,8 @@ 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
Signature · 1 line
1.6.4.3
PATCH v4 4/7 m68knommu: Use more macros inside the .init section.
In reply to Tim Abbott--- arch/m68knommu/kernel/vmlinux.lds.S | 24 +++++------------------- 1 files changed, 5 insertions(+), 19 deletions(-)
arch/m68knommu/kernel/vmlinux.lds.S +5 -19
@@ -161,25 +161,11 @@ SECTIONS { 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 + INIT_SETUP(16) + INIT_CALLS + CON_INITCALL + SECURITY_INITCALL + INIT_RAM_FS . = ALIGN(PAGE_SIZE); __init_end = .; } > INIT
Signature · 1 line
1.6.4.3
PATCH v4 5/7 m68knommu: Move __init_begin out of the .init section.
In reply to Tim Abbott--- arch/m68knommu/kernel/vmlinux.lds.S | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/m68knommu/kernel/vmlinux.lds.S +2 -0
@@ -157,6 +157,8 @@ SECTIONS { .init : { . = ALIGN(PAGE_SIZE); __init_begin = .; + } > INIT + .init : { _sinittext = .; INIT_TEXT _einittext = .;
Signature · 1 line
1.6.4.3
PATCH v4 6/7 m68knommu: Move __init_end out of the .init section.
In reply to Tim Abbott--- arch/m68knommu/kernel/vmlinux.lds.S | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/m68knommu/kernel/vmlinux.lds.S +2 -0
@@ -168,6 +168,8 @@ SECTIONS { CON_INITCALL SECURITY_INITCALL INIT_RAM_FS + } > INIT + .init : { . = ALIGN(PAGE_SIZE); __init_end = .; } > INIT
Signature · 1 line
1.6.4.3
PATCH v4 7/7 m68knommu: Split the .init section into INIT_TEXT_SECTION and INIT_DATA_SECTION.
In reply to Tim Abbott--- arch/m68knommu/kernel/vmlinux.lds.S | 17 ++++------------- 1 files changed, 4 insertions(+), 13 deletions(-)
arch/m68knommu/kernel/vmlinux.lds.S +4 -13
@@ -154,22 +154,13 @@ SECTIONS { _edata = . ; } > DATA - .init : { + .init.text : { . = ALIGN(PAGE_SIZE); __init_begin = .; } > INIT - .init : { - _sinittext = .; - INIT_TEXT - _einittext = .; - INIT_DATA - INIT_SETUP(16) - INIT_CALLS - CON_INITCALL - SECURITY_INITCALL - INIT_RAM_FS - } > INIT - .init : { + INIT_TEXT_SECTION(PAGE_SIZE) > INIT + INIT_DATA_SECTION(16) > INIT + .init.data : { . = ALIGN(PAGE_SIZE); __init_end = .; } > INIT
Signature · 1 line
1.6.4.3
Re: [PATCH v4 7/7] m68knommu: Split the .init section into INIT_TEXT_SECTION and INIT_DATA_SECTION.
Hi Tim,
The whole series applied and ran fine for me! (Of course excepting the define name clash in 1/7)
Do you want me to push these into m68knommu.git?
Regards
Greg
Quoted 36 lines · Tim Abbott
Signed-off-by Tim Abbott <[email protected]>--- arch/m68knommu/kernel/vmlinux.lds.S | 17 ++++------------- 1 files changed, 4 insertions(+), 13 deletions(-)arch/m68knommu/kernel/vmlinux.lds.S +4
-13@@ -154,22 +154,13 @@ SECTIONS { _edata = . ; } > DATA - .init : { + .init.text : { . = ALIGN(PAGE_SIZE); __init_begin = .; } > INIT - .init : { - _sinittext = .; - INIT_TEXT - _einittext = .; - INIT_DATA - INIT_SETUP(16) - INIT_CALLS - CON_INITCALL - SECURITY_INITCALL - INIT_RAM_FS - } > INIT - .init : { + INIT_TEXT_SECTION(PAGE_SIZE) > INIT + INIT_DATA_SECTION(16) > INIT + .init.data : { . = ALIGN(PAGE_SIZE); __init_end = .; } > INIT
Signature · 5 lines
------------------------------------------------------------------------ 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
Re: [PATCH v4 7/7] m68knommu: Split the .init section into INIT_TEXT_SECTION and INIT_DATA_SECTION.
Quoted 4 lines · Greg Ungerer
Hi Tim,
The whole series applied and ran fine for me! (Of course excepting the define name clash in 1/7)
Thanks for your patience debugging this patch series!
Quoted 1 line
Do you want me to push these into m68knommu.git?
Yes, that'd be great. Do you expect these to end up in 2.6.32? I have an API change to INIT_DATA_SECTION that I want to put in 2.6.32 to fix a tiny regression on blackfin, and I'd like to know which change is likely to get merged first (since the API change will likely conflict).
-Tim Abbott
Re: [PATCH v4 7/7] m68knommu: Split the .init section into INIT_TEXT_SECTION and INIT_DATA_SECTION.
Hi Tim,
Quoted 9 lines · Tim Abbott
Quoted 2 lines · Greg Ungerer
The whole series applied and ran fine for me! (Of course excepting the define name clash in 1/7)
Thanks for your patience debugging this patch series!
Quoted 1 line
Do you want me to push these into m68knommu.git?
Yes, that'd be great. Do you expect these to end up in 2.6.32?
No, I wouldn't want to push them this late in the 2.6.32 cycle. Definitely for 2.6.33 (I anticipate pushing them in the 2.6.33 merge window).
Quoted 2 lines
I have an
API change toINIT_DATA_SECTIONthat I want to put in 2.6.32 to fix a tiny regression on blackfin, and I'd like to know which change is likely to get merged first (since the API change will likely conflict).
I have put them in the "for-linus" branch of:
git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu.git
Regards
Greg
------------------------------------------------------------------------
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
Re: [PATCH v4 7/7] m68knommu: Split the .init section into INIT_TEXT_SECTION and INIT_DATA_SECTION.
In reply to Tim AbbottQuoted 7 lines · Tim Abbott
Quoted 4 lines · Greg Ungerer
Hi Tim,
The whole series applied and ran fine for me! (Of course excepting the define name clash in 1/7)
Quoted 8 lines
Thanks for your patience debugging this patch series!
Quoted 1 line
Do you want me to push these into m68knommu.git?
Yes, that'd be great. Do you expect these to end up in 2.6.32? I have an API change to
INIT_DATA_SECTIONthat I want to put in 2.6.32 to fix a tiny regression on blackfin, and I'd like to know which change is likely to get merged first (since the API change will likely conflict).
Let's postpone this fix until merge window opens.
I doubt it has any real effect anyway.
And I'm glad the m68knommu stuff is fixed now.
Sam
Re: [PATCH v4 7/7] m68knommu: Split the .init section into INIT_TEXT_SECTION and INIT_DATA_SECTION.
Quoted 2 lines · Sam Ravnborg
Let's postpone this fix until merge window opens.
I doubt it has any real effect anyway.
OK, seems reasonable.
-Tim Abbott
Re: [PATCH v3 6/7] m68knommu: Move __init_end out of the .init section.
In reply to Sam RavnborgHi Sam,
Sorry for the slow response.
Quoted 65 lines · Sam Ravnborg
Quoted 31 lines · Greg Ungerer
Hi Tim,
Quoted 10 lines · Tim Abbott
Signed-off-by Tim Abbott <[email protected]>--- arch/m68knommu/kernel/vmlinux.lds.S | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)arch/m68knommu/kernel/vmlinux.lds.S +0
-0arch/m68knommu/kernel/vmlinux.lds.S SECTIONS { · line 176
Quoted 8 lines
arch/m68knommu/kernel/vmlinux.lds.S +2
-0@@ -169,6 +169,8 @@ SECTIONS { CON_INITCALL SECURITY_INITCALL INIT_RAM_FS + } > INIT + .init_end : { . = ALIGN(PAGE_SIZE); __init_end = .; } > INITAfter 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**4Quoted 11 lines
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 0001201040145ff040145ff000127ff02**4
CONTENTS, ALLOC, LOAD, DATA
2 .init0000b60840158000 401580000013a0002**2
CONTENTS, ALLOC, LOAD, CODE
3 .init_end000009f840163608 40163608 00145608 2**0
ALLOC
4 .bss0000a9ec40164000 40164000 00145608 2**4
ALLOC
5 .comment00001c5600000000 00000000 00145608 2**0
CONTENTS, READONLYTook 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_endsections 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
Quoted 5 lines
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.
No, it was very early - no console trace even. I didn't check in logbuf to see what early kernel boot messages there where.
I'll try Tim's next set and see where that gets to.
Regards
Greg
------------------------------------------------------------------------
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
Re: [PATCH v3 4/7] m68knommu: Use more macros inside the .init section.
In reply to Tim AbbottHi Tim,
Quoted 10 lines · Tim Abbott
Signed-off-by Tim Abbott <[email protected]>--- arch/m68knommu/kernel/vmlinux.lds.S | 23 +++++------------------ 1 files changed, 5 insertions(+), 18 deletions(-)arch/m68knommu/kernel/vmlinux.lds.S +0
-0
arch/m68knommu/kernel/vmlinux.lds.S SECTIONS { · line 165
Quoted 10 lines
arch/m68knommu/kernel/vmlinux.lds.S +2
-5@@ -161,25 +161,12 @@ SECTIONS { INIT_TEXT _einittext = .; INIT_DATA - . = ALIGN(16); - __setup_start = .; - *(.init.setup) - __setup_end = .; - __initcall_start = .; + INIT_SETUP(16) + INIT_CALL
^^^^^^^^^^
I take it this should be INIT_CALLS?
Quoted 10 lines
arch/m68knommu/kernel/vmlinux.lds.S +0
-9INITCALLS - __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);
arch/m68knommu/kernel/vmlinux.lds.S SECTIONS { · line 172
Quoted 10 lines
arch/m68knommu/kernel/vmlinux.lds.S +3
-4- __initramfs_start = .; - *(.init.ramfs) - __initramfs_end = .; -#endif + CON_INITCALL + SECURITY_INITCALL + INIT_RAM_FS . = ALIGN(PAGE_SIZE); __init_end = .; } > INIT
With this patch applied the kernel no longer boots. All previous patches (so 1, 2 and 3) applied run fine.
Headers list:
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 0000c000 40158000 40158000 0013a000 2**2
CONTENTS, ALLOC, LOAD, CODE
3 .bss 0000a9ec 40164000 40164000 00146000 2**4
ALLOC
4 .comment 00001c56 00000000 00000000 00146000 2**0
CONTENTS, READONLY
I haven't debugged any further...
Regards
Greg
------------------------------------------------------------------------
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
Re: [PATCH v3 4/7] m68knommu: Use more macros inside the .init section.
Quoted 25 lines · Greg Ungerer
Hi Tim,
Quoted 11 lines · Tim Abbott
Signed-off-by Tim Abbott <[email protected]>--- arch/m68knommu/kernel/vmlinux.lds.S | 23 +++++------------------ 1 files changed, 5 insertions(+), 18 deletions(-)arch/m68knommu/kernel/vmlinux.lds.S +0
-0arch/m68knommu/kernel/vmlinux.lds.S SECTIONS { · line 165
Quoted 10 lines
arch/m68knommu/kernel/vmlinux.lds.S +2
-5@@ -161,25 +161,12 @@ SECTIONS { INIT_TEXT _einittext = .; INIT_DATA - . = ALIGN(16); - __setup_start = .; - *(.init.setup) - __setup_end = .; - __initcall_start = .; + INIT_SETUP(16) + INIT_CALL^^^^^^^^^^
Quoted 1 line
I take it this should be
INIT_CALLS?
Oops, yes. Also the INITCALLS on the following line should be deleted. So it should look like the below patch.
Quoted 2 lines
With this patch applied the kernel no longer boots. All previous patches (so 1, 2 and 3) applied run fine.
Hopefully this is because we had INIT_CALLS followed by INITCALLS. If it doesn't boot using the patch below instead, then that would be surprising to me.
-Tim Abbott
m68knommu: Use more macros inside the .init section.
--- arch/m68knommu/kernel/vmlinux.lds.S | 24 +++++------------------- 1 files changed, 5 insertions(+), 19 deletions(-)
arch/m68knommu/kernel/vmlinux.lds.S +5 -19
@@ -161,25 +161,11 @@ SECTIONS { 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 + INIT_SETUP(16) + INIT_CALLS + CON_INITCALL + SECURITY_INITCALL + INIT_RAM_FS . = ALIGN(PAGE_SIZE); __init_end = .; } > INIT
Signature · 1 line
1.6.4.3
Re: [PATCH v3 4/7] m68knommu: Use more macros inside the .init section.
Hi Tim,
Quoted 29 lines · Tim Abbott
Quoted 25 lines · Greg Ungerer
Hi Tim,
Quoted 11 lines · Tim Abbott
Signed-off-by Tim Abbott <[email protected]>--- arch/m68knommu/kernel/vmlinux.lds.S | 23 +++++------------------ 1 files changed, 5 insertions(+), 18 deletions(-)arch/m68knommu/kernel/vmlinux.lds.S +0
-0arch/m68knommu/kernel/vmlinux.lds.S SECTIONS { · line 165
Quoted 10 lines
arch/m68knommu/kernel/vmlinux.lds.S +2
-5@@ -161,25 +161,12 @@ SECTIONS { INIT_TEXT _einittext = .; INIT_DATA - . = ALIGN(16); - __setup_start = .; - *(.init.setup) - __setup_end = .; - __initcall_start = .; + INIT_SETUP(16) + INIT_CALL^^^^^^^^^^Quoted 1 line
I take it this should be
INIT_CALLS?
Quoted 6 lines
Oops, yes. Also the INITCALLS on the following line should be deleted. So it should look like the below patch.
Quoted 2 lines
With this patch applied the kernel no longer boots. All previous patches (so 1, 2 and 3) applied run fine.
Hopefully this is because we had
INIT_CALLSfollowed by INITCALLS. If it doesn't boot using the patch below instead, then that would be surprising to me.
Runs fine with this updated patch.
Trying the rest of the series now.
Regards
Greg
Quoted 42 lines
m68knommu: Use more macros inside the .init section.
Signed-off-by Tim Abbott <[email protected]>--- arch/m68knommu/kernel/vmlinux.lds.S | 24 +++++------------------- 1 files changed, 5 insertions(+), 19 deletions(-)arch/m68knommu/kernel/vmlinux.lds.S +5
-19@@ -161,25 +161,11 @@ SECTIONS { 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 + INIT_SETUP(16) + INIT_CALLS + CON_INITCALL + SECURITY_INITCALL + INIT_RAM_FS . = ALIGN(PAGE_SIZE); __init_end = .; } > INIT
Signature · 5 lines
------------------------------------------------------------------------ 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