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))
51 * Macro to define a section for a vector. When CONFIG_VECTORS_OFFSET is
52 * defined code for every vector is located with other init data. At startup
53 * time head.S copies code for every vector to its final position according
54 * to description recorded in the corresponding RELOCATE_ENTRY.
57 #ifdef CONFIG_VECTORS_OFFSET
58 #define SECTION_VECTOR(sym, section, addr, prevsec) \
59 section addr : AT(((LOADADDR(prevsec) + SIZEOF(prevsec)) + 3) & ~ 3) \
62 sym ## _start = ABSOLUTE(.); \
64 sym ## _end = ABSOLUTE(.); \
67 #define SECTION_VECTOR(section, addr) \
73 * Mapping of input sections to output sections when linking.
86 /* The HEAD_TEXT section must be the first section! */
89 #ifndef CONFIG_VECTORS_OFFSET
93 SECTION_VECTOR (.WindowVectors.text, WINDOW_VECTORS_VADDR)
94 #if XCHAL_EXCM_LEVEL >= 2
95 SECTION_VECTOR (.Level2InterruptVector.text, INTLEVEL2_VECTOR_VADDR)
97 #if XCHAL_EXCM_LEVEL >= 3
98 SECTION_VECTOR (.Level3InterruptVector.text, INTLEVEL3_VECTOR_VADDR)
100 #if XCHAL_EXCM_LEVEL >= 4
101 SECTION_VECTOR (.Level4InterruptVector.text, INTLEVEL4_VECTOR_VADDR)
103 #if XCHAL_EXCM_LEVEL >= 5
104 SECTION_VECTOR (.Level5InterruptVector.text, INTLEVEL5_VECTOR_VADDR)
106 #if XCHAL_EXCM_LEVEL >= 6
107 SECTION_VECTOR (.Level6InterruptVector.text, INTLEVEL6_VECTOR_VADDR)
109 SECTION_VECTOR (.DebugInterruptVector.text, DEBUG_VECTOR_VADDR)
110 SECTION_VECTOR (.KernelExceptionVector.text, KERNEL_VECTOR_VADDR)
111 SECTION_VECTOR (.UserExceptionVector.text, USER_VECTOR_VADDR)
112 SECTION_VECTOR (.DoubleExceptionVector.text, DOUBLEEXC_VECTOR_VADDR)
135 #ifdef CONFIG_XIP_KERNEL
136 INIT_TEXT_SECTION(PAGE_SIZE)
139 RW_DATA(XCHAL_ICACHE_LINESIZE, PAGE_SIZE, THREAD_SIZE)
142 /* Initialization code and data: */
144 . = ALIGN(PAGE_SIZE);
146 INIT_TEXT_SECTION(PAGE_SIZE)
157 __tagtable_begin = .;
162 __boot_reloc_table_start = ABSOLUTE(.);
164 #ifdef CONFIG_VECTORS_OFFSET
165 RELOCATE_ENTRY(_WindowVectors_text,
166 .WindowVectors.text);
167 #if XCHAL_EXCM_LEVEL >= 2
168 RELOCATE_ENTRY(_Level2InterruptVector_text,
169 .Level2InterruptVector.text);
171 #if XCHAL_EXCM_LEVEL >= 3
172 RELOCATE_ENTRY(_Level3InterruptVector_text,
173 .Level3InterruptVector.text);
175 #if XCHAL_EXCM_LEVEL >= 4
176 RELOCATE_ENTRY(_Level4InterruptVector_text,
177 .Level4InterruptVector.text);
179 #if XCHAL_EXCM_LEVEL >= 5
180 RELOCATE_ENTRY(_Level5InterruptVector_text,
181 .Level5InterruptVector.text);
183 #if XCHAL_EXCM_LEVEL >= 6
184 RELOCATE_ENTRY(_Level6InterruptVector_text,
185 .Level6InterruptVector.text);
187 RELOCATE_ENTRY(_KernelExceptionVector_text,
188 .KernelExceptionVector.text);
189 RELOCATE_ENTRY(_UserExceptionVector_text,
190 .UserExceptionVector.text);
191 RELOCATE_ENTRY(_DoubleExceptionVector_text,
192 .DoubleExceptionVector.text);
193 RELOCATE_ENTRY(_DebugInterruptVector_text,
194 .DebugInterruptVector.text);
195 RELOCATE_ENTRY(_exception_text,
198 #ifdef CONFIG_XIP_KERNEL
199 RELOCATE_ENTRY(_xip_data, .data);
200 RELOCATE_ENTRY(_xip_init_data, .init.data);
202 #if defined(CONFIG_SMP)
203 RELOCATE_ENTRY(_SecondaryResetVector_text,
204 .SecondaryResetVector.text);
208 __boot_reloc_table_end = ABSOLUTE(.) ;
210 INIT_SETUP(XCHAL_ICACHE_LINESIZE)
216 PERCPU_SECTION(XCHAL_ICACHE_LINESIZE)
218 /* We need this dummy segment here */
223 #ifdef CONFIG_VECTORS_OFFSET
224 /* The vectors are relocated to the real position at startup time */
226 SECTION_VECTOR (_WindowVectors_text,
228 WINDOW_VECTORS_VADDR,
230 SECTION_VECTOR (_DebugInterruptVector_text,
231 .DebugInterruptVector.text,
235 #define LAST .DebugInterruptVector.text
236 #if XCHAL_EXCM_LEVEL >= 2
237 SECTION_VECTOR (_Level2InterruptVector_text,
238 .Level2InterruptVector.text,
239 INTLEVEL2_VECTOR_VADDR,
242 # define LAST .Level2InterruptVector.text
244 #if XCHAL_EXCM_LEVEL >= 3
245 SECTION_VECTOR (_Level3InterruptVector_text,
246 .Level3InterruptVector.text,
247 INTLEVEL3_VECTOR_VADDR,
250 # define LAST .Level3InterruptVector.text
252 #if XCHAL_EXCM_LEVEL >= 4
253 SECTION_VECTOR (_Level4InterruptVector_text,
254 .Level4InterruptVector.text,
255 INTLEVEL4_VECTOR_VADDR,
258 # define LAST .Level4InterruptVector.text
260 #if XCHAL_EXCM_LEVEL >= 5
261 SECTION_VECTOR (_Level5InterruptVector_text,
262 .Level5InterruptVector.text,
263 INTLEVEL5_VECTOR_VADDR,
266 # define LAST .Level5InterruptVector.text
268 #if XCHAL_EXCM_LEVEL >= 6
269 SECTION_VECTOR (_Level6InterruptVector_text,
270 .Level6InterruptVector.text,
271 INTLEVEL6_VECTOR_VADDR,
274 # define LAST .Level6InterruptVector.text
276 SECTION_VECTOR (_KernelExceptionVector_text,
277 .KernelExceptionVector.text,
281 SECTION_VECTOR (_UserExceptionVector_text,
282 .UserExceptionVector.text,
284 .KernelExceptionVector.text)
285 SECTION_VECTOR (_DoubleExceptionVector_text,
286 .DoubleExceptionVector.text,
287 DOUBLEEXC_VECTOR_VADDR,
288 .UserExceptionVector.text)
289 #define LAST .DoubleExceptionVector.text
292 #if !defined(CONFIG_XIP_KERNEL) && defined(CONFIG_SMP)
294 SECTION_VECTOR (_SecondaryResetVector_text,
295 .SecondaryResetVector.text,
297 .DoubleExceptionVector.text)
299 #define LAST .SecondaryResetVector.text
302 #ifdef CONFIG_VECTORS_OFFSET
303 SECTION_VECTOR (_exception_text,
308 #define LAST .exception.text
311 . = (LOADADDR(LAST) + SIZEOF(LAST) + 3) & ~ 3;
313 . = ALIGN(PAGE_SIZE);
315 #ifndef CONFIG_XIP_KERNEL
318 BSS_SECTION(0, 8192, 0)
323 #ifdef CONFIG_XIP_KERNEL
324 . = CONFIG_XIP_DATA_ADDR;
329 #define LOAD_OFFSET \
330 (CONFIG_XIP_DATA_ADDR - (LOADADDR(.dummy) + SIZEOF(.dummy) + 3) & ~ 3)
334 RW_DATA(XCHAL_ICACHE_LINESIZE, PAGE_SIZE, THREAD_SIZE)
338 /* Initialization data: */
342 _xip_init_data_start = .;
348 _xip_init_data_end = .;
350 BSS_SECTION(0, 8192, 0)
359 .xt.prop 0 : { KEEP(*(.xt.prop .xt.prop.* .gnu.linkonce.prop.*)) }
360 .xt.insn 0 : { KEEP(*(.xt.insn .xt.insn.* .gnu.linkonce.x*)) }
361 .xt.lit 0 : { KEEP(*(.xt.lit .xt.lit.* .gnu.linkonce.p*)) }
363 /* Sections to be discarded */