blob: 7fa7b15fd8e69f7065080855f18d59ef7405db84 [file] [log] [blame]
Stephen Rothwellcabb55872005-09-30 16:16:52 +10001#include <linux/config.h>
Paul Mackerrasc51e3a412005-11-05 10:36:59 +11002#ifdef CONFIG_PPC64
Stephen Rothwellcabb55872005-09-30 16:16:52 +10003#include <asm/page.h>
Paul Mackerrasc51e3a412005-11-05 10:36:59 +11004#else
5#define PAGE_SIZE 4096
6#define KERNELBASE CONFIG_KERNEL_START
7#endif
Paul Mackerras14cf11a2005-09-26 16:04:21 +10008#include <asm-generic/vmlinux.lds.h>
9
Michael Ellermane19e4ab2005-11-03 16:03:06 +110010ENTRY(_stext)
11
Stephen Rothwellcabb55872005-09-30 16:16:52 +100012#ifdef CONFIG_PPC64
13OUTPUT_ARCH(powerpc:common64)
14jiffies = jiffies_64;
15#else
Paul Mackerras14cf11a2005-09-26 16:04:21 +100016OUTPUT_ARCH(powerpc:common)
17jiffies = jiffies_64 + 4;
Stephen Rothwellcabb55872005-09-30 16:16:52 +100018#endif
Paul Mackerras14cf11a2005-09-26 16:04:21 +100019SECTIONS
20{
Stephen Rothwellcabb55872005-09-30 16:16:52 +100021 /* Sections to be discarded. */
22 /DISCARD/ : {
23 *(.exitcall.exit)
Stephen Rothwellcabb55872005-09-30 16:16:52 +100024 *(.exit.data)
Stephen Rothwellcabb55872005-09-30 16:16:52 +100025 }
26
Michael Ellermane19e4ab2005-11-03 16:03:06 +110027 . = KERNELBASE;
Stephen Rothwellcabb55872005-09-30 16:16:52 +100028
Paul Mackerras14cf11a2005-09-26 16:04:21 +100029 /* Read-only sections, merged into text segment: */
Stephen Rothwellcabb55872005-09-30 16:16:52 +100030 .text : {
Stephen Rothwellcabb55872005-09-30 16:16:52 +100031 *(.text .text.*)
Paul Mackerras14cf11a2005-09-26 16:04:21 +100032 SCHED_TEXT
33 LOCK_TEXT
Stephen Rothwellcabb55872005-09-30 16:16:52 +100034 KPROBES_TEXT
Paul Mackerras14cf11a2005-09-26 16:04:21 +100035 *(.fixup)
Stephen Rothwellcabb55872005-09-30 16:16:52 +100036#ifdef CONFIG_PPC32
Paul Mackerras14cf11a2005-09-26 16:04:21 +100037 *(.got1)
38 __got2_start = .;
39 *(.got2)
40 __got2_end = .;
Stephen Rothwellcabb55872005-09-30 16:16:52 +100041#else
42 . = ALIGN(PAGE_SIZE);
43 _etext = .;
44#endif
Paul Mackerras14cf11a2005-09-26 16:04:21 +100045 }
Stephen Rothwellcabb55872005-09-30 16:16:52 +100046#ifdef CONFIG_PPC32
Paul Mackerras14cf11a2005-09-26 16:04:21 +100047 _etext = .;
48 PROVIDE (etext = .);
49
50 RODATA
51 .fini : { *(.fini) } =0
52 .ctors : { *(.ctors) }
53 .dtors : { *(.dtors) }
54
55 .fixup : { *(.fixup) }
Stephen Rothwellcabb55872005-09-30 16:16:52 +100056#endif
Paul Mackerras14cf11a2005-09-26 16:04:21 +100057
58 __ex_table : {
59 __start___ex_table = .;
60 *(__ex_table)
61 __stop___ex_table = .;
62 }
63
64 __bug_table : {
65 __start___bug_table = .;
66 *(__bug_table)
67 __stop___bug_table = .;
68 }
69
Stephen Rothwellcabb55872005-09-30 16:16:52 +100070#ifdef CONFIG_PPC64
71 __ftr_fixup : {
72 __start___ftr_fixup = .;
73 *(__ftr_fixup)
74 __stop___ftr_fixup = .;
75 }
76
77 RODATA
78#endif
79
80#ifdef CONFIG_PPC32
Paul Mackerras14cf11a2005-09-26 16:04:21 +100081 /* Read-write section, merged into data segment: */
Paul Mackerras4a288562005-10-10 22:38:46 +100082 . = ALIGN(PAGE_SIZE);
Paul Mackerrasc16ff7e2005-10-06 13:28:31 +100083 _sdata = .;
Paul Mackerras14cf11a2005-09-26 16:04:21 +100084 .data :
85 {
86 *(.data)
87 *(.data1)
88 *(.sdata)
89 *(.sdata2)
90 *(.got.plt) *(.got)
91 *(.dynamic)
92 CONSTRUCTORS
93 }
94
Paul Mackerras4a288562005-10-10 22:38:46 +100095 . = ALIGN(PAGE_SIZE);
Paul Mackerras14cf11a2005-09-26 16:04:21 +100096 __nosave_begin = .;
97 .data_nosave : { *(.data.nosave) }
Paul Mackerras4a288562005-10-10 22:38:46 +100098 . = ALIGN(PAGE_SIZE);
Paul Mackerras14cf11a2005-09-26 16:04:21 +100099 __nosave_end = .;
100
101 . = ALIGN(32);
102 .data.cacheline_aligned : { *(.data.cacheline_aligned) }
103
104 _edata = .;
105 PROVIDE (edata = .);
106
107 . = ALIGN(8192);
108 .data.init_task : { *(.data.init_task) }
Paul Mackerras4a288562005-10-10 22:38:46 +1000109#endif
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000110
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000111 /* will be freed after init */
112 . = ALIGN(PAGE_SIZE);
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000113 __init_begin = .;
114 .init.text : {
115 _sinittext = .;
116 *(.init.text)
117 _einittext = .;
118 }
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000119#ifdef CONFIG_PPC32
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000120 /* .exit.text is discarded at runtime, not link time,
121 to deal with references from __bug_table */
122 .exit.text : { *(.exit.text) }
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000123#endif
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000124 .init.data : {
125 *(.init.data);
126 __vtop_table_begin = .;
127 *(.vtop_fixup);
128 __vtop_table_end = .;
129 __ptov_table_begin = .;
130 *(.ptov_fixup);
131 __ptov_table_end = .;
132 }
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000133
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000134 . = ALIGN(16);
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000135 .init.setup : {
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000136 __setup_start = .;
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000137 *(.init.setup)
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000138 __setup_end = .;
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000139 }
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000140
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000141 .initcall.init : {
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000142 __initcall_start = .;
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000143 *(.initcall1.init)
144 *(.initcall2.init)
145 *(.initcall3.init)
146 *(.initcall4.init)
147 *(.initcall5.init)
148 *(.initcall6.init)
149 *(.initcall7.init)
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000150 __initcall_end = .;
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000151 }
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000152
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000153 .con_initcall.init : {
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000154 __con_initcall_start = .;
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000155 *(.con_initcall.init)
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000156 __con_initcall_end = .;
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000157 }
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000158
159 SECURITY_INIT
160
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000161#ifdef CONFIG_PPC32
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000162 __start___ftr_fixup = .;
163 __ftr_fixup : { *(__ftr_fixup) }
164 __stop___ftr_fixup = .;
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000165#else
166 . = ALIGN(PAGE_SIZE);
167 .init.ramfs : {
168 __initramfs_start = .;
169 *(.init.ramfs)
170 __initramfs_end = .;
171 }
172#endif
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000173
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000174#ifdef CONFIG_PPC32
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000175 . = ALIGN(32);
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000176#endif
177 .data.percpu : {
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000178 __per_cpu_start = .;
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000179 *(.data.percpu)
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000180 __per_cpu_end = .;
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000181 }
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000182
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000183 . = ALIGN(PAGE_SIZE);
Paul Mackerras4a288562005-10-10 22:38:46 +1000184#ifdef CONFIG_PPC64
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000185 . = ALIGN(16384);
186 __init_end = .;
187 /* freed after init ends here */
188
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000189 /* Read/write sections */
190 . = ALIGN(PAGE_SIZE);
191 . = ALIGN(16384);
Paul Mackerras4a288562005-10-10 22:38:46 +1000192 _sdata = .;
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000193 /* The initial task and kernel stack */
194 .data.init_task : {
195 *(.data.init_task)
196 }
197
198 . = ALIGN(PAGE_SIZE);
199 .data.page_aligned : {
200 *(.data.page_aligned)
201 }
202
203 .data.cacheline_aligned : {
204 *(.data.cacheline_aligned)
205 }
206
207 .data : {
208 *(.data .data.rel* .toc1)
209 *(.branch_lt)
210 }
211
212 .opd : {
213 *(.opd)
214 }
215
216 .got : {
217 __toc_start = .;
218 *(.got)
219 *(.toc)
220 . = ALIGN(PAGE_SIZE);
221 _edata = .;
222 }
223
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000224 . = ALIGN(PAGE_SIZE);
225#else
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000226 __initramfs_start = .;
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000227 .init.ramfs : {
228 *(.init.ramfs)
229 }
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000230 __initramfs_end = .;
231
232 . = ALIGN(4096);
233 __init_end = .;
234
235 . = ALIGN(4096);
236 _sextratext = .;
237 _eextratext = .;
238
239 __bss_start = .;
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000240#endif
Paul Mackerras4a288562005-10-10 22:38:46 +1000241
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000242 .bss : {
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000243 __bss_start = .;
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000244 *(.sbss) *(.scommon)
245 *(.dynbss)
246 *(.bss)
247 *(COMMON)
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000248 __bss_stop = .;
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000249 }
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000250
251#ifdef CONFIG_PPC64
252 . = ALIGN(PAGE_SIZE);
253#endif
254 _end = . ;
255#ifdef CONFIG_PPC32
256 PROVIDE (end = .);
257#endif
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000258}