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 SECTION_VECTOR2 (.WindowVectors.text, WINDOW_VECTORS_VADDR)
98 #if XCHAL_EXCM_LEVEL >= 2
99 SECTION_VECTOR2 (.Level2InterruptVector.text, INTLEVEL2_VECTOR_VADDR)
101 #if XCHAL_EXCM_LEVEL >= 3
102 SECTION_VECTOR2 (.Level3InterruptVector.text, INTLEVEL3_VECTOR_VADDR)
104 #if XCHAL_EXCM_LEVEL >= 4
105 SECTION_VECTOR2 (.Level4InterruptVector.text, INTLEVEL4_VECTOR_VADDR)
107 #if XCHAL_EXCM_LEVEL >= 5
108 SECTION_VECTOR2 (.Level5InterruptVector.text, INTLEVEL5_VECTOR_VADDR)
110 #if XCHAL_EXCM_LEVEL >= 6
111 SECTION_VECTOR2 (.Level6InterruptVector.text, INTLEVEL6_VECTOR_VADDR)
113 SECTION_VECTOR2 (.DebugInterruptVector.text, DEBUG_VECTOR_VADDR)
114 SECTION_VECTOR2 (.KernelExceptionVector.text, KERNEL_VECTOR_VADDR)
115 SECTION_VECTOR2 (.UserExceptionVector.text, USER_VECTOR_VADDR)
116 SECTION_VECTOR2 (.DoubleExceptionVector.text, DOUBLEEXC_VECTOR_VADDR)
139 #ifdef CONFIG_XIP_KERNEL
140 INIT_TEXT_SECTION(PAGE_SIZE)
143 RW_DATA(XCHAL_ICACHE_LINESIZE, PAGE_SIZE, THREAD_SIZE)
146 /* Initialization code and data: */
148 . = ALIGN(PAGE_SIZE);
150 INIT_TEXT_SECTION(PAGE_SIZE)
161 __tagtable_begin = .;
166 __boot_reloc_table_start = ABSOLUTE(.);
169 RELOCATE_ENTRY(_WindowVectors_text,
170 .WindowVectors.text);
171 #if XCHAL_EXCM_LEVEL >= 2
172 RELOCATE_ENTRY(_Level2InterruptVector_text,
173 .Level2InterruptVector.text);
175 #if XCHAL_EXCM_LEVEL >= 3
176 RELOCATE_ENTRY(_Level3InterruptVector_text,
177 .Level3InterruptVector.text);
179 #if XCHAL_EXCM_LEVEL >= 4
180 RELOCATE_ENTRY(_Level4InterruptVector_text,
181 .Level4InterruptVector.text);
183 #if XCHAL_EXCM_LEVEL >= 5
184 RELOCATE_ENTRY(_Level5InterruptVector_text,
185 .Level5InterruptVector.text);
187 #if XCHAL_EXCM_LEVEL >= 6
188 RELOCATE_ENTRY(_Level6InterruptVector_text,
189 .Level6InterruptVector.text);
191 RELOCATE_ENTRY(_KernelExceptionVector_text,
192 .KernelExceptionVector.text);
193 RELOCATE_ENTRY(_UserExceptionVector_text,
194 .UserExceptionVector.text);
195 RELOCATE_ENTRY(_DoubleExceptionVector_text,
196 .DoubleExceptionVector.text);
197 RELOCATE_ENTRY(_DebugInterruptVector_text,
198 .DebugInterruptVector.text);
199 RELOCATE_ENTRY(_exception_text,
202 #ifdef CONFIG_XIP_KERNEL
203 RELOCATE_ENTRY(_xip_data, .data);
204 RELOCATE_ENTRY(_xip_init_data, .init.data);
206 #if defined(CONFIG_SMP)
207 RELOCATE_ENTRY(_SecondaryResetVector_text,
208 .SecondaryResetVector.text);
211 __boot_reloc_table_end = ABSOLUTE(.) ;
213 INIT_SETUP(XCHAL_ICACHE_LINESIZE)
219 PERCPU_SECTION(XCHAL_ICACHE_LINESIZE)
221 /* We need this dummy segment here */
230 /* The vectors are relocated to the real position at startup time */
232 SECTION_VECTOR4 (_WindowVectors_text,
234 WINDOW_VECTORS_VADDR,
236 SECTION_VECTOR4 (_DebugInterruptVector_text,
237 .DebugInterruptVector.text,
241 #define LAST .DebugInterruptVector.text
242 #if XCHAL_EXCM_LEVEL >= 2
243 SECTION_VECTOR4 (_Level2InterruptVector_text,
244 .Level2InterruptVector.text,
245 INTLEVEL2_VECTOR_VADDR,
248 # define LAST .Level2InterruptVector.text
250 #if XCHAL_EXCM_LEVEL >= 3
251 SECTION_VECTOR4 (_Level3InterruptVector_text,
252 .Level3InterruptVector.text,
253 INTLEVEL3_VECTOR_VADDR,
256 # define LAST .Level3InterruptVector.text
258 #if XCHAL_EXCM_LEVEL >= 4
259 SECTION_VECTOR4 (_Level4InterruptVector_text,
260 .Level4InterruptVector.text,
261 INTLEVEL4_VECTOR_VADDR,
264 # define LAST .Level4InterruptVector.text
266 #if XCHAL_EXCM_LEVEL >= 5
267 SECTION_VECTOR4 (_Level5InterruptVector_text,
268 .Level5InterruptVector.text,
269 INTLEVEL5_VECTOR_VADDR,
272 # define LAST .Level5InterruptVector.text
274 #if XCHAL_EXCM_LEVEL >= 6
275 SECTION_VECTOR4 (_Level6InterruptVector_text,
276 .Level6InterruptVector.text,
277 INTLEVEL6_VECTOR_VADDR,
280 # define LAST .Level6InterruptVector.text
282 SECTION_VECTOR4 (_KernelExceptionVector_text,
283 .KernelExceptionVector.text,
287 SECTION_VECTOR4 (_UserExceptionVector_text,
288 .UserExceptionVector.text,
290 .KernelExceptionVector.text)
291 SECTION_VECTOR4 (_DoubleExceptionVector_text,
292 .DoubleExceptionVector.text,
293 DOUBLEEXC_VECTOR_VADDR,
294 .UserExceptionVector.text)
295 #define LAST .DoubleExceptionVector.text
298 #if defined(CONFIG_SMP)
300 SECTION_VECTOR4 (_SecondaryResetVector_text,
301 .SecondaryResetVector.text,
305 #define LAST .SecondaryResetVector.text
309 SECTION_VECTOR4 (_exception_text,
314 #define LAST .exception.text
317 . = (LOADADDR(LAST) + SIZEOF(LAST) + 3) & ~ 3;
319 .dummy1 : AT(ADDR(.dummy1)) { LONG(0) }
320 . = ALIGN(PAGE_SIZE);
322 #ifndef CONFIG_XIP_KERNEL
325 BSS_SECTION(0, 8192, 0)
330 #ifdef CONFIG_XIP_KERNEL
331 . = CONFIG_XIP_DATA_ADDR;
336 #define LOAD_OFFSET \
337 (CONFIG_XIP_DATA_ADDR - (LOADADDR(.dummy1) + SIZEOF(.dummy1) + 3) & ~ 3)
341 RW_DATA(XCHAL_ICACHE_LINESIZE, PAGE_SIZE, THREAD_SIZE)
345 /* Initialization data: */
349 _xip_init_data_start = .;
355 _xip_init_data_end = .;
357 BSS_SECTION(0, 8192, 0)
366 .xt.prop 0 : { KEEP(*(.xt.prop .xt.prop.* .gnu.linkonce.prop.*)) }
367 .xt.insn 0 : { KEEP(*(.xt.insn .xt.insn.* .gnu.linkonce.x*)) }
368 .xt.lit 0 : { KEEP(*(.xt.lit .xt.lit.* .gnu.linkonce.p*)) }
370 /* Sections to be discarded */