2009-09-18 19:52:53

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 0/3] Linker script cleanup patches for sparc and frv

Hi Linus,

This patch series contains patches cleaning up the linker scripts on
the frv and sparc architectures that have been acked by the relevant
maintainers. Please merge.

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.

Geoffrey Thomas (1):
sparc: Clean up linker script using new linker script macros.

Nelson Elhage (2):
frv: remove unused .altinstructions code
frv: clean up linker script using new linker script macros.

arch/frv/kernel/vmlinux.lds.S | 66 ++++------------------------------
arch/sparc/kernel/vmlinux.lds.S | 75 ++++-----------------------------------
2 files changed, 14 insertions(+), 127 deletions(-)


2009-09-18 19:53:58

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 1/3] frv: remove unused .altinstructions code

From: Nelson Elhage <[email protected]>

It appears that frv copied the .altinstructions definitions in its linker
script from x86. Since frv doesn't put anything in those sections, this
is just dead code.

Signed-off-by: Nelson Elhage <[email protected]>
Acked-by: David Howells <[email protected]>
Signed-off-by: Tim Abbott <[email protected]>
---
arch/frv/kernel/vmlinux.lds.S | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/arch/frv/kernel/vmlinux.lds.S b/arch/frv/kernel/vmlinux.lds.S
index 7dbf41f..cfb4181 100644
--- a/arch/frv/kernel/vmlinux.lds.S
+++ b/arch/frv/kernel/vmlinux.lds.S
@@ -51,11 +51,6 @@ SECTIONS
.con_initcall.init : { *(.con_initcall.init) }
__con_initcall_end = .;
SECURITY_INIT
- . = ALIGN(4);
- __alt_instructions = .;
- .altinstructions : { *(.altinstructions) }
- __alt_instructions_end = .;
- .altinstr_replacement : { *(.altinstr_replacement) }

PERCPU(4096)

--
1.6.3.3

2009-09-18 19:56:32

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 2/3] frv: clean up linker script using new linker script macros.

From: Nelson Elhage <[email protected]>

This is largely a straightforward conversion. The patch results in
fewer output sections, and some data being reordered, but should have
no functional impact.

Also, note that this patch moves some data (namely, init_task and
cacheline-aligned) inside [_sdata,_edata].

Because frv already builds using -ffunction-sections -fdata-sections,
we can't use BSS_SECTION or RW_DATA_SECTION yet, since they do not
currently include the required .bss.* and .data.* sections.

Signed-off-by: Nelson Elhage <[email protected]>
Acked-by: David Howells <[email protected]>
Signed-off-by: Tim Abbott <[email protected]>
---
arch/frv/kernel/vmlinux.lds.S | 61 +++++------------------------------------
1 files changed, 7 insertions(+), 54 deletions(-)

diff --git a/arch/frv/kernel/vmlinux.lds.S b/arch/frv/kernel/vmlinux.lds.S
index cfb4181..cbe811f 100644
--- a/arch/frv/kernel/vmlinux.lds.S
+++ b/arch/frv/kernel/vmlinux.lds.S
@@ -35,45 +35,13 @@ SECTIONS
#endif
}
_einittext = .;
- .init.data : { INIT_DATA }
-
- . = ALIGN(8);
- __setup_start = .;
- .setup.init : { KEEP(*(.init.setup)) }
- __setup_end = .;
-
- __initcall_start = .;
- .initcall.init : {
- INITCALLS
- }
- __initcall_end = .;
- __con_initcall_start = .;
- .con_initcall.init : { *(.con_initcall.init) }
- __con_initcall_end = .;
- SECURITY_INIT

+ INIT_DATA_SECTION(8)
PERCPU(4096)

-#ifdef CONFIG_BLK_DEV_INITRD
- . = ALIGN(4096);
- __initramfs_start = .;
- .init.ramfs : { *(.init.ramfs) }
- __initramfs_end = .;
-#endif
-
- . = ALIGN(THREAD_SIZE);
+ . = ALIGN(PAGE_SIZE);
__init_end = .;

- /* put sections together that have massive alignment issues */
- . = ALIGN(THREAD_SIZE);
- .data.init_task : {
- /* init task record & stack */
- *(.data.init_task)
- }
-
- . = ALIGN(L1_CACHE_BYTES);
- .data.cacheline_aligned : { *(.data.cacheline_aligned) }
-
.trap : {
/* trap table management - read entry-table.S before modifying */
. = ALIGN(8192);
@@ -119,13 +87,12 @@ SECTIONS

}

- . = ALIGN(8); /* Exception table */
- __start___ex_table = .;
- __ex_table : { KEEP(*(__ex_table)) }
- __stop___ex_table = .;
+ EXCEPTION_TABLE(8)

_sdata = .;
.data : { /* Data */
+ INIT_TASK_DATA(THREAD_SIZE)
+ CACHELINE_ALIGNED_DATA(L1_CACHE_BYTES)
DATA_DATA
*(.data.*)
EXIT_DATA
@@ -154,22 +121,8 @@ SECTIONS
. = ALIGN(PAGE_SIZE);
__kernel_image_end = .;

- /* Stabs debugging sections. */
- .stab 0 : { *(.stab) }
- .stabstr 0 : { *(.stabstr) }
- .stab.excl 0 : { *(.stab.excl) }
- .stab.exclstr 0 : { *(.stab.exclstr) }
- .stab.index 0 : { *(.stab.index) }
- .stab.indexstr 0 : { *(.stab.indexstr) }
-
- .debug_line 0 : { *(.debug_line) }
- .debug_info 0 : { *(.debug_info) }
- .debug_abbrev 0 : { *(.debug_abbrev) }
- .debug_aranges 0 : { *(.debug_aranges) }
- .debug_frame 0 : { *(.debug_frame) }
- .debug_pubnames 0 : { *(.debug_pubnames) }
- .debug_str 0 : { *(.debug_str) }
- .debug_ranges 0 : { *(.debug_ranges) }
+ STABS_DEBUG
+ DWARF_DEBUG

.comment 0 : { *(.comment) }

--
1.6.3.3

2009-09-18 19:53:10

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 3/3] sparc: Clean up linker script using new linker script macros.

From: Geoffrey Thomas <[email protected]>

Signed-off-by: Geoffrey Thomas <[email protected]>
Signed-off-by: Tim Abbott <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Acked-by: David S. Miller <[email protected]>
---
arch/sparc/kernel/vmlinux.lds.S | 75 ++++-----------------------------------
1 files changed, 7 insertions(+), 68 deletions(-)

diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S
index 866390f..4e59925 100644
--- a/arch/sparc/kernel/vmlinux.lds.S
+++ b/arch/sparc/kernel/vmlinux.lds.S
@@ -51,70 +51,27 @@ SECTIONS
_etext = .;

RO_DATA(PAGE_SIZE)
- .data : {
- DATA_DATA
- CONSTRUCTORS
- }
.data1 : {
*(.data1)
}
- . = ALIGN(SMP_CACHE_BYTES);
- .data.cacheline_aligned : {
- *(.data.cacheline_aligned)
- }
- . = ALIGN(SMP_CACHE_BYTES);
- .data.read_mostly : {
- *(.data.read_mostly)
- }
+ RW_DATA_SECTION(SMP_CACHE_BYTES, 0, THREAD_SIZE)
+
/* End of data section */
_edata = .;

- /* init_task */
- . = ALIGN(THREAD_SIZE);
- .data.init_task : {
- *(.data.init_task)
- }
.fixup : {
__start___fixup = .;
*(.fixup)
__stop___fixup = .;
}
- . = ALIGN(16);
- __ex_table : {
- __start___ex_table = .;
- *(__ex_table)
- __stop___ex_table = .;
- }
+ EXCEPTION_TABLE(16)
NOTES

. = ALIGN(PAGE_SIZE);
- .init.text : {
- __init_begin = .;
- _sinittext = .;
- INIT_TEXT
- _einittext = .;
- }
+ __init_begin = ALIGN(PAGE_SIZE);
+ INIT_TEXT_SECTION(PAGE_SIZE)
__init_text_end = .;
- .init.data : {
- INIT_DATA
- }
- . = ALIGN(16);
- .init.setup : {
- __setup_start = .;
- *(.init.setup)
- __setup_end = .;
- }
- .initcall.init : {
- __initcall_start = .;
- INITCALLS
- __initcall_end = .;
- }
- .con_initcall.init : {
- __con_initcall_start = .;
- *(.con_initcall.init)
- __con_initcall_end = .;
- }
- SECURITY_INIT
+ INIT_DATA_SECTION(16)

. = ALIGN(4);
.tsb_ldquad_phys_patch : {
@@ -146,29 +103,11 @@ SECTIONS
__sun4v_2insn_patch_end = .;
}

-#ifdef CONFIG_BLK_DEV_INITRD
- . = ALIGN(PAGE_SIZE);
- .init.ramfs : {
- __initramfs_start = .;
- *(.init.ramfs)
- __initramfs_end = .;
- }
-#endif
-
PERCPU(PAGE_SIZE)

. = ALIGN(PAGE_SIZE);
__init_end = .;
- __bss_start = .;
- .sbss : {
- *(.sbss)
- *(.scommon)
- }
- .bss : {
- *(.dynbss)
- *(.bss)
- *(COMMON)
- }
+ BSS_SECTION(0, 0, 0)
_end = . ;

STABS_DEBUG
--
1.6.3.3

2009-09-18 20:06:08

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH 0/3] Linker script cleanup patches for sparc and frv

On Fri, Sep 18, 2009 at 03:52:06PM -0400, Tim Abbott wrote:
> Hi Linus,
Hi Linus.

All three patches are:

Acked-by: Sam Ravnborg <[email protected]>

Sam