xref: /openbmc/linux/arch/s390/kernel/vmlinux.lds.S (revision b8bb76713ec50df2f11efee386e16f93d51e1076)
1/* ld script to make s390 Linux kernel
2 * Written by Martin Schwidefsky (schwidefsky@de.ibm.com)
3 */
4
5#include <asm/thread_info.h>
6#include <asm/page.h>
7#include <asm-generic/vmlinux.lds.h>
8
9#ifndef CONFIG_64BIT
10OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390")
11OUTPUT_ARCH(s390)
12ENTRY(_start)
13jiffies = jiffies_64 + 4;
14#else
15OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
16OUTPUT_ARCH(s390:64-bit)
17ENTRY(_start)
18jiffies = jiffies_64;
19#endif
20
21PHDRS {
22	text PT_LOAD FLAGS(5);	/* R_E */
23	data PT_LOAD FLAGS(7);	/* RWE */
24	note PT_NOTE FLAGS(0);	/* ___ */
25}
26
27SECTIONS
28{
29	. = 0x00000000;
30	.text : {
31	_text = .;		/* Text and read-only data */
32		*(.text.head)
33	TEXT_TEXT
34		SCHED_TEXT
35		LOCK_TEXT
36		KPROBES_TEXT
37		*(.fixup)
38		*(.gnu.warning)
39	} :text = 0x0700
40
41	_etext = .;		/* End of text section */
42
43	NOTES :text :note
44
45	RODATA
46
47#ifdef CONFIG_SHARED_KERNEL
48	. = ALIGN(0x100000);	/* VM shared segments are 1MB aligned */
49#endif
50
51	. = ALIGN(PAGE_SIZE);
52	_eshared = .;		/* End of shareable data */
53
54	. = ALIGN(16);		/* Exception table */
55	__ex_table : {
56		__start___ex_table = .;
57		*(__ex_table)
58		__stop___ex_table = .;
59	} :data
60
61	.data : {		/* Data */
62		DATA_DATA
63		CONSTRUCTORS
64	}
65
66	. = ALIGN(PAGE_SIZE);
67	.data_nosave : {
68	__nosave_begin = .;
69		*(.data.nosave)
70	}
71	. = ALIGN(PAGE_SIZE);
72	__nosave_end = .;
73
74	. = ALIGN(PAGE_SIZE);
75	.data.page_aligned : {
76		*(.data.idt)
77	}
78
79	. = ALIGN(0x100);
80	.data.cacheline_aligned : {
81		*(.data.cacheline_aligned)
82	}
83
84	. = ALIGN(0x100);
85	.data.read_mostly : {
86		*(.data.read_mostly)
87	}
88	_edata = .;		/* End of data section */
89
90	. = ALIGN(THREAD_SIZE);	/* init_task */
91	.data.init_task : {
92		*(.data.init_task)
93	}
94
95	/* will be freed after init */
96	. = ALIGN(PAGE_SIZE);	/* Init code and data */
97	__init_begin = .;
98	.init.text : {
99		_sinittext = .;
100		INIT_TEXT
101		_einittext = .;
102	}
103	/*
104	 * .exit.text is discarded at runtime, not link time,
105	 * to deal with references from __bug_table
106	*/
107	.exit.text : {
108		EXIT_TEXT
109	}
110
111	/* early.c uses stsi, which requires page aligned data. */
112	. = ALIGN(PAGE_SIZE);
113	.init.data : {
114		INIT_DATA
115	}
116	. = ALIGN(0x100);
117	.init.setup : {
118		__setup_start = .;
119		*(.init.setup)
120		__setup_end = .;
121	}
122	.initcall.init : {
123		__initcall_start = .;
124		INITCALLS
125		__initcall_end = .;
126	}
127
128	.con_initcall.init : {
129		__con_initcall_start = .;
130		*(.con_initcall.init)
131		__con_initcall_end = .;
132	}
133	SECURITY_INIT
134
135#ifdef CONFIG_BLK_DEV_INITRD
136	. = ALIGN(0x100);
137	.init.ramfs : {
138		__initramfs_start = .;
139		*(.init.ramfs)
140		. = ALIGN(2);
141		__initramfs_end = .;
142	}
143#endif
144
145	PERCPU(PAGE_SIZE)
146	. = ALIGN(PAGE_SIZE);
147	__init_end = .;		/* freed after init ends here */
148
149	/* BSS */
150	.bss : {
151		__bss_start = .;
152		*(.bss)
153		. = ALIGN(2);
154		__bss_stop = .;
155	}
156
157	_end = . ;
158
159	/* Sections to be discarded */
160	/DISCARD/ : {
161		EXIT_DATA
162		*(.exitcall.exit)
163	}
164
165	/* Debugging sections.	*/
166	STABS_DEBUG
167	DWARF_DEBUG
168}
169