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 - 2005 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 #include <asm-generic/vmlinux.lds.h>
19 #include <variant/core.h>
20 #include <platform/hardware.h>
25 jiffies = jiffies_64 + 4;
31 #define KERNELOFFSET 0xd0001000
34 /* Note: In the following macros, it would be nice to specify only the
35 vector name and section kind and construct "sym" and "section" using
36 CPP concatenation, but that does not work reliably. Concatenating a
37 string with "." produces an invalid token. CPP will not print a
38 warning because it thinks this is an assembly file, but it leaves
39 them as multiple tokens and there may or may not be whitespace
42 /* Macro for a relocation entry */
44 #define RELOCATE_ENTRY(sym, section) \
45 LONG(sym ## _start); \
47 LONG(LOADADDR(section))
49 /* Macro to define a section for a vector.
51 * Use of the MIN function catches the types of errors illustrated in
52 * the following example:
54 * Assume the section .DoubleExceptionVector.literal is completely
55 * full. Then a programmer adds code to .DoubleExceptionVector.text
56 * that produces another literal. The final literal position will
57 * overlay onto the first word of the adjacent code section
58 * .DoubleExceptionVector.text. (In practice, the literals will
59 * overwrite the code, and the first few instructions will be
63 #define SECTION_VECTOR(sym, section, addr, max_prevsec_size, prevsec) \
64 section addr : AT((MIN(LOADADDR(prevsec) + max_prevsec_size, \
65 LOADADDR(prevsec) + SIZEOF(prevsec)) + 3) & ~ 3) \
68 sym ## _start = ABSOLUTE(.); \
70 sym ## _end = ABSOLUTE(.); \
74 * Mapping of input sections to output sections when linking.
88 /* The .head.text section must be the first section! */
91 VMLINUX_SYMBOL(__sched_text_start) = .;
92 *(.sched.literal .sched.text)
93 VMLINUX_SYMBOL(__sched_text_end) = .;
94 VMLINUX_SYMBOL(__lock_text_start) = .;
95 *(.spinlock.literal .spinlock.text)
96 VMLINUX_SYMBOL(__lock_text_end) = .;
106 /* Relocation table */
108 .fixup : { *(.fixup) }
113 __start___ex_table = .;
115 __stop___ex_table = .;
120 . = ALIGN(XCHAL_ICACHE_LINESIZE);
126 . = ALIGN(XCHAL_ICACHE_LINESIZE);
127 *(.data.cacheline_aligned)
132 /* The initial task */
134 .data.init_task : { *(.data.init_task) }
136 /* Initialization code and data: */
142 *(.init.literal) *(.cpuinit.literal)
143 *(.devinit.literal) *(.meminit.literal)
152 __tagtable_begin = .;
157 __boot_reloc_table_start = ABSOLUTE(.);
159 RELOCATE_ENTRY(_WindowVectors_text,
160 .WindowVectors.text);
161 RELOCATE_ENTRY(_KernelExceptionVector_text,
162 .KernelExceptionVector.text);
163 RELOCATE_ENTRY(_UserExceptionVector_text,
164 .UserExceptionVector.text);
165 RELOCATE_ENTRY(_DoubleExceptionVector_literal,
166 .DoubleExceptionVector.literal);
167 RELOCATE_ENTRY(_DoubleExceptionVector_text,
168 .DoubleExceptionVector.text);
169 RELOCATE_ENTRY(_DebugInterruptVector_text,
170 .DebugInterruptVector.text);
172 __boot_reloc_table_end = ABSOLUTE(.) ;
175 . = ALIGN(XCHAL_ICACHE_LINESIZE);
178 .init.setup : { *(.init.setup) }
181 __initcall_start = .;
187 __con_initcall_start = .;
188 .con_initcall.init : { *(.con_initcall.init) }
189 __con_initcall_end = .;
194 #ifdef CONFIG_BLK_DEV_INITRD
196 __initramfs_start =.;
197 .init.ramfs : { *(.init.ramfs) }
204 /* We need this dummy segment here */
209 /* The vectors are relocated to the real position at startup time */
211 SECTION_VECTOR (_WindowVectors_text,
213 XCHAL_WINDOW_VECTORS_VADDR, 4,
215 SECTION_VECTOR (_DebugInterruptVector_literal,
216 .DebugInterruptVector.literal,
217 XCHAL_DEBUG_VECTOR_VADDR - 4,
218 SIZEOF(.WindowVectors.text),
220 SECTION_VECTOR (_DebugInterruptVector_text,
221 .DebugInterruptVector.text,
222 XCHAL_DEBUG_VECTOR_VADDR,
224 .DebugInterruptVector.literal)
225 SECTION_VECTOR (_KernelExceptionVector_literal,
226 .KernelExceptionVector.literal,
227 XCHAL_KERNEL_VECTOR_VADDR - 4,
228 SIZEOF(.DebugInterruptVector.text),
229 .DebugInterruptVector.text)
230 SECTION_VECTOR (_KernelExceptionVector_text,
231 .KernelExceptionVector.text,
232 XCHAL_KERNEL_VECTOR_VADDR,
234 .KernelExceptionVector.literal)
235 SECTION_VECTOR (_UserExceptionVector_literal,
236 .UserExceptionVector.literal,
237 XCHAL_USER_VECTOR_VADDR - 4,
238 SIZEOF(.KernelExceptionVector.text),
239 .KernelExceptionVector.text)
240 SECTION_VECTOR (_UserExceptionVector_text,
241 .UserExceptionVector.text,
242 XCHAL_USER_VECTOR_VADDR,
244 .UserExceptionVector.literal)
245 SECTION_VECTOR (_DoubleExceptionVector_literal,
246 .DoubleExceptionVector.literal,
247 XCHAL_DOUBLEEXC_VECTOR_VADDR - 16,
248 SIZEOF(.UserExceptionVector.text),
249 .UserExceptionVector.text)
250 SECTION_VECTOR (_DoubleExceptionVector_text,
251 .DoubleExceptionVector.text,
252 XCHAL_DOUBLEEXC_VECTOR_VADDR,
254 .DoubleExceptionVector.literal)
256 . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3;
265 .bss : { *(.bss.page_aligned) *(.bss) }
270 /* only used by the boot loader */
273 .bootstrap : { *(.bootstrap.literal .bootstrap.text .bootstrap.data) }
277 .initrd : { *(.initrd) }
280 .ResetVector.text XCHAL_RESET_VECTOR_VADDR :
285 /* Sections to be discarded */
294 .xt.lit : { *(.xt.lit) }
295 .xt.prop : { *(.xt.prop) }
297 .debug 0 : { *(.debug) }
298 .line 0 : { *(.line) }
299 .debug_srcinfo 0 : { *(.debug_srcinfo) }
300 .debug_sfnames 0 : { *(.debug_sfnames) }
301 .debug_aranges 0 : { *(.debug_aranges) }
302 .debug_pubnames 0 : { *(.debug_pubnames) }
303 .debug_info 0 : { *(.debug_info) }
304 .debug_abbrev 0 : { *(.debug_abbrev) }
305 .debug_line 0 : { *(.debug_line) }
306 .debug_frame 0 : { *(.debug_frame) }
307 .debug_str 0 : { *(.debug_str) }
308 .debug_loc 0 : { *(.debug_loc) }
309 .debug_macinfo 0 : { *(.debug_macinfo) }
310 .debug_weaknames 0 : { *(.debug_weaknames) }
311 .debug_funcnames 0 : { *(.debug_funcnames) }
312 .debug_typenames 0 : { *(.debug_typenames) }
313 .debug_varnames 0 : { *(.debug_varnames) }