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