From 8cc11f5ab5384dad6c63905f71882e65cd70b7b7 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Sun, 6 Sep 2009 23:10:10 -0400 Subject: microblaze: Cleanup linker script using new linker script macros. I wasn't able to further clean up the linker script using the INIT_DATA_SECTION macro because of the FIXME comment for the .init.ramfs section; when that is resolved we should convert microblaze to use INIT_DATA_SECTION. Signed-off-by: Tim Abbott Cc: Michal Simek Cc: microblaze-uclinux@itee.uq.edu.au Cc: Sam Ravnborg Signed-off-by: Michal Simek --- arch/microblaze/kernel/vmlinux.lds.S | 39 ++++++++---------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) (limited to 'arch/microblaze/kernel/vmlinux.lds.S') diff --git a/arch/microblaze/kernel/vmlinux.lds.S b/arch/microblaze/kernel/vmlinux.lds.S index ec5fa91a48d8..b76c17c9ae41 100644 --- a/arch/microblaze/kernel/vmlinux.lds.S +++ b/arch/microblaze/kernel/vmlinux.lds.S @@ -13,6 +13,8 @@ OUTPUT_ARCH(microblaze) ENTRY(_start) #include +#include +#include jiffies = jiffies_64 + 4; @@ -39,12 +41,7 @@ SECTIONS { . = ALIGN(16); RODATA - . = ALIGN(16); - __ex_table : { - __start___ex_table = .; - *(__ex_table) - __stop___ex_table = .; - } + EXCEPTION_TABLE(16) /* * sdata2 section can go anywhere, but must be word aligned @@ -61,12 +58,7 @@ SECTIONS { } _sdata = . ; - .data ALIGN (4096) : { /* page aligned when MMU used - origin 0x4 */ - DATA_DATA - CONSTRUCTORS - } - . = ALIGN(32); - .data.cacheline_aligned : { *(.data.cacheline_aligned) } + RW_DATA_SECTION(32, PAGE_SIZE, THREAD_SIZE) _edata = . ; /* Reserve some low RAM for r0 based memory references */ @@ -74,10 +66,6 @@ SECTIONS { r0_ram = . ; . = . + 4096; /* a page should be enough */ - /* The initial task */ - . = ALIGN(8192); - .data.init_task : { *(.data.init_task) } - /* Under the microblaze ABI, .sdata and .sbss must be contiguous */ . = ALIGN(8); .sdata : { @@ -96,12 +84,7 @@ SECTIONS { __init_begin = .; - . = ALIGN(4096); - .init.text : { - _sinittext = . ; - INIT_TEXT - _einittext = .; - } + INIT_TEXT_SECTION(PAGE_SIZE) .init.data : { INIT_DATA @@ -115,21 +98,15 @@ SECTIONS { } .init.setup : { - __setup_start = .; - *(.init.setup) - __setup_end = .; + INIT_SETUP(0) } .initcall.init : { - __initcall_start = .; - INITCALLS - __initcall_end = .; + INIT_CALLS } .con_initcall.init : { - __con_initcall_start = .; - *(.con_initcall.init) - __con_initcall_end = .; + CON_INITCALL } SECURITY_INIT -- cgit v1.2.3-55-g7522 From a061dd5258b2bad6c44c48d2a2d55f4fd5eb85d8 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Tue, 22 Sep 2009 09:58:56 +0200 Subject: microblaze: Use LOAD_OFFSET macro to get correct LMA for all sections Currently, vmlinux has LMA==VMA for all sections, which is wrong for MMU kernels. Previous patches in this series defined the LOAD_OFFSET constant, now we make use of it in our link script. Other minor changes in this patch: * brace/indenting cleanup of some sections * put __fdt_* symbols in their own section, and apply LOAD_OFFSET fixup Signed-off-by: John Williams Signed-off-by: Michal Simek --- arch/microblaze/kernel/vmlinux.lds.S | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'arch/microblaze/kernel/vmlinux.lds.S') diff --git a/arch/microblaze/kernel/vmlinux.lds.S b/arch/microblaze/kernel/vmlinux.lds.S index b76c17c9ae41..dbb98f830f3e 100644 --- a/arch/microblaze/kernel/vmlinux.lds.S +++ b/arch/microblaze/kernel/vmlinux.lds.S @@ -12,15 +12,15 @@ OUTPUT_FORMAT("elf32-microblaze", "elf32-microblaze", "elf32-microblaze") OUTPUT_ARCH(microblaze) ENTRY(_start) -#include #include +#include #include jiffies = jiffies_64 + 4; SECTIONS { . = CONFIG_KERNEL_START; - .text : { + .text : AT(ADDR(.text) - LOAD_OFFSET) { _text = . ; _stext = . ; *(.text .text.*) @@ -35,9 +35,12 @@ SECTIONS { } . = ALIGN (4) ; - _fdt_start = . ; /* place for fdt blob */ - . = . + 0x4000; - _fdt_end = . ; + __fdt_blob : AT(ADDR(__fdt_blob) - LOAD_OFFSET) { + _fdt_start = . ; /* place for fdt blob */ + *(__fdt_blob) ; /* Any link-placed DTB */ + . = _fdt_start + 0x4000; /* Pad up to 16kbyte */ + _fdt_end = . ; + } . = ALIGN(16); RODATA @@ -47,7 +50,7 @@ SECTIONS { * sdata2 section can go anywhere, but must be word aligned * and SDA2_BASE must point to the middle of it */ - .sdata2 : { + .sdata2 : AT(ADDR(.sdata2) - LOAD_OFFSET) { _ssrw = .; . = ALIGN(4096); /* page aligned when MMU used - origin 0x8 */ *(.sdata2) @@ -68,12 +71,12 @@ SECTIONS { /* Under the microblaze ABI, .sdata and .sbss must be contiguous */ . = ALIGN(8); - .sdata : { + .sdata : AT(ADDR(.sdata) - LOAD_OFFSET) { _ssro = .; *(.sdata) } - .sbss : { + .sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { _ssbss = .; *(.sbss) _esbss = .; @@ -86,26 +89,26 @@ SECTIONS { INIT_TEXT_SECTION(PAGE_SIZE) - .init.data : { + .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { INIT_DATA } . = ALIGN(4); - .init.ivt : { + .init.ivt : AT(ADDR(.init.ivt) - LOAD_OFFSET) { __ivt_start = .; *(.init.ivt) __ivt_end = .; } - .init.setup : { + .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { INIT_SETUP(0) } - .initcall.init : { + .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET ) { INIT_CALLS } - .con_initcall.init : { + .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) { CON_INITCALL } @@ -113,7 +116,7 @@ SECTIONS { __init_end_before_initramfs = .; - .init.ramfs ALIGN(4096) : { + .init.ramfs ALIGN(4096) : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { __initramfs_start = .; *(.init.ramfs) __initramfs_end = .; @@ -129,7 +132,8 @@ SECTIONS { } __init_end = .; - .bss ALIGN (4096) : { /* page aligned when MMU used */ + .bss ALIGN (4096) : AT(ADDR(.bss) - LOAD_OFFSET) { + /* page aligned when MMU used */ __bss_start = . ; *(.bss*) *(COMMON) -- cgit v1.2.3-55-g7522 From cfa9a775b9ddcef7f53c35e489a71cfed8c02710 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Mon, 22 Jun 2009 12:55:32 +0200 Subject: microblaze: Fix _start symbol to physical address _start is setup to physical kernel start address. This caused that when you load vmlinux (with MMU kernel) via XMD program counter (pc) is setup correctly and then you can write con and start kernel. Signed-off-by: Michal Simek --- arch/microblaze/kernel/vmlinux.lds.S | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/microblaze/kernel/vmlinux.lds.S') diff --git a/arch/microblaze/kernel/vmlinux.lds.S b/arch/microblaze/kernel/vmlinux.lds.S index dbb98f830f3e..e704188d7855 100644 --- a/arch/microblaze/kernel/vmlinux.lds.S +++ b/arch/microblaze/kernel/vmlinux.lds.S @@ -20,6 +20,7 @@ jiffies = jiffies_64 + 4; SECTIONS { . = CONFIG_KERNEL_START; + _start = CONFIG_KERNEL_BASE_ADDR; .text : AT(ADDR(.text) - LOAD_OFFSET) { _text = . ; _stext = . ; -- cgit v1.2.3-55-g7522