Commit d6699e96 authored by Kai Germaschewski's avatar Kai Germaschewski

Consolidate read-only sections in arch/*/vmlinux.lds.S

It's annoying having to touch 20+ arch vmlinux.lds.S file for every
new section introduced, just because they all duplicate the same
statements. Since we preprocess vmlinux.lds.S anyway, let's
#include <asm-generic/vmlinux.lds.h> and share the common statements.

This is a first step in consolidating most of the read-only sections.
parent bb9fc49f
#include <linux/config.h>
#include <asm-generic/vmlinux.lds.h>
OUTPUT_FORMAT("elf64-alpha")
ENTRY(__start)
......@@ -25,30 +26,7 @@ SECTIONS
__stop___ex_table = .;
}
/* Kernel symbol table */
__ksymtab ALIGN(8) : {
__start___ksymtab = .;
*(__ksymtab)
__stop___ksymtab = .;
}
/* Kernel symbol table: GPL only */
__gpl_ksymtab ALIGN(8) : {
__start___gpl_ksymtab = .;
*(__gpl_ksymtab)
__stop___gpl_ksymtab = .;
}
/* All kernel symbols */
__kallsyms ALIGN(8) : {
__start___kallsyms = .;
*(__kallsyms)
__stop___kallsyms = .;
}
.kstrtab : { *(.kstrtab) }
__vermagic : { *(__vermagic) }
.rodata : { *(.rodata) *(.rodata.*) }
RODATA
/* Startup code */
.init.text ALIGN(8192) : {
......
......@@ -2,6 +2,9 @@
* taken from the i386 version by Russell King
* Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
*/
#include <asm-generic/vmlinux.lds.h>
OUTPUT_ARCH(arm)
ENTRY(stext)
jiffies = jiffies_64;
......@@ -63,9 +66,6 @@ SECTIONS
_etext = .; /* End of text section */
}
.kstrtab : { *(.kstrtab) }
__vermagic : { *(__vermagic) }
. = ALIGN(16);
__ex_table : { /* Exception table */
__start___ex_table = .;
......@@ -73,17 +73,7 @@ SECTIONS
__stop___ex_table = .;
}
__ksymtab : { /* Kernel symbol table */
__start___ksymtab = .;
*(__ksymtab)
__stop___ksymtab = .;
}
__gpl_ksymtab : { /* Kernel symbol table: GPL-only */
__start___gpl_ksymtab = .;
*(__gpl_ksymtab)
__stop___gpl_ksymtab = .;
}
RODATA
.data : {
/*
......
......@@ -2,6 +2,9 @@
* taken from the i386 version by Russell King
* Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
*/
#include <asm-generic/vmlinux.lds.h>
OUTPUT_ARCH(arm)
ENTRY(stext)
jiffies = jiffies_64;
......@@ -66,9 +69,6 @@ SECTIONS
_etext = .; /* End of text section */
}
.kstrtab : { *(.kstrtab) }
__vermagic : { *(__vermagic) }
. = ALIGN(16);
__ex_table : { /* Exception table */
__start___ex_table = .;
......@@ -76,23 +76,7 @@ SECTIONS
__stop___ex_table = .;
}
__gpl_ksymtab : { /* GPL Kernel symbol table */
__start___gpl_ksymtab = .;
*(__gpl_ksymtab)
__stop___gpl_ksymtab = .;
}
__ksymtab : { /* Kernel symbol table */
__start___ksymtab = .;
*(__ksymtab)
__stop___ksymtab = .;
}
__kallsyms : { /* All kernel symbols */
__start___kallsyms = .;
*(__kallsyms)
__stop___kallsyms = .;
}
RODATA
. = ALIGN(8192);
......
......@@ -9,7 +9,8 @@
*/
#include <linux/config.h>
#include <asm-generic/vmlinux.lds.h>
jiffies = jiffies_64;
SECTIONS
{
......@@ -31,22 +32,12 @@ SECTIONS
_etext = . ; /* End of text section */
__etext = .;
.rodata : { *(.rodata) *(.rodata.__*) }
.kstrtab : { *(.kstrtab) }
__vermagic : { *(__vermagic) }
. = ALIGN(4); /* Exception table */
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
__start___ksymtab = .; /* Kernel symbol table */
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
__start___gpl_ksymtab = .; /* Kernel symbol table: GPL-only */
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
RODATA
. = ALIGN (4);
___data_start = . ;
......
/* ld script to make i386 Linux kernel
* Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
*/
#include <asm-generic/vmlinux.lds.h>
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)
ENTRY(_start)
......@@ -18,27 +21,12 @@ SECTIONS
_etext = .; /* End of text section */
.rodata : { *(.rodata) *(.rodata.*) }
.kstrtab : { *(.kstrtab) }
__vermagic : { *(__vermagic) }
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
. = ALIGN(64);
__start___ksymtab = .; /* Kernel symbol table */
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
__start___gpl_ksymtab = .; /* Kernel symbol table: GPL-only symbols */
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
__start___kallsyms = .; /* All kernel symbols */
__kallsyms : { *(__kallsyms) }
__stop___kallsyms = .;
RODATA
/* writeable */
.data : { /* Data */
......
/* ld script to make m68k Linux kernel */
#include <asm-generic/vmlinux.lds.h>
OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k")
OUTPUT_ARCH(m68k)
ENTRY(_start)
......@@ -12,22 +15,13 @@ SECTIONS
*(.fixup)
*(.gnu.warning)
} = 0x4e75
.rodata : { *(.rodata) *(.rodata.*) }
.kstrtab : { *(.kstrtab) }
__vermagic : { *(__vermagic) }
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
__start___ksymtab = .; /* Kernel symbol table */
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
__start___gpl_ksymtab = .; /* Kernel symbol table: GPL only */
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
RODATA
_etext = .; /* End of text section */
......
/* ld script to make m68k Linux kernel */
#include <asm-generic/vmlinux.lds.h>
OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k")
OUTPUT_ARCH(m68k)
ENTRY(_start)
......@@ -13,26 +16,16 @@ SECTIONS
*(.fixup)
*(.gnu.warning)
} = 0x4e75
.kstrtab : { *(.kstrtab) }
__vermagic : { *(__vermagic) }
_etext = .; /* End of text section */
.data : { /* Data */
*(.rodata)
*(.rodata.*)
*(.data)
RODATA
CONSTRUCTORS
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
*(__ex_table)
__stop___ex_table = .;
__start___ksymtab = .; /* Kernel symbol table */
*(__ksymtab)
__stop___ksymtab = .;
__start___gpl_ksymtab = .; /* Kernel symbol table: GPL-only */
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
}
/* End of data goes *here* so that freeing init code works properly. */
_edata = .;
......
......@@ -10,6 +10,7 @@
*/
#include <linux/config.h>
#include <asm-generic/vmlinux.lds.h>
/*
* Original Palm pilot (same for Xcopilot).
......@@ -219,21 +220,13 @@ SECTIONS {
_stext = . ;
*(.text)
*(.text.lock)
*(.rodata)
*(.rodata.*)
. = ALIGN(0x4) ;
*(.kstrtab)
*(__vermagic)
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
*(__ex_table)
__stop___ex_table = .;
__start___ksymtab = .; /* Kernel symbol table */
*(__ksymtab)
__stop___ksymtab = .;
RODATA
. = ALIGN(4) ;
_etext = . ;
......
#include <asm-generic/vmlinux.lds.h>
OUTPUT_ARCH(mips)
ENTRY(kernel_entry)
SECTIONS
......@@ -9,13 +11,9 @@ SECTIONS
{
_ftext = . ;
*(.text)
*(.rodata)
*(.rodata1)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
} =0
.kstrtab : { *(.kstrtab) }
__vermagic : { *(__vermagic) }
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
......@@ -26,14 +24,8 @@ SECTIONS
__dbe_table : { *(__dbe_table) }
__stop___dbe_table = .;
__start___ksymtab = .; /* Kernel symbol table */
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
__start___gpl_ksymtab = .; /* Kernel symbol table: GPL-only symbols */
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
RODATA
_etext = .;
. = ALIGN(8192);
......
#include <asm-generic/vmlinux.lds.h>
OUTPUT_ARCH(mips)
ENTRY(kernel_entry)
SECTIONS
......@@ -7,14 +9,9 @@ SECTIONS
.text :
{
*(.text)
*(.rodata)
*(.rodata.*)
*(.rodata1)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
} =0
.kstrtab : { *(.kstrtab) }
__vermagic : { *(__vermagic) }
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
......@@ -25,6 +22,8 @@ SECTIONS
__dbe_table : { *(__dbe_table) }
__stop___dbe_table = .;
RODATA
_etext = .;
. = ALIGN(16384);
......
#include <linux/config.h>
#include <asm-generic/vmlinux.lds.h>
/* ld script to make hppa Linux kernel */
#ifndef CONFIG_PARISC64
OUTPUT_FORMAT("elf32-hppa-linux")
......@@ -31,32 +32,17 @@ SECTIONS
_etext = .; /* End of text section */
. = ALIGN(16);
.rodata : { *(.rodata) *(.rodata.*) }
.kstrtab : { *(.kstrtab) }
__vermagic : { *(__vermagic) }
.data BLOCK(8192) : { /* Data without special */
data_start = .;
*(.data)
}
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
__start___ksymtab = .; /* Kernel symbol table */
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
__start___gpl_ksymtab = .; /* Kernel symbol table: GPL-only symbols */
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
RODATA
__start___kallsyms = .; /* All kernel symbols */
__kallsyms : { *(__kallsyms) }
__stop___kallsyms = .;
.data BLOCK(8192) : { /* Data without special */
data_start = .;
*(.data)
}
#ifdef CONFIG_PARISC64
. = ALIGN(16); /* Linkage tables */
......
#include <asm-generic/vmlinux.lds.h>
OUTPUT_ARCH(powerpc)
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
/* Do we need any of these for elf?
......@@ -40,14 +42,8 @@ SECTIONS
}
_etext = .;
PROVIDE (etext = .);
.rodata :
{
*(.rodata)
*(.rodata.*)
*(.rodata1)
}
.kstrtab : { *(.kstrtab) }
__vermagic : { *(__vermagic) }
RODATA
.fini : { *(.fini) } =0
.ctors : { *(.ctors) }
.dtors : { *(.dtors) }
......@@ -58,18 +54,6 @@ SECTIONS
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
__start___ksymtab = .; /* Kernel symbol table */
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
__start___gpl_ksymtab = .; /* Kernel symbol table: GPL-only symbols */
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
__start___kallsyms = .; /* All kernel symbols */
__kallsyms : { *(__kallsyms) }
__stop___kallsyms = .;
/* Read-write section, merged into data segment: */
. = ALIGN(4096);
.data :
......
#include <asm-generic/vmlinux.lds.h>
OUTPUT_ARCH(powerpc:common64)
/* Do we need any of these for elf?
__DYNAMIC = 0; */
......@@ -37,11 +39,9 @@ SECTIONS
. = ALIGN(4096);
_etext = .;
PROVIDE (etext = .);
.rodata :
{
*(.rodata)
*(.rodata1)
}
RODATA
.fini : { *(.fini) } =0
.ctors : { *(.ctors) }
.dtors : { *(.dtors) }
......@@ -65,18 +65,6 @@ SECTIONS
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
__start___ksymtab = .; /* Kernel symbol table */
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
__start___gpl_ksymtab = .; /* Kernel symbol table: GPL-only symbols */
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
__start___kallsyms = .; /* All kernel symbols */
__kallsyms : { *(__kallsyms) }
__stop___kallsyms = .;
. = ALIGN(16384); /* init_task */
.data.init_task : { *(.data.init_task) }
......
/* ld script to make s390 Linux kernel
* Written by Martin Schwidefsky (schwidefsky@de.ibm.com)
*/
#include <asm-generic/vmlinux.lds.h>
OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390")
OUTPUT_ARCH(s390)
ENTRY(_start)
......@@ -17,23 +20,12 @@ SECTIONS
_etext = .; /* End of text section */
.rodata : { *(.rodata) *(.rodata.*) }
.kstrtab : { *(.kstrtab) }
__vermagic : { *(__vermagic) }
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
. = ALIGN(64);
__start___ksymtab = .; /* Kernel symbol table */
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
__start___gpl_ksymtab = .; /* Kernel symbol table: GPL-only symbols */
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
RODATA
#ifdef CONFIG_SHARED_KERNEL
. = ALIGN(1048576); /* VM shared segments are 1MB aligned */
......
/*
* Written by Martin Schwidefsky (schwidefsky@de.ibm.com)
*/
#include <asm-generic/vmlinux.lds.h>
OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
OUTPUT_ARCH(s390:64-bit)
ENTRY(_start)
......@@ -17,23 +20,12 @@ SECTIONS
_etext = .; /* End of text section */
.rodata : { *(.rodata) *(.rodata.*) }
.kstrtab : { *(.kstrtab) }
__vermagic : { *(__vermagic) }
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
. = ALIGN(64);
__start___ksymtab = .; /* Kernel symbol table */
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
__start___gpl_ksymtab = .; /* Kernel symbol table: GPL-only symbols */
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
RODATA
#ifdef CONFIG_SHARED_KERNEL
. = ALIGN(1048576); /* VM shared segments are 1MB aligned */
......
......@@ -3,6 +3,8 @@
* Written by Niibe Yutaka
*/
#include <linux/config.h>
#include <asm-generic/vmlinux.lds.h>
#ifdef CONFIG_CPU_LITTLE_ENDIAN
OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux", "elf32-sh-linux")
jiffies = jiffies_64;
......@@ -25,26 +27,13 @@ SECTIONS
*(.fixup)
*(.gnu.warning)
} = 0x0009
.rodata : { *(.rodata) *(.rodata.*) }
.kstrtab : { *(.kstrtab) }
__vermagic : { *(__vermagic) }
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
__start___ksymtab = .; /* Kernel symbol table */
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
__start___gpl_ksymtab = .; /* Kernel symbol table: GPL-only symbols */
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
__start___kallsyms = .; /* All kernel symbols */
__kallsyms : { *(__kallsyms) }
__stop___kallsyms = .;
RODATA
_etext = .; /* End of text section */
......
/* ld script to make SparcLinux kernel */
#include <asm-generic/vmlinux.lds.h>
OUTPUT_FORMAT("elf32-sparc", "elf32-sparc", "elf32-sparc")
OUTPUT_ARCH(sparc)
ENTRY(_start)
......@@ -13,8 +16,7 @@ SECTIONS
} =0
_etext = .;
PROVIDE (etext = .);
.rodata : { *(.rodata) *(.rodata.*) }
.rodata1 : { *(.rodata1) }
RODATA
.data :
{
*(.data)
......@@ -30,19 +32,6 @@ SECTIONS
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
. = ALIGN(64);
__start___ksymtab = .;
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
__start___gpl_ksymtab = .;
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
__start___kallsyms = .; /* All kernel symbols */
__kallsyms : { *(__kallsyms) }
__stop___kallsyms = .;
. = ALIGN(4096);
__init_begin = .;
.init.text : { *(.init.text) }
......
/* ld script to make UltraLinux kernel */
#include <asm-generic/vmlinux.lds.h>
OUTPUT_FORMAT("elf64-sparc", "elf64-sparc", "elf64-sparc")
OUTPUT_ARCH(sparc:v9a)
ENTRY(_start)
......@@ -16,8 +19,9 @@ SECTIONS
} =0
_etext = .;
PROVIDE (etext = .);
.rodata : { *(.rodata) *(.rodata.*) }
.rodata1 : { *(.rodata1) }
RODATA
.data :
{
*(.data)
......@@ -35,18 +39,6 @@ SECTIONS
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
. = ALIGN(64);
__start___ksymtab = .;
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
__start___gpl_ksymtab = .;
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
__kstrtab : { *(.kstrtab) }
__vermagic : { *(__vermagic) }
__start___kallsyms = .; /* All kernel symbols */
__kallsyms : { *(__kallsyms) }
__stop___kallsyms = .;
. = ALIGN(8192);
__init_begin = .;
.init.text : { *(.init.text) }
......
#include <asm-generic/vmlinux.lds.h>
OUTPUT_FORMAT(ELF_FORMAT)
OUTPUT_ARCH(ELF_ARCH)
ENTRY(_start)
......@@ -31,21 +33,15 @@ SECTIONS
*(.gnu.warning)
*(.gnu.linkonce.t*)
}
.kstrtab : { *(.kstrtab) }
__vermagic : { *(__vermagic) }
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
. = ALIGN(64);
__start___ksymtab = .; /* Kernel symbol table */
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
RODATA
.fini : { *(.fini) } =0x9090
.rodata : { *(.rodata) *(.gnu.linkonce.r*) }
.rodata1 : { *(.rodata1) }
_etext = .;
PROVIDE (etext = .);
......
......@@ -12,6 +12,7 @@
*/
#include <linux/config.h>
#include <asm-generic/vmlinux.lds.h>
/* The following macros contain the usual definitions for various data areas.
......@@ -38,10 +39,7 @@
*(.text.lock) \
*(.exitcall.exit) \
__real_etext = . ; /* There may be data after here. */ \
*(.rodata) \
. = ALIGN (0x4) ; \
*(.kstrtab) \
*(__vermagic) \
RODATA \
. = ALIGN (4) ; \
*(.call_table_data) \
*(.call_table_text) \
......@@ -49,12 +47,6 @@
___start___ex_table = . ; \
*(__ex_table) \
___stop___ex_table = . ; \
___start___ksymtab = . ;/* Kernel symbol table. */ \
*(__ksymtab) \
___stop___ksymtab = . ; \
___start___gpl_ksymtab = . ; /* Same for GPL symbols. */ \
*(__gpl_ksymtab) \
___stop___gpl_ksymtab = . ; \
. = ALIGN (4) ; \
__etext = . ;
......
/* ld script to make x86-64 Linux kernel
* Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
*/
#include <asm-generic/vmlinux.lds.h>
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
OUTPUT_ARCH(i386:x86-64)
ENTRY(_start)
......@@ -18,26 +21,12 @@ SECTIONS
_etext = .; /* End of text section */
.rodata : { *(.rodata) *(.rodata.*) }
.kstrtab : { *(.kstrtab) }
__vermagic : { *(__vermagic) }
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
. = ALIGN(64);
__start___ksymtab = .; /* Kernel symbol table */
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
__start___gpl_ksymtab = .; /* Kernel symbol table: GPL-only symbols */
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
__start___kallsyms = .; /* All kernel symbols */
__kallsyms : { *(__kallsyms) }
__stop___kallsyms = .;
RODATA
.data : { /* Data */
*(.data)
......
#define RODATA \
.rodata : { *(.rodata) *(.rodata.*) *(.rodata1) } \
.rodata1 : { *(.rodata1) } \
\
.kstrtab : { *(.kstrtab) } \
\
/* Kernel version magic */ \
__vermagic : { *(__vermagic) } \
\
/* Kernel symbol table */ \
. = ALIGN(64); \
__start___ksymtab = .; \
__ksymtab : { *(__ksymtab) } \
__stop___ksymtab = .; \
\
/* Kernel symbol table: GPL-only symbols */ \
__start___gpl_ksymtab = .; \
__gpl_ksymtab : { *(__gpl_ksymtab) } \
__stop___gpl_ksymtab = .; \
\
/* All kernel symbols */ \
__start___kallsyms = .; \
__kallsyms : { *(__kallsyms) } \
__stop___kallsyms = .; \
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment