xref: /linux/arch/powerpc/kernel/vmlinux.lds.S (revision 606d099cdd1080bbb50ea50dc52d98252f8f10a1)
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
11ENTRY(_stext)
12
13#ifdef CONFIG_PPC64
14OUTPUT_ARCH(powerpc:common64)
15jiffies = jiffies_64;
16#else
17OUTPUT_ARCH(powerpc:common)
18jiffies = jiffies_64 + 4;
19#endif
20SECTIONS
21{
22	/* Sections to be discarded. */
23	/DISCARD/ : {
24	*(.exitcall.exit)
25	*(.exit.data)
26	}
27
28	. = KERNELBASE;
29
30/*
31 * Text, read only data and other permanent read-only sections
32 */
33
34	/* Text and gots */
35	.text : {
36		_text = .;
37		*(.text .text.*)
38		SCHED_TEXT
39		LOCK_TEXT
40		KPROBES_TEXT
41		*(.fixup)
42
43#ifdef CONFIG_PPC32
44		*(.got1)
45		__got2_start = .;
46		*(.got2)
47		__got2_end = .;
48#endif /* CONFIG_PPC32 */
49
50		. = ALIGN(PAGE_SIZE);
51		_etext = .;
52		PROVIDE32 (etext = .);
53	}
54
55	/* Read-only data */
56	RODATA
57
58	/* Exception & bug tables */
59	__ex_table : {
60		__start___ex_table = .;
61		*(__ex_table)
62		__stop___ex_table = .;
63	}
64
65	__bug_table : {
66		__start___bug_table = .;
67		*(__bug_table)
68		__stop___bug_table = .;
69	}
70
71/*
72 * Init sections discarded at runtime
73 */
74	. = ALIGN(PAGE_SIZE);
75	__init_begin = .;
76
77	.init.text : {
78		_sinittext = .;
79		*(.init.text)
80		_einittext = .;
81	}
82
83	/* .exit.text is discarded at runtime, not link time,
84	 * to deal with references from __bug_table
85	 */
86	.exit.text : { *(.exit.text) }
87
88	.init.data : {
89		*(.init.data);
90		__vtop_table_begin = .;
91		*(.vtop_fixup);
92		__vtop_table_end = .;
93		__ptov_table_begin = .;
94		*(.ptov_fixup);
95		__ptov_table_end = .;
96#ifdef CONFIG_PPC_ISERIES
97		__dt_strings_start = .;
98		*(.dt_strings);
99		__dt_strings_end = .;
100#endif
101	}
102
103	. = ALIGN(16);
104	.init.setup : {
105		__setup_start = .;
106		*(.init.setup)
107		__setup_end = .;
108	}
109
110	.initcall.init : {
111		__initcall_start = .;
112		INITCALLS
113		__initcall_end = .;
114		}
115
116	.con_initcall.init : {
117		__con_initcall_start = .;
118		*(.con_initcall.init)
119		__con_initcall_end = .;
120	}
121
122	SECURITY_INIT
123
124	. = ALIGN(8);
125	__ftr_fixup : {
126		__start___ftr_fixup = .;
127		*(__ftr_fixup)
128		__stop___ftr_fixup = .;
129	}
130#ifdef CONFIG_PPC64
131	. = ALIGN(8);
132	__fw_ftr_fixup : {
133		__start___fw_ftr_fixup = .;
134		*(__fw_ftr_fixup)
135		__stop___fw_ftr_fixup = .;
136	}
137#endif
138
139	. = ALIGN(PAGE_SIZE);
140	.init.ramfs : {
141		__initramfs_start = .;
142		*(.init.ramfs)
143		__initramfs_end = .;
144	}
145
146#ifdef CONFIG_PPC32
147	. = ALIGN(32);
148#else
149	. = ALIGN(128);
150#endif
151	.data.percpu : {
152		__per_cpu_start = .;
153		*(.data.percpu)
154		__per_cpu_end = .;
155	}
156
157	. = ALIGN(8);
158	.machine.desc : {
159		__machine_desc_start = . ;
160		*(.machine.desc)
161		__machine_desc_end = . ;
162	}
163
164	/* freed after init ends here */
165	. = ALIGN(PAGE_SIZE);
166	__init_end = .;
167
168/*
169 * And now the various read/write data
170 */
171
172	. = ALIGN(PAGE_SIZE);
173	_sdata = .;
174
175#ifdef CONFIG_PPC32
176	.data    :
177	{
178		*(.data)
179		*(.sdata)
180		*(.got.plt) *(.got)
181	}
182#else
183	.data : {
184		*(.data .data.rel* .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(PAGE_SIZE);
223	__data_nosave : {
224		__nosave_begin = .;
225		*(.data.nosave)
226		. = ALIGN(PAGE_SIZE);
227		__nosave_end = .;
228	}
229
230/*
231 * And finally the bss
232 */
233
234	.bss : {
235		__bss_start = .;
236		*(.sbss) *(.scommon)
237		*(.dynbss)
238		*(.bss)
239		*(COMMON)
240		__bss_stop = .;
241	}
242
243	. = ALIGN(PAGE_SIZE);
244	_end = . ;
245	PROVIDE32 (end = .);
246}
247