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