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 #define RO_EXCEPTION_TABLE_ALIGN 16
19 #include <asm-generic/vmlinux.lds.h>
21 #include <asm/thread_info.h>
24 #include <asm/vectors.h>
30 jiffies = jiffies_64 + 4;
35 /* Note: In the following macros, it would be nice to specify only the
36 vector name and section kind and construct "sym" and "section" using
37 CPP concatenation, but that does not work reliably. Concatenating a
38 string with "." produces an invalid token. CPP will not print a
39 warning because it thinks this is an assembly file, but it leaves
40 them as multiple tokens and there may or may not be whitespace
43 /* Macro for a relocation entry */
45 #define RELOCATE_ENTRY(sym, section) \
46 LONG(sym ## _start); \
48 LONG(LOADADDR(section))
50 #if !defined(CONFIG_VECTORS_ADDR) && XCHAL_HAVE_VECBASE
51 #define MERGED_VECTORS 1
53 #define MERGED_VECTORS 0
57 * Macro to define a section for a vector. When MERGED_VECTORS is 0
58 * code for every vector is located with other init data. At startup
59 * time head.S copies code for every vector to its final position according
60 * to description recorded in the corresponding RELOCATE_ENTRY.
63 #define SECTION_VECTOR4(sym, section, addr, prevsec) \
64 section addr : AT(((LOADADDR(prevsec) + SIZEOF(prevsec)) + 3) & ~ 3) \
67 sym ## _start = ABSOLUTE(.); \
69 sym ## _end = ABSOLUTE(.); \
72 #define SECTION_VECTOR2(section, addr) \
77 * Mapping of input sections to output sections when linking.
90 /* The HEAD_TEXT section must be the first section! */
97 #ifdef SUPPORT_WINDOWED
98 SECTION_VECTOR2 (.WindowVectors.text, WINDOW_VECTORS_VADDR)
100 #if XCHAL_EXCM_LEVEL >= 2
101 SECTION_VECTOR2 (.Level2InterruptVector.text, INTLEVEL2_VECTOR_VADDR)
103 #if XCHAL_EXCM_LEVEL >= 3
104 SECTION_VECTOR2 (.Level3InterruptVector.text, INTLEVEL3_VECTOR_VADDR)
106 #if XCHAL_EXCM_LEVEL >= 4
107 SECTION_VECTOR2 (.Level4InterruptVector.text, INTLEVEL4_VECTOR_VADDR)
109 #if XCHAL_EXCM_LEVEL >= 5
110 SECTION_VECTOR2 (.Level5InterruptVector.text, INTLEVEL5_VECTOR_VADDR)
112 #if XCHAL_EXCM_LEVEL >= 6
113 SECTION_VECTOR2 (.Level6InterruptVector.text, INTLEVEL6_VECTOR_VADDR)
115 SECTION_VECTOR2 (.DebugInterruptVector.text, DEBUG_VECTOR_VADDR)
116 SECTION_VECTOR2 (.KernelExceptionVector.text, KERNEL_VECTOR_VADDR)
117 SECTION_VECTOR2 (.UserExceptionVector.text, USER_VECTOR_VADDR)
118 SECTION_VECTOR2 (.DoubleExceptionVector.text, DOUBLEEXC_VECTOR_VADDR)
141 #ifdef CONFIG_XIP_KERNEL
142 INIT_TEXT_SECTION(PAGE_SIZE)
145 RW_DATA(XCHAL_ICACHE_LINESIZE, PAGE_SIZE, THREAD_SIZE)
148 /* Initialization code and data: */
150 . = ALIGN(PAGE_SIZE);
152 INIT_TEXT_SECTION(PAGE_SIZE)
163 __tagtable_begin = .;
168 __boot_reloc_table_start = ABSOLUTE(.);
171 #ifdef SUPPORT_WINDOWED
172 RELOCATE_ENTRY(_WindowVectors_text,
173 .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_text,
200 .DoubleExceptionVector.text);
201 RELOCATE_ENTRY(_DebugInterruptVector_text,
202 .DebugInterruptVector.text);
203 RELOCATE_ENTRY(_exception_text,
206 #ifdef CONFIG_XIP_KERNEL
207 RELOCATE_ENTRY(_xip_data, .data);
208 RELOCATE_ENTRY(_xip_init_data, .init.data);
210 #if defined(CONFIG_SECONDARY_RESET_VECTOR)
211 RELOCATE_ENTRY(_SecondaryResetVector_text,
212 .SecondaryResetVector.text);
215 __boot_reloc_table_end = ABSOLUTE(.) ;
217 INIT_SETUP(XCHAL_ICACHE_LINESIZE)
223 PERCPU_SECTION(XCHAL_ICACHE_LINESIZE)
225 /* We need this dummy segment here */
234 /* The vectors are relocated to the real position at startup time */
236 #ifdef SUPPORT_WINDOWED
237 SECTION_VECTOR4 (_WindowVectors_text,
239 WINDOW_VECTORS_VADDR,
242 #define LAST .WindowVectors.text
244 SECTION_VECTOR4 (_DebugInterruptVector_text,
245 .DebugInterruptVector.text,
249 #define LAST .DebugInterruptVector.text
250 #if XCHAL_EXCM_LEVEL >= 2
251 SECTION_VECTOR4 (_Level2InterruptVector_text,
252 .Level2InterruptVector.text,
253 INTLEVEL2_VECTOR_VADDR,
256 # define LAST .Level2InterruptVector.text
258 #if XCHAL_EXCM_LEVEL >= 3
259 SECTION_VECTOR4 (_Level3InterruptVector_text,
260 .Level3InterruptVector.text,
261 INTLEVEL3_VECTOR_VADDR,
264 # define LAST .Level3InterruptVector.text
266 #if XCHAL_EXCM_LEVEL >= 4
267 SECTION_VECTOR4 (_Level4InterruptVector_text,
268 .Level4InterruptVector.text,
269 INTLEVEL4_VECTOR_VADDR,
272 # define LAST .Level4InterruptVector.text
274 #if XCHAL_EXCM_LEVEL >= 5
275 SECTION_VECTOR4 (_Level5InterruptVector_text,
276 .Level5InterruptVector.text,
277 INTLEVEL5_VECTOR_VADDR,
280 # define LAST .Level5InterruptVector.text
282 #if XCHAL_EXCM_LEVEL >= 6
283 SECTION_VECTOR4 (_Level6InterruptVector_text,
284 .Level6InterruptVector.text,
285 INTLEVEL6_VECTOR_VADDR,
288 # define LAST .Level6InterruptVector.text
290 SECTION_VECTOR4 (_KernelExceptionVector_text,
291 .KernelExceptionVector.text,
295 SECTION_VECTOR4 (_UserExceptionVector_text,
296 .UserExceptionVector.text,
298 .KernelExceptionVector.text)
299 SECTION_VECTOR4 (_DoubleExceptionVector_text,
300 .DoubleExceptionVector.text,
301 DOUBLEEXC_VECTOR_VADDR,
302 .UserExceptionVector.text)
303 #define LAST .DoubleExceptionVector.text
306 #if defined(CONFIG_SECONDARY_RESET_VECTOR)
308 SECTION_VECTOR4 (_SecondaryResetVector_text,
309 .SecondaryResetVector.text,
313 #define LAST .SecondaryResetVector.text
317 SECTION_VECTOR4 (_exception_text,
322 #define LAST .exception.text
325 . = (LOADADDR(LAST) + SIZEOF(LAST) + 3) & ~ 3;
327 .dummy1 : AT(ADDR(.dummy1)) { LONG(0) }
328 . = ALIGN(PAGE_SIZE);
330 #ifndef CONFIG_XIP_KERNEL
333 BSS_SECTION(0, 8192, 0)
338 #ifdef CONFIG_XIP_KERNEL
339 . = CONFIG_XIP_DATA_ADDR;
344 #define LOAD_OFFSET \
345 (CONFIG_XIP_DATA_ADDR - (LOADADDR(.dummy1) + SIZEOF(.dummy1) + 3) & ~ 3)
349 RW_DATA(XCHAL_ICACHE_LINESIZE, PAGE_SIZE, THREAD_SIZE)
353 /* Initialization data: */
357 _xip_init_data_start = .;
363 _xip_init_data_end = .;
365 BSS_SECTION(0, 8192, 0)
374 .xt.prop 0 : { KEEP(*(.xt.prop .xt.prop.* .gnu.linkonce.prop.*)) }
375 .xt.insn 0 : { KEEP(*(.xt.insn .xt.insn.* .gnu.linkonce.x*)) }
376 .xt.lit 0 : { KEEP(*(.xt.lit .xt.lit.* .gnu.linkonce.p*)) }
378 /* Sections to be discarded */