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