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 #define SECTION_VECTOR4(sym, section, addr, prevsec) \
58 section addr : AT(((LOADADDR(prevsec) + SIZEOF(prevsec)) + 3) & ~ 3) \
61 sym ## _start = ABSOLUTE(.); \
63 sym ## _end = ABSOLUTE(.); \
66 #define SECTION_VECTOR2(section, addr) \
71 * Mapping of input sections to output sections when linking.
84 /* The HEAD_TEXT section must be the first section! */
87 #ifndef CONFIG_VECTORS_OFFSET
91 SECTION_VECTOR2 (.WindowVectors.text, WINDOW_VECTORS_VADDR)
92 #if XCHAL_EXCM_LEVEL >= 2
93 SECTION_VECTOR2 (.Level2InterruptVector.text, INTLEVEL2_VECTOR_VADDR)
95 #if XCHAL_EXCM_LEVEL >= 3
96 SECTION_VECTOR2 (.Level3InterruptVector.text, INTLEVEL3_VECTOR_VADDR)
98 #if XCHAL_EXCM_LEVEL >= 4
99 SECTION_VECTOR2 (.Level4InterruptVector.text, INTLEVEL4_VECTOR_VADDR)
101 #if XCHAL_EXCM_LEVEL >= 5
102 SECTION_VECTOR2 (.Level5InterruptVector.text, INTLEVEL5_VECTOR_VADDR)
104 #if XCHAL_EXCM_LEVEL >= 6
105 SECTION_VECTOR2 (.Level6InterruptVector.text, INTLEVEL6_VECTOR_VADDR)
107 SECTION_VECTOR2 (.DebugInterruptVector.text, DEBUG_VECTOR_VADDR)
108 SECTION_VECTOR2 (.KernelExceptionVector.text, KERNEL_VECTOR_VADDR)
109 SECTION_VECTOR2 (.UserExceptionVector.text, USER_VECTOR_VADDR)
110 SECTION_VECTOR2 (.DoubleExceptionVector.text, DOUBLEEXC_VECTOR_VADDR)
133 #ifdef CONFIG_XIP_KERNEL
134 INIT_TEXT_SECTION(PAGE_SIZE)
137 RW_DATA(XCHAL_ICACHE_LINESIZE, PAGE_SIZE, THREAD_SIZE)
140 /* Initialization code and data: */
142 . = ALIGN(PAGE_SIZE);
144 INIT_TEXT_SECTION(PAGE_SIZE)
155 __tagtable_begin = .;
160 __boot_reloc_table_start = ABSOLUTE(.);
162 #ifdef CONFIG_VECTORS_OFFSET
163 RELOCATE_ENTRY(_WindowVectors_text,
164 .WindowVectors.text);
165 #if XCHAL_EXCM_LEVEL >= 2
166 RELOCATE_ENTRY(_Level2InterruptVector_text,
167 .Level2InterruptVector.text);
169 #if XCHAL_EXCM_LEVEL >= 3
170 RELOCATE_ENTRY(_Level3InterruptVector_text,
171 .Level3InterruptVector.text);
173 #if XCHAL_EXCM_LEVEL >= 4
174 RELOCATE_ENTRY(_Level4InterruptVector_text,
175 .Level4InterruptVector.text);
177 #if XCHAL_EXCM_LEVEL >= 5
178 RELOCATE_ENTRY(_Level5InterruptVector_text,
179 .Level5InterruptVector.text);
181 #if XCHAL_EXCM_LEVEL >= 6
182 RELOCATE_ENTRY(_Level6InterruptVector_text,
183 .Level6InterruptVector.text);
185 RELOCATE_ENTRY(_KernelExceptionVector_text,
186 .KernelExceptionVector.text);
187 RELOCATE_ENTRY(_UserExceptionVector_text,
188 .UserExceptionVector.text);
189 RELOCATE_ENTRY(_DoubleExceptionVector_text,
190 .DoubleExceptionVector.text);
191 RELOCATE_ENTRY(_DebugInterruptVector_text,
192 .DebugInterruptVector.text);
193 RELOCATE_ENTRY(_exception_text,
196 #ifdef CONFIG_XIP_KERNEL
197 RELOCATE_ENTRY(_xip_data, .data);
198 RELOCATE_ENTRY(_xip_init_data, .init.data);
200 #if defined(CONFIG_SMP)
201 RELOCATE_ENTRY(_SecondaryResetVector_text,
202 .SecondaryResetVector.text);
205 __boot_reloc_table_end = ABSOLUTE(.) ;
207 INIT_SETUP(XCHAL_ICACHE_LINESIZE)
213 PERCPU_SECTION(XCHAL_ICACHE_LINESIZE)
215 /* 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_VECTOR4 (_WindowVectors_text,
228 WINDOW_VECTORS_VADDR,
230 SECTION_VECTOR4 (_DebugInterruptVector_text,
231 .DebugInterruptVector.text,
235 #define LAST .DebugInterruptVector.text
236 #if XCHAL_EXCM_LEVEL >= 2
237 SECTION_VECTOR4 (_Level2InterruptVector_text,
238 .Level2InterruptVector.text,
239 INTLEVEL2_VECTOR_VADDR,
242 # define LAST .Level2InterruptVector.text
244 #if XCHAL_EXCM_LEVEL >= 3
245 SECTION_VECTOR4 (_Level3InterruptVector_text,
246 .Level3InterruptVector.text,
247 INTLEVEL3_VECTOR_VADDR,
250 # define LAST .Level3InterruptVector.text
252 #if XCHAL_EXCM_LEVEL >= 4
253 SECTION_VECTOR4 (_Level4InterruptVector_text,
254 .Level4InterruptVector.text,
255 INTLEVEL4_VECTOR_VADDR,
258 # define LAST .Level4InterruptVector.text
260 #if XCHAL_EXCM_LEVEL >= 5
261 SECTION_VECTOR4 (_Level5InterruptVector_text,
262 .Level5InterruptVector.text,
263 INTLEVEL5_VECTOR_VADDR,
266 # define LAST .Level5InterruptVector.text
268 #if XCHAL_EXCM_LEVEL >= 6
269 SECTION_VECTOR4 (_Level6InterruptVector_text,
270 .Level6InterruptVector.text,
271 INTLEVEL6_VECTOR_VADDR,
274 # define LAST .Level6InterruptVector.text
276 SECTION_VECTOR4 (_KernelExceptionVector_text,
277 .KernelExceptionVector.text,
281 SECTION_VECTOR4 (_UserExceptionVector_text,
282 .UserExceptionVector.text,
284 .KernelExceptionVector.text)
285 SECTION_VECTOR4 (_DoubleExceptionVector_text,
286 .DoubleExceptionVector.text,
287 DOUBLEEXC_VECTOR_VADDR,
288 .UserExceptionVector.text)
289 #define LAST .DoubleExceptionVector.text
292 #if defined(CONFIG_SMP)
294 SECTION_VECTOR4 (_SecondaryResetVector_text,
295 .SecondaryResetVector.text,
299 #define LAST .SecondaryResetVector.text
302 #ifdef CONFIG_VECTORS_OFFSET
303 SECTION_VECTOR4 (_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 */