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