]>
Commit | Line | Data |
---|---|---|
5a0015d6 CZ |
1 | /* |
2 | * arch/xtensa/kernel/vmlinux.lds.S | |
3 | * | |
4 | * Xtensa linker script | |
5 | * | |
6 | * This file is subject to the terms and conditions of the GNU General Public | |
7 | * License. See the file "COPYING" in the main directory of this archive | |
8 | * for more details. | |
9 | * | |
10 | * Copyright (C) 2001 - 2005 Tensilica Inc. | |
11 | * | |
12 | * Chris Zankel <chris@zankel.net> | |
13 | * Marc Gauthier <marc@tensilica.com, marc@alumni.uwaterloo.ca> | |
14 | * Joe Taylor <joe@tensilica.com, joetylr@yahoo.com> | |
15 | */ | |
16 | ||
17 | #include <asm-generic/vmlinux.lds.h> | |
18 | ||
173d6681 | 19 | #include <asm/variant/core.h> |
5a0015d6 CZ |
20 | OUTPUT_ARCH(xtensa) |
21 | ENTRY(_start) | |
22 | ||
173d6681 | 23 | #ifdef __XTENSA_EB__ |
5a0015d6 CZ |
24 | jiffies = jiffies_64 + 4; |
25 | #else | |
26 | jiffies = jiffies_64; | |
27 | #endif | |
28 | ||
173d6681 | 29 | #define KERNELOFFSET 0xd0001000 |
5a0015d6 CZ |
30 | |
31 | /* Note: In the following macros, it would be nice to specify only the | |
32 | vector name and section kind and construct "sym" and "section" using | |
33 | CPP concatenation, but that does not work reliably. Concatenating a | |
34 | string with "." produces an invalid token. CPP will not print a | |
35 | warning because it thinks this is an assembly file, but it leaves | |
36 | them as multiple tokens and there may or may not be whitespace | |
37 | between them. */ | |
38 | ||
39 | /* Macro for a relocation entry */ | |
40 | ||
41 | #define RELOCATE_ENTRY(sym, section) \ | |
42 | LONG(sym ## _start); \ | |
43 | LONG(sym ## _end); \ | |
44 | LONG(LOADADDR(section)) | |
45 | ||
46 | /* Macro to define a section for a vector. | |
47 | * | |
48 | * Use of the MIN function catches the types of errors illustrated in | |
49 | * the following example: | |
50 | * | |
51 | * Assume the section .DoubleExceptionVector.literal is completely | |
52 | * full. Then a programmer adds code to .DoubleExceptionVector.text | |
53 | * that produces another literal. The final literal position will | |
54 | * overlay onto the first word of the adjacent code section | |
55 | * .DoubleExceptionVector.text. (In practice, the literals will | |
56 | * overwrite the code, and the first few instructions will be | |
57 | * garbage.) | |
58 | */ | |
59 | ||
60 | #define SECTION_VECTOR(sym, section, addr, max_prevsec_size, prevsec) \ | |
61 | section addr : AT((MIN(LOADADDR(prevsec) + max_prevsec_size, \ | |
62 | LOADADDR(prevsec) + SIZEOF(prevsec)) + 3) & ~ 3) \ | |
63 | { \ | |
64 | . = ALIGN(4); \ | |
65 | sym ## _start = ABSOLUTE(.); \ | |
66 | *(section) \ | |
67 | sym ## _end = ABSOLUTE(.); \ | |
68 | } | |
69 | ||
70 | /* | |
71 | * Mapping of input sections to output sections when linking. | |
72 | */ | |
73 | ||
74 | SECTIONS | |
75 | { | |
173d6681 | 76 | . = KERNELOFFSET; |
5a0015d6 CZ |
77 | /* .text section */ |
78 | ||
79 | _text = .; | |
80 | _stext = .; | |
81 | _ftext = .; | |
82 | ||
83 | .text : | |
84 | { | |
85 | /* The .head.text section must be the first section! */ | |
86 | *(.head.text) | |
de4f6e5b | 87 | *(.literal .text) |
5a0015d6 | 88 | VMLINUX_SYMBOL(__sched_text_start) = .; |
813e6783 | 89 | *(.sched.literal .sched.text) |
5a0015d6 CZ |
90 | VMLINUX_SYMBOL(__sched_text_end) = .; |
91 | VMLINUX_SYMBOL(__lock_text_start) = .; | |
813e6783 | 92 | *(.spinlock.literal .spinlock.text) |
5a0015d6 CZ |
93 | VMLINUX_SYMBOL(__lock_text_end) = .; |
94 | ||
95 | } | |
96 | _etext = .; | |
de4f6e5b | 97 | PROVIDE (etext = .); |
5a0015d6 CZ |
98 | |
99 | . = ALIGN(16); | |
100 | ||
101 | RODATA | |
102 | ||
103 | /* Relocation table */ | |
104 | ||
5a0015d6 CZ |
105 | .fixup : { *(.fixup) } |
106 | ||
107 | . = ALIGN(16); | |
108 | ||
109 | __ex_table : { | |
110 | __start___ex_table = .; | |
111 | *(__ex_table) | |
112 | __stop___ex_table = .; | |
113 | } | |
114 | ||
115 | /* Data section */ | |
116 | ||
117 | . = ALIGN(XCHAL_ICACHE_LINESIZE); | |
118 | _fdata = .; | |
119 | .data : | |
120 | { | |
b8243254 MD |
121 | DATA_DATA |
122 | CONSTRUCTORS | |
5a0015d6 CZ |
123 | . = ALIGN(XCHAL_ICACHE_LINESIZE); |
124 | *(.data.cacheline_aligned) | |
125 | } | |
126 | ||
127 | _edata = .; | |
128 | ||
129 | /* The initial task */ | |
130 | . = ALIGN(8192); | |
131 | .data.init_task : { *(.data.init_task) } | |
132 | ||
133 | /* Initialization code and data: */ | |
134 | ||
173d6681 | 135 | . = ALIGN(1 << 12); |
5a0015d6 CZ |
136 | __init_begin = .; |
137 | .init.text : { | |
138 | _sinittext = .; | |
813e6783 | 139 | *(.init.literal) *(.init.text) |
5a0015d6 CZ |
140 | _einittext = .; |
141 | } | |
142 | ||
143 | .init.data : | |
144 | { | |
145 | *(.init.data) | |
146 | . = ALIGN(0x4); | |
147 | __tagtable_begin = .; | |
148 | *(.taglist) | |
149 | __tagtable_end = .; | |
de4f6e5b CZ |
150 | |
151 | . = ALIGN(16); | |
152 | __boot_reloc_table_start = ABSOLUTE(.); | |
153 | ||
154 | RELOCATE_ENTRY(_WindowVectors_text, | |
155 | .WindowVectors.text); | |
156 | RELOCATE_ENTRY(_KernelExceptionVector_text, | |
157 | .KernelExceptionVector.text); | |
158 | RELOCATE_ENTRY(_UserExceptionVector_text, | |
159 | .UserExceptionVector.text); | |
160 | RELOCATE_ENTRY(_DoubleExceptionVector_literal, | |
161 | .DoubleExceptionVector.literal); | |
162 | RELOCATE_ENTRY(_DoubleExceptionVector_text, | |
163 | .DoubleExceptionVector.text); | |
164 | ||
165 | __boot_reloc_table_end = ABSOLUTE(.) ; | |
5a0015d6 CZ |
166 | } |
167 | ||
168 | . = ALIGN(XCHAL_ICACHE_LINESIZE); | |
169 | ||
170 | __setup_start = .; | |
171 | .init.setup : { *(.init.setup) } | |
172 | __setup_end = .; | |
173 | ||
174 | __initcall_start = .; | |
175 | .initcall.init : { | |
61ce1efe | 176 | INITCALLS |
5a0015d6 CZ |
177 | } |
178 | __initcall_end = .; | |
179 | ||
180 | __con_initcall_start = .; | |
181 | .con_initcall.init : { *(.con_initcall.init) } | |
182 | __con_initcall_end = .; | |
183 | ||
184 | SECURITY_INIT | |
185 | ||
5a0015d6 | 186 | |
67d38229 | 187 | #ifdef CONFIG_BLK_DEV_INITRD |
5a0015d6 CZ |
188 | . = ALIGN(4096); |
189 | __initramfs_start =.; | |
190 | .init.ramfs : { *(.init.ramfs) } | |
191 | __initramfs_end = .; | |
67d38229 | 192 | #endif |
5a0015d6 | 193 | |
5fb7dc37 | 194 | PERCPU(4096) |
de4f6e5b CZ |
195 | |
196 | ||
5a0015d6 CZ |
197 | /* We need this dummy segment here */ |
198 | ||
199 | . = ALIGN(4); | |
200 | .dummy : { LONG(0) } | |
201 | ||
202 | /* The vectors are relocated to the real position at startup time */ | |
203 | ||
204 | SECTION_VECTOR (_WindowVectors_text, | |
205 | .WindowVectors.text, | |
206 | XCHAL_WINDOW_VECTORS_VADDR, 4, | |
207 | .dummy) | |
208 | SECTION_VECTOR (_DebugInterruptVector_literal, | |
209 | .DebugInterruptVector.literal, | |
173d6681 | 210 | XCHAL_DEBUG_VECTOR_VADDR - 4, |
5a0015d6 CZ |
211 | SIZEOF(.WindowVectors.text), |
212 | .WindowVectors.text) | |
213 | SECTION_VECTOR (_DebugInterruptVector_text, | |
214 | .DebugInterruptVector.text, | |
173d6681 | 215 | XCHAL_DEBUG_VECTOR_VADDR, |
5a0015d6 CZ |
216 | 4, |
217 | .DebugInterruptVector.literal) | |
218 | SECTION_VECTOR (_KernelExceptionVector_literal, | |
219 | .KernelExceptionVector.literal, | |
173d6681 | 220 | XCHAL_KERNEL_VECTOR_VADDR - 4, |
5a0015d6 CZ |
221 | SIZEOF(.DebugInterruptVector.text), |
222 | .DebugInterruptVector.text) | |
223 | SECTION_VECTOR (_KernelExceptionVector_text, | |
224 | .KernelExceptionVector.text, | |
173d6681 | 225 | XCHAL_KERNEL_VECTOR_VADDR, |
5a0015d6 CZ |
226 | 4, |
227 | .KernelExceptionVector.literal) | |
228 | SECTION_VECTOR (_UserExceptionVector_literal, | |
229 | .UserExceptionVector.literal, | |
173d6681 | 230 | XCHAL_USER_VECTOR_VADDR - 4, |
5a0015d6 CZ |
231 | SIZEOF(.KernelExceptionVector.text), |
232 | .KernelExceptionVector.text) | |
233 | SECTION_VECTOR (_UserExceptionVector_text, | |
234 | .UserExceptionVector.text, | |
173d6681 | 235 | XCHAL_USER_VECTOR_VADDR, |
5a0015d6 CZ |
236 | 4, |
237 | .UserExceptionVector.literal) | |
238 | SECTION_VECTOR (_DoubleExceptionVector_literal, | |
239 | .DoubleExceptionVector.literal, | |
240 | XCHAL_DOUBLEEXC_VECTOR_VADDR - 16, | |
241 | SIZEOF(.UserExceptionVector.text), | |
242 | .UserExceptionVector.text) | |
243 | SECTION_VECTOR (_DoubleExceptionVector_text, | |
244 | .DoubleExceptionVector.text, | |
245 | XCHAL_DOUBLEEXC_VECTOR_VADDR, | |
246 | 32, | |
247 | .DoubleExceptionVector.literal) | |
248 | ||
249 | . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3; | |
173d6681 | 250 | . = ALIGN(1 << 12); |
5a0015d6 CZ |
251 | |
252 | __init_end = .; | |
253 | ||
254 | . = ALIGN(8192); | |
255 | ||
256 | /* BSS section */ | |
257 | _bss_start = .; | |
de4f6e5b | 258 | .bss : { *(.bss.page_aligned) *(.bss) } |
5a0015d6 | 259 | _bss_end = .; |
de4f6e5b | 260 | |
5a0015d6 CZ |
261 | _end = .; |
262 | ||
263 | /* only used by the boot loader */ | |
264 | ||
265 | . = ALIGN(0x10); | |
266 | .bootstrap : { *(.bootstrap.literal .bootstrap.text .bootstrap.data) } | |
267 | ||
268 | . = ALIGN(0x1000); | |
269 | __initrd_start = .; | |
270 | .initrd : { *(.initrd) } | |
271 | __initrd_end = .; | |
272 | ||
273 | .ResetVector.text XCHAL_RESET_VECTOR_VADDR : | |
274 | { | |
275 | *(.ResetVector.text) | |
276 | } | |
277 | ||
5a0015d6 CZ |
278 | /* Sections to be discarded */ |
279 | /DISCARD/ : | |
280 | { | |
de4f6e5b CZ |
281 | *(.exit.literal .exit.text) |
282 | *(.exit.data) | |
5a0015d6 CZ |
283 | *(.exitcall.exit) |
284 | } | |
285 | ||
de4f6e5b CZ |
286 | .xt.lit : { *(.xt.lit) } |
287 | .xt.prop : { *(.xt.prop) } | |
5a0015d6 CZ |
288 | |
289 | .debug 0 : { *(.debug) } | |
290 | .line 0 : { *(.line) } | |
291 | .debug_srcinfo 0 : { *(.debug_srcinfo) } | |
292 | .debug_sfnames 0 : { *(.debug_sfnames) } | |
293 | .debug_aranges 0 : { *(.debug_aranges) } | |
294 | .debug_pubnames 0 : { *(.debug_pubnames) } | |
295 | .debug_info 0 : { *(.debug_info) } | |
296 | .debug_abbrev 0 : { *(.debug_abbrev) } | |
297 | .debug_line 0 : { *(.debug_line) } | |
298 | .debug_frame 0 : { *(.debug_frame) } | |
299 | .debug_str 0 : { *(.debug_str) } | |
300 | .debug_loc 0 : { *(.debug_loc) } | |
301 | .debug_macinfo 0 : { *(.debug_macinfo) } | |
302 | .debug_weaknames 0 : { *(.debug_weaknames) } | |
303 | .debug_funcnames 0 : { *(.debug_funcnames) } | |
304 | .debug_typenames 0 : { *(.debug_typenames) } | |
305 | .debug_varnames 0 : { *(.debug_varnames) } | |
306 | ||
307 | .xt.insn 0 : | |
308 | { | |
309 | *(.xt.insn) | |
310 | *(.gnu.linkonce.x*) | |
311 | } | |
312 | ||
313 | .xt.lit 0 : | |
314 | { | |
315 | *(.xt.lit) | |
316 | *(.gnu.linkonce.p*) | |
317 | } | |
318 | } |