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)
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);
194 #ifdef CONFIG_XIP_KERNEL
195 RELOCATE_ENTRY(_xip_data, .data);
196 RELOCATE_ENTRY(_xip_init_data, .init.data);
198 #if defined(CONFIG_SMP)
199 RELOCATE_ENTRY(_SecondaryResetVector_text,
200 .SecondaryResetVector.text);
204 __boot_reloc_table_end = ABSOLUTE(.) ;
206 INIT_SETUP(XCHAL_ICACHE_LINESIZE)
212 PERCPU_SECTION(XCHAL_ICACHE_LINESIZE)
214 /* We need this dummy segment here */
219 #ifdef CONFIG_VECTORS_OFFSET
220 /* The vectors are relocated to the real position at startup time */
222 SECTION_VECTOR (_WindowVectors_text,
224 WINDOW_VECTORS_VADDR,
226 SECTION_VECTOR (_DebugInterruptVector_text,
227 .DebugInterruptVector.text,
231 #define LAST .DebugInterruptVector.text
232 #if XCHAL_EXCM_LEVEL >= 2
233 SECTION_VECTOR (_Level2InterruptVector_text,
234 .Level2InterruptVector.text,
235 INTLEVEL2_VECTOR_VADDR,
238 # define LAST .Level2InterruptVector.text
240 #if XCHAL_EXCM_LEVEL >= 3
241 SECTION_VECTOR (_Level3InterruptVector_text,
242 .Level3InterruptVector.text,
243 INTLEVEL3_VECTOR_VADDR,
246 # define LAST .Level3InterruptVector.text
248 #if XCHAL_EXCM_LEVEL >= 4
249 SECTION_VECTOR (_Level4InterruptVector_text,
250 .Level4InterruptVector.text,
251 INTLEVEL4_VECTOR_VADDR,
254 # define LAST .Level4InterruptVector.text
256 #if XCHAL_EXCM_LEVEL >= 5
257 SECTION_VECTOR (_Level5InterruptVector_text,
258 .Level5InterruptVector.text,
259 INTLEVEL5_VECTOR_VADDR,
262 # define LAST .Level5InterruptVector.text
264 #if XCHAL_EXCM_LEVEL >= 6
265 SECTION_VECTOR (_Level6InterruptVector_text,
266 .Level6InterruptVector.text,
267 INTLEVEL6_VECTOR_VADDR,
270 # define LAST .Level6InterruptVector.text
272 SECTION_VECTOR (_KernelExceptionVector_text,
273 .KernelExceptionVector.text,
277 SECTION_VECTOR (_UserExceptionVector_text,
278 .UserExceptionVector.text,
280 .KernelExceptionVector.text)
281 SECTION_VECTOR (_DoubleExceptionVector_text,
282 .DoubleExceptionVector.text,
283 DOUBLEEXC_VECTOR_VADDR,
284 .UserExceptionVector.text)
286 . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3;
289 #if !defined(CONFIG_XIP_KERNEL) && defined(CONFIG_SMP)
291 SECTION_VECTOR (_SecondaryResetVector_text,
292 .SecondaryResetVector.text,
294 .DoubleExceptionVector.text)
296 . = LOADADDR(.SecondaryResetVector.text)+SIZEOF(.SecondaryResetVector.text);
300 . = ALIGN(PAGE_SIZE);
302 #ifndef CONFIG_XIP_KERNEL
305 BSS_SECTION(0, 8192, 0)
310 #ifdef CONFIG_XIP_KERNEL
311 . = CONFIG_XIP_DATA_ADDR;
316 #define LOAD_OFFSET \
317 (CONFIG_XIP_DATA_ADDR - (LOADADDR(.dummy) + SIZEOF(.dummy) + 3) & ~ 3)
321 RW_DATA(XCHAL_ICACHE_LINESIZE, PAGE_SIZE, THREAD_SIZE)
325 /* Initialization data: */
329 _xip_init_data_start = .;
335 _xip_init_data_end = .;
337 BSS_SECTION(0, 8192, 0)
346 .xt.prop 0 : { KEEP(*(.xt.prop .xt.prop.* .gnu.linkonce.prop.*)) }
347 .xt.insn 0 : { KEEP(*(.xt.insn .xt.insn.* .gnu.linkonce.x*)) }
348 .xt.lit 0 : { KEEP(*(.xt.lit .xt.lit.* .gnu.linkonce.p*)) }
350 /* Sections to be discarded */