2 * arch/xtensa/kernel/vmlinux.lds.S
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
10 * Copyright (C) 2001 - 2008 Tensilica Inc.
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>
17 #include <asm-generic/vmlinux.lds.h>
19 #include <asm/thread_info.h>
21 #include <asm/vectors.h>
22 #include <variant/core.h>
23 #include <platform/hardware.h>
28 jiffies = jiffies_64 + 4;
33 /* Note: In the following macros, it would be nice to specify only the
34 vector name and section kind and construct "sym" and "section" using
35 CPP concatenation, but that does not work reliably. Concatenating a
36 string with "." produces an invalid token. CPP will not print a
37 warning because it thinks this is an assembly file, but it leaves
38 them as multiple tokens and there may or may not be whitespace
41 /* Macro for a relocation entry */
43 #define RELOCATE_ENTRY(sym, section) \
44 LONG(sym ## _start); \
46 LONG(LOADADDR(section))
48 /* Macro to define a section for a vector.
50 * Use of the MIN function catches the types of errors illustrated in
51 * the following example:
53 * Assume the section .DoubleExceptionVector.literal is completely
54 * full. Then a programmer adds code to .DoubleExceptionVector.text
55 * that produces another literal. The final literal position will
56 * overlay onto the first word of the adjacent code section
57 * .DoubleExceptionVector.text. (In practice, the literals will
58 * overwrite the code, and the first few instructions will be
62 #ifdef CONFIG_VECTORS_OFFSET
63 #define SECTION_VECTOR(sym, section, addr, max_prevsec_size, prevsec) \
64 section addr : AT((MIN(LOADADDR(prevsec) + max_prevsec_size, \
65 LOADADDR(prevsec) + SIZEOF(prevsec)) + 3) & ~ 3) \
68 sym ## _start = ABSOLUTE(.); \
70 sym ## _end = ABSOLUTE(.); \
73 #define SECTION_VECTOR(section, addr) \
79 * Mapping of input sections to output sections when linking.
92 /* The HEAD_TEXT section must be the first section! */
95 #ifndef CONFIG_VECTORS_OFFSET
99 SECTION_VECTOR (.WindowVectors.text, WINDOW_VECTORS_VADDR)
100 #if XCHAL_EXCM_LEVEL >= 2
101 SECTION_VECTOR (.Level2InterruptVector.text, INTLEVEL2_VECTOR_VADDR)
103 #if XCHAL_EXCM_LEVEL >= 3
104 SECTION_VECTOR (.Level3InterruptVector.text, INTLEVEL3_VECTOR_VADDR)
106 #if XCHAL_EXCM_LEVEL >= 4
107 SECTION_VECTOR (.Level4InterruptVector.text, INTLEVEL4_VECTOR_VADDR)
109 #if XCHAL_EXCM_LEVEL >= 5
110 SECTION_VECTOR (.Level5InterruptVector.text, INTLEVEL5_VECTOR_VADDR)
112 #if XCHAL_EXCM_LEVEL >= 6
113 SECTION_VECTOR (.Level6InterruptVector.text, INTLEVEL6_VECTOR_VADDR)
115 SECTION_VECTOR (.DebugInterruptVector.literal, DEBUG_VECTOR_VADDR - 4)
116 SECTION_VECTOR (.DebugInterruptVector.text, DEBUG_VECTOR_VADDR)
117 SECTION_VECTOR (.KernelExceptionVector.literal, KERNEL_VECTOR_VADDR - 4)
118 SECTION_VECTOR (.KernelExceptionVector.text, KERNEL_VECTOR_VADDR)
119 SECTION_VECTOR (.UserExceptionVector.literal, USER_VECTOR_VADDR - 4)
120 SECTION_VECTOR (.UserExceptionVector.text, USER_VECTOR_VADDR)
121 SECTION_VECTOR (.DoubleExceptionVector.literal, DOUBLEEXC_VECTOR_VADDR - 20)
122 SECTION_VECTOR (.DoubleExceptionVector.text, DOUBLEEXC_VECTOR_VADDR)
126 VMLINUX_SYMBOL(__sched_text_start) = .;
127 *(.sched.literal .sched.text)
128 VMLINUX_SYMBOL(__sched_text_end) = .;
129 VMLINUX_SYMBOL(__cpuidle_text_start) = .;
130 *(.cpuidle.literal .cpuidle.text)
131 VMLINUX_SYMBOL(__cpuidle_text_end) = .;
132 VMLINUX_SYMBOL(__lock_text_start) = .;
133 *(.spinlock.literal .spinlock.text)
134 VMLINUX_SYMBOL(__lock_text_end) = .;
144 /* Relocation table */
146 .fixup : { *(.fixup) }
152 RW_DATA_SECTION(XCHAL_ICACHE_LINESIZE, PAGE_SIZE, THREAD_SIZE)
155 /* Initialization code and data: */
157 . = ALIGN(PAGE_SIZE);
159 INIT_TEXT_SECTION(PAGE_SIZE)
165 __tagtable_begin = .;
170 __boot_reloc_table_start = ABSOLUTE(.);
172 #ifdef CONFIG_VECTORS_OFFSET
173 RELOCATE_ENTRY(_WindowVectors_text,
174 .WindowVectors.text);
175 #if XCHAL_EXCM_LEVEL >= 2
176 RELOCATE_ENTRY(_Level2InterruptVector_text,
177 .Level2InterruptVector.text);
179 #if XCHAL_EXCM_LEVEL >= 3
180 RELOCATE_ENTRY(_Level3InterruptVector_text,
181 .Level3InterruptVector.text);
183 #if XCHAL_EXCM_LEVEL >= 4
184 RELOCATE_ENTRY(_Level4InterruptVector_text,
185 .Level4InterruptVector.text);
187 #if XCHAL_EXCM_LEVEL >= 5
188 RELOCATE_ENTRY(_Level5InterruptVector_text,
189 .Level5InterruptVector.text);
191 #if XCHAL_EXCM_LEVEL >= 6
192 RELOCATE_ENTRY(_Level6InterruptVector_text,
193 .Level6InterruptVector.text);
195 RELOCATE_ENTRY(_KernelExceptionVector_text,
196 .KernelExceptionVector.text);
197 RELOCATE_ENTRY(_UserExceptionVector_text,
198 .UserExceptionVector.text);
199 RELOCATE_ENTRY(_DoubleExceptionVector_literal,
200 .DoubleExceptionVector.literal);
201 RELOCATE_ENTRY(_DoubleExceptionVector_text,
202 .DoubleExceptionVector.text);
203 RELOCATE_ENTRY(_DebugInterruptVector_text,
204 .DebugInterruptVector.text);
206 #if defined(CONFIG_SMP)
207 RELOCATE_ENTRY(_SecondaryResetVector_text,
208 .SecondaryResetVector.text);
212 __boot_reloc_table_end = ABSOLUTE(.) ;
214 INIT_SETUP(XCHAL_ICACHE_LINESIZE)
221 PERCPU_SECTION(XCHAL_ICACHE_LINESIZE)
223 /* We need this dummy segment here */
228 #ifdef CONFIG_VECTORS_OFFSET
229 /* The vectors are relocated to the real position at startup time */
231 SECTION_VECTOR (_WindowVectors_text,
233 WINDOW_VECTORS_VADDR, 4,
235 SECTION_VECTOR (_DebugInterruptVector_literal,
236 .DebugInterruptVector.literal,
237 DEBUG_VECTOR_VADDR - 4,
238 SIZEOF(.WindowVectors.text),
240 SECTION_VECTOR (_DebugInterruptVector_text,
241 .DebugInterruptVector.text,
244 .DebugInterruptVector.literal)
246 #define LAST .DebugInterruptVector.text
247 #if XCHAL_EXCM_LEVEL >= 2
248 SECTION_VECTOR (_Level2InterruptVector_text,
249 .Level2InterruptVector.text,
250 INTLEVEL2_VECTOR_VADDR,
253 # define LAST .Level2InterruptVector.text
255 #if XCHAL_EXCM_LEVEL >= 3
256 SECTION_VECTOR (_Level3InterruptVector_text,
257 .Level3InterruptVector.text,
258 INTLEVEL3_VECTOR_VADDR,
261 # define LAST .Level3InterruptVector.text
263 #if XCHAL_EXCM_LEVEL >= 4
264 SECTION_VECTOR (_Level4InterruptVector_text,
265 .Level4InterruptVector.text,
266 INTLEVEL4_VECTOR_VADDR,
269 # define LAST .Level4InterruptVector.text
271 #if XCHAL_EXCM_LEVEL >= 5
272 SECTION_VECTOR (_Level5InterruptVector_text,
273 .Level5InterruptVector.text,
274 INTLEVEL5_VECTOR_VADDR,
277 # define LAST .Level5InterruptVector.text
279 #if XCHAL_EXCM_LEVEL >= 6
280 SECTION_VECTOR (_Level6InterruptVector_text,
281 .Level6InterruptVector.text,
282 INTLEVEL6_VECTOR_VADDR,
285 # define LAST .Level6InterruptVector.text
287 SECTION_VECTOR (_KernelExceptionVector_literal,
288 .KernelExceptionVector.literal,
289 KERNEL_VECTOR_VADDR - 4,
292 SECTION_VECTOR (_KernelExceptionVector_text,
293 .KernelExceptionVector.text,
296 .KernelExceptionVector.literal)
297 SECTION_VECTOR (_UserExceptionVector_literal,
298 .UserExceptionVector.literal,
299 USER_VECTOR_VADDR - 4,
300 SIZEOF(.KernelExceptionVector.text),
301 .KernelExceptionVector.text)
302 SECTION_VECTOR (_UserExceptionVector_text,
303 .UserExceptionVector.text,
306 .UserExceptionVector.literal)
307 SECTION_VECTOR (_DoubleExceptionVector_literal,
308 .DoubleExceptionVector.literal,
309 DOUBLEEXC_VECTOR_VADDR - 20,
310 SIZEOF(.UserExceptionVector.text),
311 .UserExceptionVector.text)
312 SECTION_VECTOR (_DoubleExceptionVector_text,
313 .DoubleExceptionVector.text,
314 DOUBLEEXC_VECTOR_VADDR,
316 .DoubleExceptionVector.literal)
318 . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3;
321 #if defined(CONFIG_SMP)
323 SECTION_VECTOR (_SecondaryResetVector_text,
324 .SecondaryResetVector.text,
326 SIZEOF(.DoubleExceptionVector.text),
327 .DoubleExceptionVector.text)
329 . = LOADADDR(.SecondaryResetVector.text)+SIZEOF(.SecondaryResetVector.text);
333 . = ALIGN(PAGE_SIZE);
337 BSS_SECTION(0, 8192, 0)
341 .xt.lit : { *(.xt.lit) }
342 .xt.prop : { *(.xt.prop) }
344 .debug 0 : { *(.debug) }
345 .line 0 : { *(.line) }
346 .debug_srcinfo 0 : { *(.debug_srcinfo) }
347 .debug_sfnames 0 : { *(.debug_sfnames) }
348 .debug_aranges 0 : { *(.debug_aranges) }
349 .debug_pubnames 0 : { *(.debug_pubnames) }
350 .debug_info 0 : { *(.debug_info) }
351 .debug_abbrev 0 : { *(.debug_abbrev) }
352 .debug_line 0 : { *(.debug_line) }
353 .debug_frame 0 : { *(.debug_frame) }
354 .debug_str 0 : { *(.debug_str) }
355 .debug_loc 0 : { *(.debug_loc) }
356 .debug_macinfo 0 : { *(.debug_macinfo) }
357 .debug_weaknames 0 : { *(.debug_weaknames) }
358 .debug_funcnames 0 : { *(.debug_funcnames) }
359 .debug_typenames 0 : { *(.debug_typenames) }
360 .debug_varnames 0 : { *(.debug_varnames) }
374 /* Sections to be discarded */
376 /DISCARD/ : { *(.exit.literal) }