xref: /openbmc/linux/arch/powerpc/kernel/vmlinux.lds.S (revision 96de0e252cedffad61b3cb5e05662c591898e69a)
1#ifdef CONFIG_PPC64
2#include <asm/page.h>
3#define PROVIDE32(x)	PROVIDE(__unused__##x)
4#else
5#define PAGE_SIZE	4096
6#define KERNELBASE	CONFIG_KERNEL_START
7#define PROVIDE32(x)	PROVIDE(x)
8#endif
9#include <asm-generic/vmlinux.lds.h>
10#include <asm/cache.h>
11
12ENTRY(_stext)
13
14#ifdef CONFIG_PPC64
15OUTPUT_ARCH(powerpc:common64)
16jiffies = jiffies_64;
17#else
18OUTPUT_ARCH(powerpc:common)
19jiffies = jiffies_64 + 4;
20#endif
21SECTIONS
22{
23	/* Sections to be discarded. */
24	/DISCARD/ : {
25	*(.exitcall.exit)
26	*(.exit.data)
27	}
28
29	. = KERNELBASE;
30
31/*
32 * Text, read only data and other permanent read-only sections
33 */
34
35	/* Text and gots */
36	.text : {
37		ALIGN_FUNCTION();
38		*(.text.head)
39		_text = .;
40		TEXT_TEXT
41		SCHED_TEXT
42		LOCK_TEXT
43		KPROBES_TEXT
44		*(.fixup)
45
46#ifdef CONFIG_PPC32
47		*(.got1)
48		__got2_start = .;
49		*(.got2)
50		__got2_end = .;
51#endif /* CONFIG_PPC32 */
52
53		. = ALIGN(PAGE_SIZE);
54		_etext = .;
55		PROVIDE32 (etext = .);
56	}
57
58	/* Read-only data */
59	RODATA
60
61	/* Exception & bug tables */
62	__ex_table : {
63		__start___ex_table = .;
64		*(__ex_table)
65		__stop___ex_table = .;
66	}
67
68	NOTES
69
70	BUG_TABLE
71
72/*
73 * Init sections discarded at runtime
74 */
75	. = ALIGN(PAGE_SIZE);
76	__init_begin = .;
77
78	.init.text : {
79		_sinittext = .;
80		*(.init.text)
81		_einittext = .;
82	}
83
84	/* .exit.text is discarded at runtime, not link time,
85	 * to deal with references from __bug_table
86	 */
87	.exit.text : { *(.exit.text) }
88
89	.init.data : {
90		*(.init.data);
91		__vtop_table_begin = .;
92		*(.vtop_fixup);
93		__vtop_table_end = .;
94		__ptov_table_begin = .;
95		*(.ptov_fixup);
96		__ptov_table_end = .;
97#ifdef CONFIG_PPC_ISERIES
98		__dt_strings_start = .;
99		*(.dt_strings);
100		__dt_strings_end = .;
101#endif
102	}
103
104	. = ALIGN(16);
105	.init.setup : {
106		__setup_start = .;
107		*(.init.setup)
108		__setup_end = .;
109	}
110
111	.initcall.init : {
112		__initcall_start = .;
113		INITCALLS
114		__initcall_end = .;
115		}
116
117	.con_initcall.init : {
118		__con_initcall_start = .;
119		*(.con_initcall.init)
120		__con_initcall_end = .;
121	}
122
123	SECURITY_INIT
124
125	. = ALIGN(8);
126	__ftr_fixup : {
127		__start___ftr_fixup = .;
128		*(__ftr_fixup)
129		__stop___ftr_fixup = .;
130	}
131#ifdef CONFIG_PPC64
132	. = ALIGN(8);
133	__fw_ftr_fixup : {
134		__start___fw_ftr_fixup = .;
135		*(__fw_ftr_fixup)
136		__stop___fw_ftr_fixup = .;
137	}
138#endif
139#ifdef CONFIG_BLK_DEV_INITRD
140	. = ALIGN(PAGE_SIZE);
141	.init.ramfs : {
142		__initramfs_start = .;
143		*(.init.ramfs)
144		__initramfs_end = .;
145	}
146#endif
147	. = ALIGN(PAGE_SIZE);
148	.data.percpu : {
149		__per_cpu_start = .;
150		*(.data.percpu)
151		*(.data.percpu.shared_aligned)
152		__per_cpu_end = .;
153	}
154
155	. = ALIGN(8);
156	.machine.desc : {
157		__machine_desc_start = . ;
158		*(.machine.desc)
159		__machine_desc_end = . ;
160	}
161
162	/* freed after init ends here */
163	. = ALIGN(PAGE_SIZE);
164	__init_end = .;
165
166/*
167 * And now the various read/write data
168 */
169
170	. = ALIGN(PAGE_SIZE);
171	_sdata = .;
172
173#ifdef CONFIG_PPC32
174	.data    :
175	{
176		DATA_DATA
177		*(.sdata)
178		*(.got.plt) *(.got)
179	}
180#else
181	.data : {
182		DATA_DATA
183		*(.data.rel*)
184		*(.toc1)
185		*(.branch_lt)
186	}
187
188	.opd : {
189		*(.opd)
190	}
191
192	.got : {
193		__toc_start = .;
194		*(.got)
195		*(.toc)
196	}
197#endif
198
199	. = ALIGN(PAGE_SIZE);
200	_edata  =  .;
201	PROVIDE32 (edata = .);
202
203	/* The initial task and kernel stack */
204#ifdef CONFIG_PPC32
205	. = ALIGN(8192);
206#else
207	. = ALIGN(16384);
208#endif
209	.data.init_task : {
210		*(.data.init_task)
211	}
212
213	. = ALIGN(PAGE_SIZE);
214	.data.page_aligned : {
215		*(.data.page_aligned)
216	}
217
218	.data.cacheline_aligned : {
219		*(.data.cacheline_aligned)
220	}
221
222	. = ALIGN(L1_CACHE_BYTES);
223	.data.read_mostly : {
224		*(.data.read_mostly)
225	}
226
227	. = ALIGN(PAGE_SIZE);
228	__data_nosave : {
229		__nosave_begin = .;
230		*(.data.nosave)
231		. = ALIGN(PAGE_SIZE);
232		__nosave_end = .;
233	}
234
235/*
236 * And finally the bss
237 */
238
239	.bss : {
240		__bss_start = .;
241		*(.sbss) *(.scommon)
242		*(.dynbss)
243		*(.bss)
244		*(COMMON)
245		__bss_stop = .;
246	}
247
248	. = ALIGN(PAGE_SIZE);
249	_end = . ;
250	PROVIDE32 (end = .);
251}
252