]>
Commit | Line | Data |
---|---|---|
c51e3a41 | 1 | #ifdef CONFIG_PPC64 |
e8222502 | 2 | #define PROVIDE32(x) PROVIDE(__unused__##x) |
c51e3a41 | 3 | #else |
e8222502 | 4 | #define PROVIDE32(x) PROVIDE(x) |
c51e3a41 | 5 | #endif |
4846c5de | 6 | #include <asm/page.h> |
14cf11af | 7 | #include <asm-generic/vmlinux.lds.h> |
bd67fcf9 | 8 | #include <asm/cache.h> |
14cf11af | 9 | |
e19e4ab4 ME |
10 | ENTRY(_stext) |
11 | ||
c69cccc9 SB |
12 | PHDRS { |
13 | kernel PT_LOAD FLAGS(7); /* RWX */ | |
14 | notes PT_NOTE FLAGS(0); | |
15 | dummy PT_NOTE FLAGS(0); | |
16 | ||
17 | /* binutils < 2.18 has a bug that makes it misbehave when taking an | |
18 | ELF file with all segments at load address 0 as input. This | |
19 | happens when running "strip" on vmlinux, because of the AT() magic | |
20 | in this linker script. People using GCC >= 4.2 won't run into | |
21 | this problem, because the "build-id" support will put some data | |
22 | into the "notes" segment (at a non-zero load address). | |
23 | ||
24 | To work around this, we force some data into both the "dummy" | |
25 | segment and the kernel segment, so the dummy segment will get a | |
26 | non-zero load address. It's not enough to always create the | |
27 | "notes" segment, since if nothing gets assigned to it, its load | |
28 | address will be zero. */ | |
29 | } | |
30 | ||
cabb5587 SR |
31 | #ifdef CONFIG_PPC64 |
32 | OUTPUT_ARCH(powerpc:common64) | |
33 | jiffies = jiffies_64; | |
34 | #else | |
14cf11af PM |
35 | OUTPUT_ARCH(powerpc:common) |
36 | jiffies = jiffies_64 + 4; | |
cabb5587 | 37 | #endif |
14cf11af PM |
38 | SECTIONS |
39 | { | |
e8222502 BH |
40 | /* Sections to be discarded. */ |
41 | /DISCARD/ : { | |
42 | *(.exitcall.exit) | |
405d967d | 43 | *(.discard) |
01ba2bdc | 44 | EXIT_DATA |
e8222502 | 45 | } |
14cf11af | 46 | |
e8222502 | 47 | . = KERNELBASE; |
14cf11af | 48 | |
e8222502 BH |
49 | /* |
50 | * Text, read only data and other permanent read-only sections | |
51 | */ | |
52 | ||
53 | /* Text and gots */ | |
366234f6 | 54 | .text : AT(ADDR(.text) - LOAD_OFFSET) { |
748a7683 | 55 | ALIGN_FUNCTION(); |
e7039845 | 56 | HEAD_TEXT |
fd593d12 | 57 | _text = .; |
13beadd9 TA |
58 | /* careful! __ftr_alt_* sections need to be close to .text */ |
59 | *(.text .fixup __ftr_alt_* .ref.text) | |
e8222502 BH |
60 | SCHED_TEXT |
61 | LOCK_TEXT | |
62 | KPROBES_TEXT | |
6794c782 | 63 | IRQENTRY_TEXT |
14cf11af | 64 | |
e8222502 BH |
65 | #ifdef CONFIG_PPC32 |
66 | *(.got1) | |
67 | __got2_start = .; | |
68 | *(.got2) | |
69 | __got2_end = .; | |
70 | #endif /* CONFIG_PPC32 */ | |
71 | ||
c69cccc9 | 72 | } :kernel |
e8222502 | 73 | |
303996da SR |
74 | . = ALIGN(PAGE_SIZE); |
75 | _etext = .; | |
76 | PROVIDE32 (etext = .); | |
77 | ||
e8222502 BH |
78 | /* Read-only data */ |
79 | RODATA | |
80 | ||
81 | /* Exception & bug tables */ | |
366234f6 | 82 | __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { |
14cf11af PM |
83 | __start___ex_table = .; |
84 | *(__ex_table) | |
85 | __stop___ex_table = .; | |
86 | } | |
87 | ||
c69cccc9 SB |
88 | NOTES :kernel :notes |
89 | ||
90 | /* The dummy segment contents for the bug workaround mentioned above | |
91 | near PHDRS. */ | |
80c60bf9 | 92 | .dummy : AT(ADDR(.dummy) - LOAD_OFFSET) { |
e16459c6 MM |
93 | LONG(0) |
94 | LONG(0) | |
95 | LONG(0) | |
c69cccc9 | 96 | } :kernel :dummy |
8fb775ee | 97 | |
e8222502 BH |
98 | /* |
99 | * Init sections discarded at runtime | |
100 | */ | |
101 | . = ALIGN(PAGE_SIZE); | |
102 | __init_begin = .; | |
103 | ||
366234f6 | 104 | .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { |
e8222502 | 105 | _sinittext = .; |
01ba2bdc | 106 | INIT_TEXT |
e8222502 | 107 | _einittext = .; |
c69cccc9 | 108 | } :kernel |
e8222502 BH |
109 | |
110 | /* .exit.text is discarded at runtime, not link time, | |
111 | * to deal with references from __bug_table | |
112 | */ | |
366234f6 | 113 | .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { |
01ba2bdc SR |
114 | EXIT_TEXT |
115 | } | |
e8222502 | 116 | |
366234f6 | 117 | .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { |
01ba2bdc | 118 | INIT_DATA |
e8222502 BH |
119 | __vtop_table_begin = .; |
120 | *(.vtop_fixup); | |
121 | __vtop_table_end = .; | |
122 | __ptov_table_begin = .; | |
123 | *(.ptov_fixup); | |
124 | __ptov_table_end = .; | |
c4e3ea25 SR |
125 | #ifdef CONFIG_PPC_ISERIES |
126 | __dt_strings_start = .; | |
127 | *(.dt_strings); | |
128 | __dt_strings_end = .; | |
129 | #endif | |
e8222502 BH |
130 | } |
131 | ||
132 | . = ALIGN(16); | |
366234f6 | 133 | .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { |
e8222502 BH |
134 | __setup_start = .; |
135 | *(.init.setup) | |
136 | __setup_end = .; | |
137 | } | |
138 | ||
366234f6 | 139 | .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) { |
e8222502 | 140 | __initcall_start = .; |
61ce1efe | 141 | INITCALLS |
e8222502 BH |
142 | __initcall_end = .; |
143 | } | |
144 | ||
366234f6 | 145 | .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) { |
e8222502 BH |
146 | __con_initcall_start = .; |
147 | *(.con_initcall.init) | |
148 | __con_initcall_end = .; | |
149 | } | |
150 | ||
151 | SECURITY_INIT | |
152 | ||
153 | . = ALIGN(8); | |
366234f6 | 154 | __ftr_fixup : AT(ADDR(__ftr_fixup) - LOAD_OFFSET) { |
cabb5587 SR |
155 | __start___ftr_fixup = .; |
156 | *(__ftr_fixup) | |
157 | __stop___ftr_fixup = .; | |
158 | } | |
2d1b2027 | 159 | . = ALIGN(8); |
7c03d653 BH |
160 | __mmu_ftr_fixup : AT(ADDR(__mmu_ftr_fixup) - LOAD_OFFSET) { |
161 | __start___mmu_ftr_fixup = .; | |
162 | *(__mmu_ftr_fixup) | |
163 | __stop___mmu_ftr_fixup = .; | |
164 | } | |
165 | . = ALIGN(8); | |
2d1b2027 KG |
166 | __lwsync_fixup : AT(ADDR(__lwsync_fixup) - LOAD_OFFSET) { |
167 | __start___lwsync_fixup = .; | |
168 | *(__lwsync_fixup) | |
169 | __stop___lwsync_fixup = .; | |
170 | } | |
3f639ee8 SR |
171 | #ifdef CONFIG_PPC64 |
172 | . = ALIGN(8); | |
366234f6 | 173 | __fw_ftr_fixup : AT(ADDR(__fw_ftr_fixup) - LOAD_OFFSET) { |
3f639ee8 SR |
174 | __start___fw_ftr_fixup = .; |
175 | *(__fw_ftr_fixup) | |
176 | __stop___fw_ftr_fixup = .; | |
177 | } | |
178 | #endif | |
67d38229 | 179 | #ifdef CONFIG_BLK_DEV_INITRD |
e8222502 | 180 | . = ALIGN(PAGE_SIZE); |
366234f6 | 181 | .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { |
e8222502 BH |
182 | __initramfs_start = .; |
183 | *(.init.ramfs) | |
184 | __initramfs_end = .; | |
185 | } | |
67d38229 | 186 | #endif |
19390c4d | 187 | PERCPU(PAGE_SIZE) |
14cf11af | 188 | |
e8222502 | 189 | . = ALIGN(8); |
366234f6 | 190 | .machine.desc : AT(ADDR(.machine.desc) - LOAD_OFFSET) { |
e8222502 BH |
191 | __machine_desc_start = . ; |
192 | *(.machine.desc) | |
193 | __machine_desc_end = . ; | |
194 | } | |
2a4b9c5a | 195 | #ifdef CONFIG_RELOCATABLE |
549e8152 PM |
196 | . = ALIGN(8); |
197 | .dynsym : AT(ADDR(.dynsym) - LOAD_OFFSET) { *(.dynsym) } | |
198 | .dynstr : AT(ADDR(.dynstr) - LOAD_OFFSET) { *(.dynstr) } | |
199 | .dynamic : AT(ADDR(.dynamic) - LOAD_OFFSET) | |
200 | { | |
201 | __dynamic_start = .; | |
202 | *(.dynamic) | |
203 | } | |
204 | .hash : AT(ADDR(.hash) - LOAD_OFFSET) { *(.hash) } | |
205 | .interp : AT(ADDR(.interp) - LOAD_OFFSET) { *(.interp) } | |
206 | .rela.dyn : AT(ADDR(.rela.dyn) - LOAD_OFFSET) | |
207 | { | |
208 | __rela_dyn_start = .; | |
209 | *(.rela*) | |
210 | } | |
2a4b9c5a | 211 | #endif |
e8222502 BH |
212 | |
213 | /* freed after init ends here */ | |
214 | . = ALIGN(PAGE_SIZE); | |
215 | __init_end = .; | |
216 | ||
217 | /* | |
218 | * And now the various read/write data | |
219 | */ | |
220 | ||
221 | . = ALIGN(PAGE_SIZE); | |
222 | _sdata = .; | |
14cf11af | 223 | |
cabb5587 | 224 | #ifdef CONFIG_PPC32 |
366234f6 | 225 | .data : AT(ADDR(.data) - LOAD_OFFSET) { |
ca967258 | 226 | DATA_DATA |
e8222502 BH |
227 | *(.sdata) |
228 | *(.got.plt) *(.got) | |
229 | } | |
cabb5587 | 230 | #else |
366234f6 | 231 | .data : AT(ADDR(.data) - LOAD_OFFSET) { |
3ae0aa9f MD |
232 | DATA_DATA |
233 | *(.data.rel*) | |
234 | *(.toc1) | |
e8222502 BH |
235 | *(.branch_lt) |
236 | } | |
14cf11af | 237 | |
366234f6 | 238 | .opd : AT(ADDR(.opd) - LOAD_OFFSET) { |
e8222502 BH |
239 | *(.opd) |
240 | } | |
241 | ||
366234f6 | 242 | .got : AT(ADDR(.got) - LOAD_OFFSET) { |
e8222502 BH |
243 | __toc_start = .; |
244 | *(.got) | |
245 | *(.toc) | |
246 | } | |
cabb5587 | 247 | #endif |
14cf11af | 248 | |
e8222502 BH |
249 | . = ALIGN(PAGE_SIZE); |
250 | _edata = .; | |
251 | PROVIDE32 (edata = .); | |
252 | ||
253 | /* The initial task and kernel stack */ | |
254 | #ifdef CONFIG_PPC32 | |
255 | . = ALIGN(8192); | |
cabb5587 | 256 | #else |
e8222502 BH |
257 | . = ALIGN(16384); |
258 | #endif | |
366234f6 | 259 | .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) { |
e8222502 BH |
260 | *(.data.init_task) |
261 | } | |
14cf11af | 262 | |
e8222502 | 263 | . = ALIGN(PAGE_SIZE); |
366234f6 | 264 | .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) { |
e8222502 BH |
265 | *(.data.page_aligned) |
266 | } | |
14cf11af | 267 | |
0e337b42 | 268 | . = ALIGN(L1_CACHE_BYTES); |
366234f6 | 269 | .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) { |
e8222502 BH |
270 | *(.data.cacheline_aligned) |
271 | } | |
14cf11af | 272 | |
bd67fcf9 | 273 | . = ALIGN(L1_CACHE_BYTES); |
366234f6 | 274 | .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) { |
bd67fcf9 TB |
275 | *(.data.read_mostly) |
276 | } | |
277 | ||
e8222502 | 278 | . = ALIGN(PAGE_SIZE); |
366234f6 | 279 | .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { |
e8222502 BH |
280 | __nosave_begin = .; |
281 | *(.data.nosave) | |
282 | . = ALIGN(PAGE_SIZE); | |
283 | __nosave_end = .; | |
284 | } | |
4a288563 | 285 | |
e8222502 BH |
286 | /* |
287 | * And finally the bss | |
288 | */ | |
289 | ||
366234f6 | 290 | .bss : AT(ADDR(.bss) - LOAD_OFFSET) { |
e8222502 BH |
291 | __bss_start = .; |
292 | *(.sbss) *(.scommon) | |
293 | *(.dynbss) | |
294 | *(.bss) | |
295 | *(COMMON) | |
296 | __bss_stop = .; | |
297 | } | |
14cf11af | 298 | |
e8222502 BH |
299 | . = ALIGN(PAGE_SIZE); |
300 | _end = . ; | |
301 | PROVIDE32 (end = .); | |
14cf11af | 302 | } |