Linker script cleanup patches for alpha
Subsystems (2)
v2 cover Linker script cleanup patches for alpha
This is an updated version of the patch series I sent in late July cleaning up the alpha architecture's linker scripts. There are some fixes based on comments from Richard Henderson; it has also been rebased on top of Linus's current master.
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):
alpha: Clean up linker script using new linker script macros.
Tim Abbott (2):
alpha: use .data.init_task instead of .data.init_thread. Optimize the ordering of sections in RW_DATA_SECTION.
arch/alpha/kernel/init_task.c | 5 +- arch/alpha/kernel/vmlinux.lds.S | 95 ++++--------------------------------- include/asm-generic/vmlinux.lds.h | 4 +- 3 files changed, 14 insertions(+), 90 deletions(-)
PATCH v2 1/3 alpha: use .data.init_task instead of .data.init_thread.
alpha is the only architecture that uses the section name .data.init_thread instead of .data.init_task. So convert alpha to use .data.init_task like everything else.
.data.init_task does not need a separate output section; this change also moves it into the .data output section.
--- arch/alpha/kernel/init_task.c | 5 ++--- arch/alpha/kernel/vmlinux.lds.S | 7 ++----- 2 files changed, 4 insertions(+), 8 deletions(-)
arch/alpha/kernel/init_task.c +2 -3
@@ -13,6 +13,5 @@ static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);struct task_struct init_task =INIT_TASK (init_task);EXPORT_SYMBOL (init_task); -union thread_union init_thread_union - __attribute__((section(".data.init_thread"))) - = { INIT_THREAD_INFO(init_task) }; +union thread_union init_thread_union __init_task_data = + {INIT_THREAD_INFO (init_task) };
arch/alpha/kernel/vmlinux.lds.S +2 -5
@@ -1,5 +1,6 @@ #include <asm-generic/vmlinux.lds.h> #include <asm/page.h> +#include <asm/thread_info.h> OUTPUT_FORMAT("elf64-alpha") OUTPUT_ARCH(alpha)
@@ -92,11 +93,6 @@ SECTIONS __init_end = .; /* Freed after init ends here */ - /* Note 2 page alignment above. */ - .data.init_thread : { - *(.data.init_thread) - } - . = ALIGN(PAGE_SIZE); .data.page_aligned : { *(.data.page_aligned)
@@ -110,6 +106,7 @@ SECTIONS _data = .; /* Data */ .data : { + INIT_TASK_DATA(THREAD_SIZE) DATA_DATA CONSTRUCTORS }
Signature · 1 line
1.6.3.3
PATCH v2 2/3 alpha: Clean up linker script using new linker script macros.
In reply to Tim AbbottFrom: Geoffrey Thomas <[email protected]>
Note that .data.page_aligned and .data.cacheline_aligned are now after _data; it was probably a bug that they were before it.
Also, some explicit ALIGN(8)'s between various initcall sections were removed; this should be harmless as the implicit alignment of initcall_t was already 8.
--- arch/alpha/kernel/vmlinux.lds.S | 90 ++++----------------------------------- 1 files changed, 9 insertions(+), 81 deletions(-)
arch/alpha/kernel/vmlinux.lds.S +9 -81
@@ -32,84 +32,21 @@ SECTIONS } :kernel RODATA - - /* Exception table */ - . = ALIGN(16); - __ex_table : { - __start___ex_table = .; - *(__ex_table) - __stop___ex_table = .; - } + EXCEPTION_TABLE(16) /* Will be freed after init */ - . = ALIGN(PAGE_SIZE); - /* Init code and data */ - __init_begin = .; - .init.text : { - _sinittext = .; - INIT_TEXT - _einittext = .; - } - .init.data : { - INIT_DATA - } - - . = ALIGN(16); - .init.setup : { - __setup_start = .; - *(.init.setup) - __setup_end = .; - } - - . = ALIGN(8); - .initcall.init : { - __initcall_start = .; - INITCALLS - __initcall_end = .; - } - -#ifdef CONFIG_BLK_DEV_INITRD - . = ALIGN(PAGE_SIZE); - .init.ramfs : { - __initramfs_start = .; - *(.init.ramfs) - __initramfs_end = .; - } -#endif - - . = ALIGN(8); - .con_initcall.init : { - __con_initcall_start = .; - *(.con_initcall.init) - __con_initcall_end = .; - } - - . = ALIGN(8); - SECURITY_INIT - + __init_begin = ALIGN(PAGE_SIZE); + INIT_TEXT_SECTION(PAGE_SIZE) + INIT_DATA_SECTION(16) PERCPU(PAGE_SIZE) - - . = ALIGN(2 * PAGE_SIZE); + /* Align to THREAD_SIZE rather than PAGE_SIZE here so any padding page + needed for the THREAD_SIZE aligned init_task gets freed after init */ + . = ALIGN(THREAD_SIZE); __init_end = .; /* Freed after init ends here */ - . = ALIGN(PAGE_SIZE); - .data.page_aligned : { - *(.data.page_aligned) - } - - . = ALIGN(64); - .data.cacheline_aligned : { - *(.data.cacheline_aligned) - } - _data = .; - /* Data */ - .data : { - INIT_TASK_DATA(THREAD_SIZE) - DATA_DATA - CONSTRUCTORS - } + RW_DATA_SECTION(64, PAGE_SIZE, THREAD_SIZE) .got : { *(.got)
@@ -119,16 +56,7 @@ SECTIONS } _edata = .; /* End of data section */ - __bss_start = .; - .sbss : { - *(.sbss) - *(.scommon) - } - .bss : { - *(.bss) - *(COMMON) - } - __bss_stop = .; + BSS_SECTION(0, 0, 0) _end = .; .mdebug 0 : {
Signature · 1 line
1.6.3.3
PATCH v2 3/3 Optimize the ordering of sections in RW_DATA_SECTION.
In reply to Tim Abbott--- include/asm-generic/vmlinux.lds.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
include/asm-generic/vmlinux.lds.h +2 -2
@@ -720,12 +720,12 @@ . = ALIGN(PAGE_SIZE); \ .data : AT(ADDR(.data) - LOAD_OFFSET) { \ INIT_TASK_DATA(inittask) \ + NOSAVE_DATA \ + PAGE_ALIGNED_DATA(pagealigned) \ CACHELINE_ALIGNED_DATA(cacheline) \ READ_MOSTLY_DATA(cacheline) \ DATA_DATA \ CONSTRUCTORS \ - NOSAVE_DATA \ - PAGE_ALIGNED_DATA(pagealigned) \ }#define INIT_TEXT_SECTION (inittext_align) \
Signature · 1 line
1.6.3.3