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,
205 #ifdef CONFIG_XIP_KERNEL
206 RELOCATE_ENTRY(_xip_text, .xiptext);
209 #ifdef CONFIG_XIP_KERNEL
210 RELOCATE_ENTRY(_xip_data, .data);
211 RELOCATE_ENTRY(_xip_init_data, .init.data);
213 #if defined(CONFIG_SECONDARY_RESET_VECTOR)
214 RELOCATE_ENTRY(_SecondaryResetVector_text,
215 .SecondaryResetVector.text);
218 __boot_reloc_table_end = ABSOLUTE(.) ;
220 INIT_SETUP(XCHAL_ICACHE_LINESIZE)
226 PERCPU_SECTION(XCHAL_ICACHE_LINESIZE)
228 /* We need this dummy segment here */
237 /* The vectors are relocated to the real position at startup time */
239 #ifdef SUPPORT_WINDOWED
240 SECTION_VECTOR4 (_WindowVectors_text,
242 WINDOW_VECTORS_VADDR,
245 #define LAST .WindowVectors.text
247 SECTION_VECTOR4 (_DebugInterruptVector_text,
248 .DebugInterruptVector.text,
252 #define LAST .DebugInterruptVector.text
253 #if XCHAL_EXCM_LEVEL >= 2
254 SECTION_VECTOR4 (_Level2InterruptVector_text,
255 .Level2InterruptVector.text,
256 INTLEVEL2_VECTOR_VADDR,
259 # define LAST .Level2InterruptVector.text
261 #if XCHAL_EXCM_LEVEL >= 3
262 SECTION_VECTOR4 (_Level3InterruptVector_text,
263 .Level3InterruptVector.text,
264 INTLEVEL3_VECTOR_VADDR,
267 # define LAST .Level3InterruptVector.text
269 #if XCHAL_EXCM_LEVEL >= 4
270 SECTION_VECTOR4 (_Level4InterruptVector_text,
271 .Level4InterruptVector.text,
272 INTLEVEL4_VECTOR_VADDR,
275 # define LAST .Level4InterruptVector.text
277 #if XCHAL_EXCM_LEVEL >= 5
278 SECTION_VECTOR4 (_Level5InterruptVector_text,
279 .Level5InterruptVector.text,
280 INTLEVEL5_VECTOR_VADDR,
283 # define LAST .Level5InterruptVector.text
285 #if XCHAL_EXCM_LEVEL >= 6
286 SECTION_VECTOR4 (_Level6InterruptVector_text,
287 .Level6InterruptVector.text,
288 INTLEVEL6_VECTOR_VADDR,
291 # define LAST .Level6InterruptVector.text
293 SECTION_VECTOR4 (_KernelExceptionVector_text,
294 .KernelExceptionVector.text,
298 SECTION_VECTOR4 (_UserExceptionVector_text,
299 .UserExceptionVector.text,
301 .KernelExceptionVector.text)
302 SECTION_VECTOR4 (_DoubleExceptionVector_text,
303 .DoubleExceptionVector.text,
304 DOUBLEEXC_VECTOR_VADDR,
305 .UserExceptionVector.text)
306 #define LAST .DoubleExceptionVector.text
309 #if defined(CONFIG_SECONDARY_RESET_VECTOR)
311 SECTION_VECTOR4 (_SecondaryResetVector_text,
312 .SecondaryResetVector.text,
316 #define LAST .SecondaryResetVector.text
320 SECTION_VECTOR4 (_exception_text,
325 #define LAST .exception.text
326 SECTION_VECTOR4 (_xip_text,
331 #define LAST .xiptext
333 . = (LOADADDR(LAST) + SIZEOF(LAST) + 3) & ~ 3;
335 .dummy1 : AT(ADDR(.dummy1)) { LONG(0) }
336 . = ALIGN(PAGE_SIZE);
338 #ifndef CONFIG_XIP_KERNEL
341 BSS_SECTION(0, 8192, 0)
346 #ifdef CONFIG_XIP_KERNEL
347 . = CONFIG_XIP_DATA_ADDR;
352 #define LOAD_OFFSET \
353 (CONFIG_XIP_DATA_ADDR - (LOADADDR(.dummy1) + SIZEOF(.dummy1) + 3) & ~ 3)
357 RW_DATA(XCHAL_ICACHE_LINESIZE, PAGE_SIZE, THREAD_SIZE)
361 /* Initialization data: */
365 _xip_init_data_start = .;
371 _xip_init_data_end = .;
373 BSS_SECTION(0, 8192, 0)
382 .xt.prop 0 : { KEEP(*(.xt.prop .xt.prop.* .gnu.linkonce.prop.*)) }
383 .xt.insn 0 : { KEEP(*(.xt.insn .xt.insn.* .gnu.linkonce.x*)) }
384 .xt.lit 0 : { KEEP(*(.xt.lit .xt.lit.* .gnu.linkonce.p*)) }
386 /* Sections to be discarded */