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>
20 #include <xtensa/config/core.h>
21 #include <xtensa/config/system.h>
25 #if XCHAL_MEMORY_ORDER == XTHAL_BIGENDIAN
26 jiffies = jiffies_64 + 4;
31 #define KERNELOFFSET 0x1000
33 /* Note: In the following macros, it would be nice to specify only the
34 vector name and section kind and construct "sym" and "section" using
35 CPP concatenation, but that does not work reliably. Concatenating a
36 string with "." produces an invalid token. CPP will not print a
37 warning because it thinks this is an assembly file, but it leaves
38 them as multiple tokens and there may or may not be whitespace
41 /* Macro for a relocation entry */
43 #define RELOCATE_ENTRY(sym, section) \
44 LONG(sym ## _start); \
46 LONG(LOADADDR(section))
48 /* Macro to define a section for a vector.
50 * Use of the MIN function catches the types of errors illustrated in
51 * the following example:
53 * Assume the section .DoubleExceptionVector.literal is completely
54 * full. Then a programmer adds code to .DoubleExceptionVector.text
55 * that produces another literal. The final literal position will
56 * overlay onto the first word of the adjacent code section
57 * .DoubleExceptionVector.text. (In practice, the literals will
58 * overwrite the code, and the first few instructions will be
62 #define SECTION_VECTOR(sym, section, addr, max_prevsec_size, prevsec) \
63 section addr : AT((MIN(LOADADDR(prevsec) + max_prevsec_size, \
64 LOADADDR(prevsec) + SIZEOF(prevsec)) + 3) & ~ 3) \
67 sym ## _start = ABSOLUTE(.); \
69 sym ## _end = ABSOLUTE(.); \
73 * Mapping of input sections to output sections when linking.
78 . = XCHAL_KSEG_CACHED_VADDR + KERNELOFFSET;
87 /* 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) = .;
105 /* Relocation table */
108 __boot_reloc_table_start = ABSOLUTE(.);
112 RELOCATE_ENTRY(_WindowVectors_text,
113 .WindowVectors.text);
115 RELOCATE_ENTRY(_KernelExceptionVector_literal,
116 .KernelExceptionVector.literal);
118 RELOCATE_ENTRY(_KernelExceptionVector_text,
119 .KernelExceptionVector.text);
121 RELOCATE_ENTRY(_UserExceptionVector_literal,
122 .UserExceptionVector.literal);
124 RELOCATE_ENTRY(_UserExceptionVector_text,
125 .UserExceptionVector.text);
126 RELOCATE_ENTRY(_DoubleExceptionVector_literal,
127 .DoubleExceptionVector.literal);
128 RELOCATE_ENTRY(_DoubleExceptionVector_text,
129 .DoubleExceptionVector.text);
131 __boot_reloc_table_end = ABSOLUTE(.) ;
133 .fixup : { *(.fixup) }
138 __start___ex_table = .;
140 __stop___ex_table = .;
145 . = ALIGN(XCHAL_ICACHE_LINESIZE);
149 *(.data) CONSTRUCTORS
150 . = ALIGN(XCHAL_ICACHE_LINESIZE);
151 *(.data.cacheline_aligned)
156 /* The initial task */
158 .data.init_task : { *(.data.init_task) }
160 /* Initialization code and data: */
162 . = ALIGN(1<<XCHAL_MMU_MIN_PTE_PAGE_SIZE);
166 *(.init.literal) *(.init.text)
174 __tagtable_begin = .;
179 . = ALIGN(XCHAL_ICACHE_LINESIZE);
182 .init.setup : { *(.init.setup) }
185 __initcall_start = .;
191 __con_initcall_start = .;
192 .con_initcall.init : { *(.con_initcall.init) }
193 __con_initcall_end = .;
199 __start___ftr_fixup = .;
200 __ftr_fixup : { *(__ftr_fixup) }
201 __stop___ftr_fixup = .;
205 .data.percpu : { *(.data.percpu) }
209 __initramfs_start =.;
210 .init.ramfs : { *(.init.ramfs) }
213 /* We need this dummy segment here */
218 /* The vectors are relocated to the real position at startup time */
220 SECTION_VECTOR (_WindowVectors_text,
222 XCHAL_WINDOW_VECTORS_VADDR, 4,
224 SECTION_VECTOR (_DebugInterruptVector_literal,
225 .DebugInterruptVector.literal,
226 XCHAL_INTLEVEL_VECTOR_VADDR(XCHAL_DEBUGLEVEL) - 4,
227 SIZEOF(.WindowVectors.text),
229 SECTION_VECTOR (_DebugInterruptVector_text,
230 .DebugInterruptVector.text,
231 XCHAL_INTLEVEL_VECTOR_VADDR(XCHAL_DEBUGLEVEL),
233 .DebugInterruptVector.literal)
234 SECTION_VECTOR (_KernelExceptionVector_literal,
235 .KernelExceptionVector.literal,
236 XCHAL_KERNELEXC_VECTOR_VADDR - 4,
237 SIZEOF(.DebugInterruptVector.text),
238 .DebugInterruptVector.text)
239 SECTION_VECTOR (_KernelExceptionVector_text,
240 .KernelExceptionVector.text,
241 XCHAL_KERNELEXC_VECTOR_VADDR,
243 .KernelExceptionVector.literal)
244 SECTION_VECTOR (_UserExceptionVector_literal,
245 .UserExceptionVector.literal,
246 XCHAL_USEREXC_VECTOR_VADDR - 4,
247 SIZEOF(.KernelExceptionVector.text),
248 .KernelExceptionVector.text)
249 SECTION_VECTOR (_UserExceptionVector_text,
250 .UserExceptionVector.text,
251 XCHAL_USEREXC_VECTOR_VADDR,
253 .UserExceptionVector.literal)
254 SECTION_VECTOR (_DoubleExceptionVector_literal,
255 .DoubleExceptionVector.literal,
256 XCHAL_DOUBLEEXC_VECTOR_VADDR - 16,
257 SIZEOF(.UserExceptionVector.text),
258 .UserExceptionVector.text)
259 SECTION_VECTOR (_DoubleExceptionVector_text,
260 .DoubleExceptionVector.text,
261 XCHAL_DOUBLEEXC_VECTOR_VADDR,
263 .DoubleExceptionVector.literal)
265 . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3;
266 . = ALIGN(1<<XCHAL_MMU_MIN_PTE_PAGE_SIZE);
274 .sbss : { *(.sbss) *(.scommon) }
275 .bss : { *(COMMON) *(.bss) }
279 /* only used by the boot loader */
282 .bootstrap : { *(.bootstrap.literal .bootstrap.text .bootstrap.data) }
286 .initrd : { *(.initrd) }
289 .ResetVector.text XCHAL_RESET_VECTOR_VADDR :
295 /* Sections to be discarded */
299 *(.text.exit.literal)
305 .debug 0 : { *(.debug) }
306 .line 0 : { *(.line) }
307 .debug_srcinfo 0 : { *(.debug_srcinfo) }
308 .debug_sfnames 0 : { *(.debug_sfnames) }
309 .debug_aranges 0 : { *(.debug_aranges) }
310 .debug_pubnames 0 : { *(.debug_pubnames) }
311 .debug_info 0 : { *(.debug_info) }
312 .debug_abbrev 0 : { *(.debug_abbrev) }
313 .debug_line 0 : { *(.debug_line) }
314 .debug_frame 0 : { *(.debug_frame) }
315 .debug_str 0 : { *(.debug_str) }
316 .debug_loc 0 : { *(.debug_loc) }
317 .debug_macinfo 0 : { *(.debug_macinfo) }
318 .debug_weaknames 0 : { *(.debug_weaknames) }
319 .debug_funcnames 0 : { *(.debug_funcnames) }
320 .debug_typenames 0 : { *(.debug_typenames) }
321 .debug_varnames 0 : { *(.debug_varnames) }