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.
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)
140 #ifdef CONFIG_XIP_KERNEL
141 INIT_TEXT_SECTION(PAGE_SIZE)
144 RW_DATA(XCHAL_ICACHE_LINESIZE, PAGE_SIZE, THREAD_SIZE)
147 /* Initialization code and data: */
149 . = ALIGN(PAGE_SIZE);
151 INIT_TEXT_SECTION(PAGE_SIZE)
162 __tagtable_begin = .;
167 __boot_reloc_table_start = ABSOLUTE(.);
170 #ifdef SUPPORT_WINDOWED
171 RELOCATE_ENTRY(_WindowVectors_text,
172 .WindowVectors.text);
174 #if XCHAL_EXCM_LEVEL >= 2
175 RELOCATE_ENTRY(_Level2InterruptVector_text,
176 .Level2InterruptVector.text);
178 #if XCHAL_EXCM_LEVEL >= 3
179 RELOCATE_ENTRY(_Level3InterruptVector_text,
180 .Level3InterruptVector.text);
182 #if XCHAL_EXCM_LEVEL >= 4
183 RELOCATE_ENTRY(_Level4InterruptVector_text,
184 .Level4InterruptVector.text);
186 #if XCHAL_EXCM_LEVEL >= 5
187 RELOCATE_ENTRY(_Level5InterruptVector_text,
188 .Level5InterruptVector.text);
190 #if XCHAL_EXCM_LEVEL >= 6
191 RELOCATE_ENTRY(_Level6InterruptVector_text,
192 .Level6InterruptVector.text);
194 RELOCATE_ENTRY(_KernelExceptionVector_text,
195 .KernelExceptionVector.text);
196 RELOCATE_ENTRY(_UserExceptionVector_text,
197 .UserExceptionVector.text);
198 RELOCATE_ENTRY(_DoubleExceptionVector_text,
199 .DoubleExceptionVector.text);
200 RELOCATE_ENTRY(_DebugInterruptVector_text,
201 .DebugInterruptVector.text);
202 RELOCATE_ENTRY(_exception_text,
205 #ifdef CONFIG_XIP_KERNEL
206 RELOCATE_ENTRY(_xip_data, .data);
207 RELOCATE_ENTRY(_xip_init_data, .init.data);
209 #if defined(CONFIG_SECONDARY_RESET_VECTOR)
210 RELOCATE_ENTRY(_SecondaryResetVector_text,
211 .SecondaryResetVector.text);
214 __boot_reloc_table_end = ABSOLUTE(.) ;
216 INIT_SETUP(XCHAL_ICACHE_LINESIZE)
222 PERCPU_SECTION(XCHAL_ICACHE_LINESIZE)
224 /* We need this dummy segment here */
233 /* The vectors are relocated to the real position at startup time */
235 #ifdef SUPPORT_WINDOWED
236 SECTION_VECTOR4 (_WindowVectors_text,
238 WINDOW_VECTORS_VADDR,
241 #define LAST .WindowVectors.text
243 SECTION_VECTOR4 (_DebugInterruptVector_text,
244 .DebugInterruptVector.text,
248 #define LAST .DebugInterruptVector.text
249 #if XCHAL_EXCM_LEVEL >= 2
250 SECTION_VECTOR4 (_Level2InterruptVector_text,
251 .Level2InterruptVector.text,
252 INTLEVEL2_VECTOR_VADDR,
255 # define LAST .Level2InterruptVector.text
257 #if XCHAL_EXCM_LEVEL >= 3
258 SECTION_VECTOR4 (_Level3InterruptVector_text,
259 .Level3InterruptVector.text,
260 INTLEVEL3_VECTOR_VADDR,
263 # define LAST .Level3InterruptVector.text
265 #if XCHAL_EXCM_LEVEL >= 4
266 SECTION_VECTOR4 (_Level4InterruptVector_text,
267 .Level4InterruptVector.text,
268 INTLEVEL4_VECTOR_VADDR,
271 # define LAST .Level4InterruptVector.text
273 #if XCHAL_EXCM_LEVEL >= 5
274 SECTION_VECTOR4 (_Level5InterruptVector_text,
275 .Level5InterruptVector.text,
276 INTLEVEL5_VECTOR_VADDR,
279 # define LAST .Level5InterruptVector.text
281 #if XCHAL_EXCM_LEVEL >= 6
282 SECTION_VECTOR4 (_Level6InterruptVector_text,
283 .Level6InterruptVector.text,
284 INTLEVEL6_VECTOR_VADDR,
287 # define LAST .Level6InterruptVector.text
289 SECTION_VECTOR4 (_KernelExceptionVector_text,
290 .KernelExceptionVector.text,
294 SECTION_VECTOR4 (_UserExceptionVector_text,
295 .UserExceptionVector.text,
297 .KernelExceptionVector.text)
298 SECTION_VECTOR4 (_DoubleExceptionVector_text,
299 .DoubleExceptionVector.text,
300 DOUBLEEXC_VECTOR_VADDR,
301 .UserExceptionVector.text)
302 #define LAST .DoubleExceptionVector.text
305 #if defined(CONFIG_SECONDARY_RESET_VECTOR)
307 SECTION_VECTOR4 (_SecondaryResetVector_text,
308 .SecondaryResetVector.text,
312 #define LAST .SecondaryResetVector.text
316 SECTION_VECTOR4 (_exception_text,
321 #define LAST .exception.text
324 . = (LOADADDR(LAST) + SIZEOF(LAST) + 3) & ~ 3;
326 .dummy1 : AT(ADDR(.dummy1)) { LONG(0) }
327 . = ALIGN(PAGE_SIZE);
329 #ifndef CONFIG_XIP_KERNEL
332 BSS_SECTION(0, 8192, 0)
337 #ifdef CONFIG_XIP_KERNEL
338 . = CONFIG_XIP_DATA_ADDR;
343 #define LOAD_OFFSET \
344 (CONFIG_XIP_DATA_ADDR - (LOADADDR(.dummy1) + SIZEOF(.dummy1) + 3) & ~ 3)
348 RW_DATA(XCHAL_ICACHE_LINESIZE, PAGE_SIZE, THREAD_SIZE)
352 /* Initialization data: */
356 _xip_init_data_start = .;
362 _xip_init_data_end = .;
364 BSS_SECTION(0, 8192, 0)
373 .xt.prop 0 : { KEEP(*(.xt.prop .xt.prop.* .gnu.linkonce.prop.*)) }
374 .xt.insn 0 : { KEEP(*(.xt.insn .xt.insn.* .gnu.linkonce.x*)) }
375 .xt.lit 0 : { KEEP(*(.xt.lit .xt.lit.* .gnu.linkonce.p*)) }
377 /* Sections to be discarded */