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/thread_info.h>
21 #include <variant/core.h>
22 #include <platform/hardware.h>
27 jiffies = jiffies_64 + 4;
33 #define KERNELOFFSET 0xd0001000
36 /* Note: In the following macros, it would be nice to specify only the
37 vector name and section kind and construct "sym" and "section" using
38 CPP concatenation, but that does not work reliably. Concatenating a
39 string with "." produces an invalid token. CPP will not print a
40 warning because it thinks this is an assembly file, but it leaves
41 them as multiple tokens and there may or may not be whitespace
44 /* Macro for a relocation entry */
46 #define RELOCATE_ENTRY(sym, section) \
47 LONG(sym ## _start); \
49 LONG(LOADADDR(section))
51 /* Macro to define a section for a vector.
53 * Use of the MIN function catches the types of errors illustrated in
54 * the following example:
56 * Assume the section .DoubleExceptionVector.literal is completely
57 * full. Then a programmer adds code to .DoubleExceptionVector.text
58 * that produces another literal. The final literal position will
59 * overlay onto the first word of the adjacent code section
60 * .DoubleExceptionVector.text. (In practice, the literals will
61 * overwrite the code, and the first few instructions will be
65 #define SECTION_VECTOR(sym, section, addr, max_prevsec_size, prevsec) \
66 section addr : AT((MIN(LOADADDR(prevsec) + max_prevsec_size, \
67 LOADADDR(prevsec) + SIZEOF(prevsec)) + 3) & ~ 3) \
70 sym ## _start = ABSOLUTE(.); \
72 sym ## _end = ABSOLUTE(.); \
76 * Mapping of input sections to output sections when linking.
90 /* The HEAD_TEXT section must be the first section! */
93 VMLINUX_SYMBOL(__sched_text_start) = .;
94 *(.sched.literal .sched.text)
95 VMLINUX_SYMBOL(__sched_text_end) = .;
96 VMLINUX_SYMBOL(__lock_text_start) = .;
97 *(.spinlock.literal .spinlock.text)
98 VMLINUX_SYMBOL(__lock_text_end) = .;
108 /* Relocation table */
110 .fixup : { *(.fixup) }
117 RW_DATA_SECTION(XCHAL_ICACHE_LINESIZE, PAGE_SIZE, THREAD_SIZE)
120 /* Initialization code and data: */
122 . = ALIGN(PAGE_SIZE);
124 INIT_TEXT_SECTION(PAGE_SIZE)
130 __tagtable_begin = .;
135 __boot_reloc_table_start = ABSOLUTE(.);
137 RELOCATE_ENTRY(_WindowVectors_text,
138 .WindowVectors.text);
139 RELOCATE_ENTRY(_KernelExceptionVector_text,
140 .KernelExceptionVector.text);
141 RELOCATE_ENTRY(_UserExceptionVector_text,
142 .UserExceptionVector.text);
143 RELOCATE_ENTRY(_DoubleExceptionVector_literal,
144 .DoubleExceptionVector.literal);
145 RELOCATE_ENTRY(_DoubleExceptionVector_text,
146 .DoubleExceptionVector.text);
147 RELOCATE_ENTRY(_DebugInterruptVector_text,
148 .DebugInterruptVector.text);
150 __boot_reloc_table_end = ABSOLUTE(.) ;
152 INIT_SETUP(XCHAL_ICACHE_LINESIZE)
159 PERCPU_SECTION(XCHAL_ICACHE_LINESIZE)
161 /* We need this dummy segment here */
166 /* The vectors are relocated to the real position at startup time */
168 SECTION_VECTOR (_WindowVectors_text,
170 XCHAL_WINDOW_VECTORS_VADDR, 4,
172 SECTION_VECTOR (_DebugInterruptVector_literal,
173 .DebugInterruptVector.literal,
174 XCHAL_DEBUG_VECTOR_VADDR - 4,
175 SIZEOF(.WindowVectors.text),
177 SECTION_VECTOR (_DebugInterruptVector_text,
178 .DebugInterruptVector.text,
179 XCHAL_DEBUG_VECTOR_VADDR,
181 .DebugInterruptVector.literal)
182 SECTION_VECTOR (_KernelExceptionVector_literal,
183 .KernelExceptionVector.literal,
184 XCHAL_KERNEL_VECTOR_VADDR - 4,
185 SIZEOF(.DebugInterruptVector.text),
186 .DebugInterruptVector.text)
187 SECTION_VECTOR (_KernelExceptionVector_text,
188 .KernelExceptionVector.text,
189 XCHAL_KERNEL_VECTOR_VADDR,
191 .KernelExceptionVector.literal)
192 SECTION_VECTOR (_UserExceptionVector_literal,
193 .UserExceptionVector.literal,
194 XCHAL_USER_VECTOR_VADDR - 4,
195 SIZEOF(.KernelExceptionVector.text),
196 .KernelExceptionVector.text)
197 SECTION_VECTOR (_UserExceptionVector_text,
198 .UserExceptionVector.text,
199 XCHAL_USER_VECTOR_VADDR,
201 .UserExceptionVector.literal)
202 SECTION_VECTOR (_DoubleExceptionVector_literal,
203 .DoubleExceptionVector.literal,
204 XCHAL_DOUBLEEXC_VECTOR_VADDR - 16,
205 SIZEOF(.UserExceptionVector.text),
206 .UserExceptionVector.text)
207 SECTION_VECTOR (_DoubleExceptionVector_text,
208 .DoubleExceptionVector.text,
209 XCHAL_DOUBLEEXC_VECTOR_VADDR,
211 .DoubleExceptionVector.literal)
213 . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3;
214 . = ALIGN(PAGE_SIZE);
218 BSS_SECTION(0, 8192, 0)
222 /* only used by the boot loader */
225 .bootstrap : { *(.bootstrap.literal .bootstrap.text .bootstrap.data) }
229 .initrd : { *(.initrd) }
232 .ResetVector.text XCHAL_RESET_VECTOR_VADDR :
237 .xt.lit : { *(.xt.lit) }
238 .xt.prop : { *(.xt.prop) }
240 .debug 0 : { *(.debug) }
241 .line 0 : { *(.line) }
242 .debug_srcinfo 0 : { *(.debug_srcinfo) }
243 .debug_sfnames 0 : { *(.debug_sfnames) }
244 .debug_aranges 0 : { *(.debug_aranges) }
245 .debug_pubnames 0 : { *(.debug_pubnames) }
246 .debug_info 0 : { *(.debug_info) }
247 .debug_abbrev 0 : { *(.debug_abbrev) }
248 .debug_line 0 : { *(.debug_line) }
249 .debug_frame 0 : { *(.debug_frame) }
250 .debug_str 0 : { *(.debug_str) }
251 .debug_loc 0 : { *(.debug_loc) }
252 .debug_macinfo 0 : { *(.debug_macinfo) }
253 .debug_weaknames 0 : { *(.debug_weaknames) }
254 .debug_funcnames 0 : { *(.debug_funcnames) }
255 .debug_typenames 0 : { *(.debug_typenames) }
256 .debug_varnames 0 : { *(.debug_varnames) }
270 /* Sections to be discarded */
272 /DISCARD/ : { *(.exit.literal) }