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) }
153 RW_DATA_SECTION(XCHAL_ICACHE_LINESIZE, PAGE_SIZE, THREAD_SIZE)
156 /* Initialization code and data: */
158 . = ALIGN(PAGE_SIZE);
160 INIT_TEXT_SECTION(PAGE_SIZE)
166 __tagtable_begin = .;
171 __boot_reloc_table_start = ABSOLUTE(.);
173 #ifdef CONFIG_VECTORS_OFFSET
174 RELOCATE_ENTRY(_WindowVectors_text,
175 .WindowVectors.text);
176 #if XCHAL_EXCM_LEVEL >= 2
177 RELOCATE_ENTRY(_Level2InterruptVector_text,
178 .Level2InterruptVector.text);
180 #if XCHAL_EXCM_LEVEL >= 3
181 RELOCATE_ENTRY(_Level3InterruptVector_text,
182 .Level3InterruptVector.text);
184 #if XCHAL_EXCM_LEVEL >= 4
185 RELOCATE_ENTRY(_Level4InterruptVector_text,
186 .Level4InterruptVector.text);
188 #if XCHAL_EXCM_LEVEL >= 5
189 RELOCATE_ENTRY(_Level5InterruptVector_text,
190 .Level5InterruptVector.text);
192 #if XCHAL_EXCM_LEVEL >= 6
193 RELOCATE_ENTRY(_Level6InterruptVector_text,
194 .Level6InterruptVector.text);
196 RELOCATE_ENTRY(_KernelExceptionVector_text,
197 .KernelExceptionVector.text);
198 RELOCATE_ENTRY(_UserExceptionVector_text,
199 .UserExceptionVector.text);
200 RELOCATE_ENTRY(_DoubleExceptionVector_literal,
201 .DoubleExceptionVector.literal);
202 RELOCATE_ENTRY(_DoubleExceptionVector_text,
203 .DoubleExceptionVector.text);
204 RELOCATE_ENTRY(_DebugInterruptVector_text,
205 .DebugInterruptVector.text);
207 #if defined(CONFIG_SMP)
208 RELOCATE_ENTRY(_SecondaryResetVector_text,
209 .SecondaryResetVector.text);
213 __boot_reloc_table_end = ABSOLUTE(.) ;
215 INIT_SETUP(XCHAL_ICACHE_LINESIZE)
222 PERCPU_SECTION(XCHAL_ICACHE_LINESIZE)
224 /* We need this dummy segment here */
229 #ifdef CONFIG_VECTORS_OFFSET
230 /* The vectors are relocated to the real position at startup time */
232 SECTION_VECTOR (_WindowVectors_text,
234 WINDOW_VECTORS_VADDR, 4,
236 SECTION_VECTOR (_DebugInterruptVector_literal,
237 .DebugInterruptVector.literal,
238 DEBUG_VECTOR_VADDR - 4,
239 SIZEOF(.WindowVectors.text),
241 SECTION_VECTOR (_DebugInterruptVector_text,
242 .DebugInterruptVector.text,
245 .DebugInterruptVector.literal)
247 #define LAST .DebugInterruptVector.text
248 #if XCHAL_EXCM_LEVEL >= 2
249 SECTION_VECTOR (_Level2InterruptVector_text,
250 .Level2InterruptVector.text,
251 INTLEVEL2_VECTOR_VADDR,
254 # define LAST .Level2InterruptVector.text
256 #if XCHAL_EXCM_LEVEL >= 3
257 SECTION_VECTOR (_Level3InterruptVector_text,
258 .Level3InterruptVector.text,
259 INTLEVEL3_VECTOR_VADDR,
262 # define LAST .Level3InterruptVector.text
264 #if XCHAL_EXCM_LEVEL >= 4
265 SECTION_VECTOR (_Level4InterruptVector_text,
266 .Level4InterruptVector.text,
267 INTLEVEL4_VECTOR_VADDR,
270 # define LAST .Level4InterruptVector.text
272 #if XCHAL_EXCM_LEVEL >= 5
273 SECTION_VECTOR (_Level5InterruptVector_text,
274 .Level5InterruptVector.text,
275 INTLEVEL5_VECTOR_VADDR,
278 # define LAST .Level5InterruptVector.text
280 #if XCHAL_EXCM_LEVEL >= 6
281 SECTION_VECTOR (_Level6InterruptVector_text,
282 .Level6InterruptVector.text,
283 INTLEVEL6_VECTOR_VADDR,
286 # define LAST .Level6InterruptVector.text
288 SECTION_VECTOR (_KernelExceptionVector_literal,
289 .KernelExceptionVector.literal,
290 KERNEL_VECTOR_VADDR - 4,
293 SECTION_VECTOR (_KernelExceptionVector_text,
294 .KernelExceptionVector.text,
297 .KernelExceptionVector.literal)
298 SECTION_VECTOR (_UserExceptionVector_literal,
299 .UserExceptionVector.literal,
300 USER_VECTOR_VADDR - 4,
301 SIZEOF(.KernelExceptionVector.text),
302 .KernelExceptionVector.text)
303 SECTION_VECTOR (_UserExceptionVector_text,
304 .UserExceptionVector.text,
307 .UserExceptionVector.literal)
308 SECTION_VECTOR (_DoubleExceptionVector_literal,
309 .DoubleExceptionVector.literal,
310 DOUBLEEXC_VECTOR_VADDR - 20,
311 SIZEOF(.UserExceptionVector.text),
312 .UserExceptionVector.text)
313 SECTION_VECTOR (_DoubleExceptionVector_text,
314 .DoubleExceptionVector.text,
315 DOUBLEEXC_VECTOR_VADDR,
317 .DoubleExceptionVector.literal)
319 . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3;
322 #if defined(CONFIG_SMP)
324 SECTION_VECTOR (_SecondaryResetVector_text,
325 .SecondaryResetVector.text,
327 SIZEOF(.DoubleExceptionVector.text),
328 .DoubleExceptionVector.text)
330 . = LOADADDR(.SecondaryResetVector.text)+SIZEOF(.SecondaryResetVector.text);
334 . = ALIGN(PAGE_SIZE);
338 BSS_SECTION(0, 8192, 0)
342 .xt.lit : { *(.xt.lit) }
343 .xt.prop : { *(.xt.prop) }
345 .debug 0 : { *(.debug) }
346 .line 0 : { *(.line) }
347 .debug_srcinfo 0 : { *(.debug_srcinfo) }
348 .debug_sfnames 0 : { *(.debug_sfnames) }
349 .debug_aranges 0 : { *(.debug_aranges) }
350 .debug_pubnames 0 : { *(.debug_pubnames) }
351 .debug_info 0 : { *(.debug_info) }
352 .debug_abbrev 0 : { *(.debug_abbrev) }
353 .debug_line 0 : { *(.debug_line) }
354 .debug_frame 0 : { *(.debug_frame) }
355 .debug_str 0 : { *(.debug_str) }
356 .debug_loc 0 : { *(.debug_loc) }
357 .debug_macinfo 0 : { *(.debug_macinfo) }
358 .debug_weaknames 0 : { *(.debug_weaknames) }
359 .debug_funcnames 0 : { *(.debug_funcnames) }
360 .debug_typenames 0 : { *(.debug_typenames) }
361 .debug_varnames 0 : { *(.debug_varnames) }
375 /* Sections to be discarded */
377 /DISCARD/ : { *(.exit.literal) }