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 <asm/variant/core.h>
24 jiffies = jiffies_64 + 4;
29 #define KERNELOFFSET 0xd0001000
31 /* Note: In the following macros, it would be nice to specify only the
32 vector name and section kind and construct "sym" and "section" using
33 CPP concatenation, but that does not work reliably. Concatenating a
34 string with "." produces an invalid token. CPP will not print a
35 warning because it thinks this is an assembly file, but it leaves
36 them as multiple tokens and there may or may not be whitespace
39 /* Macro for a relocation entry */
41 #define RELOCATE_ENTRY(sym, section) \
42 LONG(sym ## _start); \
44 LONG(LOADADDR(section))
46 /* Macro to define a section for a vector.
48 * Use of the MIN function catches the types of errors illustrated in
49 * the following example:
51 * Assume the section .DoubleExceptionVector.literal is completely
52 * full. Then a programmer adds code to .DoubleExceptionVector.text
53 * that produces another literal. The final literal position will
54 * overlay onto the first word of the adjacent code section
55 * .DoubleExceptionVector.text. (In practice, the literals will
56 * overwrite the code, and the first few instructions will be
60 #define SECTION_VECTOR(sym, section, addr, max_prevsec_size, prevsec) \
61 section addr : AT((MIN(LOADADDR(prevsec) + max_prevsec_size, \
62 LOADADDR(prevsec) + SIZEOF(prevsec)) + 3) & ~ 3) \
65 sym ## _start = ABSOLUTE(.); \
67 sym ## _end = ABSOLUTE(.); \
71 * Mapping of input sections to output sections when linking.
85 /* The .head.text section must be the first section! */
88 VMLINUX_SYMBOL(__sched_text_start) = .;
89 *(.sched.literal .sched.text)
90 VMLINUX_SYMBOL(__sched_text_end) = .;
91 VMLINUX_SYMBOL(__lock_text_start) = .;
92 *(.spinlock.literal .spinlock.text)
93 VMLINUX_SYMBOL(__lock_text_end) = .;
103 /* Relocation table */
105 .fixup : { *(.fixup) }
110 __start___ex_table = .;
112 __stop___ex_table = .;
117 . = ALIGN(XCHAL_ICACHE_LINESIZE);
121 *(.data) CONSTRUCTORS
122 . = ALIGN(XCHAL_ICACHE_LINESIZE);
123 *(.data.cacheline_aligned)
128 /* The initial task */
130 .data.init_task : { *(.data.init_task) }
132 /* Initialization code and data: */
138 *(.init.literal) *(.init.text)
146 __tagtable_begin = .;
151 __boot_reloc_table_start = ABSOLUTE(.);
153 RELOCATE_ENTRY(_WindowVectors_text,
154 .WindowVectors.text);
155 RELOCATE_ENTRY(_KernelExceptionVector_text,
156 .KernelExceptionVector.text);
157 RELOCATE_ENTRY(_UserExceptionVector_text,
158 .UserExceptionVector.text);
159 RELOCATE_ENTRY(_DoubleExceptionVector_literal,
160 .DoubleExceptionVector.literal);
161 RELOCATE_ENTRY(_DoubleExceptionVector_text,
162 .DoubleExceptionVector.text);
164 __boot_reloc_table_end = ABSOLUTE(.) ;
167 . = ALIGN(XCHAL_ICACHE_LINESIZE);
170 .init.setup : { *(.init.setup) }
173 __initcall_start = .;
179 __con_initcall_start = .;
180 .con_initcall.init : { *(.con_initcall.init) }
181 __con_initcall_end = .;
186 #ifdef CONFIG_BLK_DEV_INITRD
188 __initramfs_start =.;
189 .init.ramfs : { *(.init.ramfs) }
196 /* We need this dummy segment here */
201 /* The vectors are relocated to the real position at startup time */
203 SECTION_VECTOR (_WindowVectors_text,
205 XCHAL_WINDOW_VECTORS_VADDR, 4,
207 SECTION_VECTOR (_DebugInterruptVector_literal,
208 .DebugInterruptVector.literal,
209 XCHAL_DEBUG_VECTOR_VADDR - 4,
210 SIZEOF(.WindowVectors.text),
212 SECTION_VECTOR (_DebugInterruptVector_text,
213 .DebugInterruptVector.text,
214 XCHAL_DEBUG_VECTOR_VADDR,
216 .DebugInterruptVector.literal)
217 SECTION_VECTOR (_KernelExceptionVector_literal,
218 .KernelExceptionVector.literal,
219 XCHAL_KERNEL_VECTOR_VADDR - 4,
220 SIZEOF(.DebugInterruptVector.text),
221 .DebugInterruptVector.text)
222 SECTION_VECTOR (_KernelExceptionVector_text,
223 .KernelExceptionVector.text,
224 XCHAL_KERNEL_VECTOR_VADDR,
226 .KernelExceptionVector.literal)
227 SECTION_VECTOR (_UserExceptionVector_literal,
228 .UserExceptionVector.literal,
229 XCHAL_USER_VECTOR_VADDR - 4,
230 SIZEOF(.KernelExceptionVector.text),
231 .KernelExceptionVector.text)
232 SECTION_VECTOR (_UserExceptionVector_text,
233 .UserExceptionVector.text,
234 XCHAL_USER_VECTOR_VADDR,
236 .UserExceptionVector.literal)
237 SECTION_VECTOR (_DoubleExceptionVector_literal,
238 .DoubleExceptionVector.literal,
239 XCHAL_DOUBLEEXC_VECTOR_VADDR - 16,
240 SIZEOF(.UserExceptionVector.text),
241 .UserExceptionVector.text)
242 SECTION_VECTOR (_DoubleExceptionVector_text,
243 .DoubleExceptionVector.text,
244 XCHAL_DOUBLEEXC_VECTOR_VADDR,
246 .DoubleExceptionVector.literal)
248 . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3;
257 .bss : { *(.bss.page_aligned) *(.bss) }
262 /* only used by the boot loader */
265 .bootstrap : { *(.bootstrap.literal .bootstrap.text .bootstrap.data) }
269 .initrd : { *(.initrd) }
272 .ResetVector.text XCHAL_RESET_VECTOR_VADDR :
277 /* Sections to be discarded */
280 *(.exit.literal .exit.text)
285 .xt.lit : { *(.xt.lit) }
286 .xt.prop : { *(.xt.prop) }
288 .debug 0 : { *(.debug) }
289 .line 0 : { *(.line) }
290 .debug_srcinfo 0 : { *(.debug_srcinfo) }
291 .debug_sfnames 0 : { *(.debug_sfnames) }
292 .debug_aranges 0 : { *(.debug_aranges) }
293 .debug_pubnames 0 : { *(.debug_pubnames) }
294 .debug_info 0 : { *(.debug_info) }
295 .debug_abbrev 0 : { *(.debug_abbrev) }
296 .debug_line 0 : { *(.debug_line) }
297 .debug_frame 0 : { *(.debug_frame) }
298 .debug_str 0 : { *(.debug_str) }
299 .debug_loc 0 : { *(.debug_loc) }
300 .debug_macinfo 0 : { *(.debug_macinfo) }
301 .debug_weaknames 0 : { *(.debug_weaknames) }
302 .debug_funcnames 0 : { *(.debug_funcnames) }
303 .debug_typenames 0 : { *(.debug_typenames) }
304 .debug_varnames 0 : { *(.debug_varnames) }