ipc-msg-avoid-waking-sender-upon-full-queue-checkpatch-fixes
[deliverable/linux.git] / arch / xtensa / kernel / vmlinux.lds.S
1 /*
2 * arch/xtensa/kernel/vmlinux.lds.S
3 *
4 * Xtensa linker script
5 *
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
8 * for more details.
9 *
10 * Copyright (C) 2001 - 2008 Tensilica Inc.
11 *
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>
15 */
16
17 #include <asm-generic/vmlinux.lds.h>
18 #include <asm/page.h>
19 #include <asm/thread_info.h>
20
21 #include <asm/vectors.h>
22 #include <variant/core.h>
23 #include <platform/hardware.h>
24 OUTPUT_ARCH(xtensa)
25 ENTRY(_start)
26
27 #ifdef __XTENSA_EB__
28 jiffies = jiffies_64 + 4;
29 #else
30 jiffies = jiffies_64;
31 #endif
32
33 #ifndef KERNELOFFSET
34 #define KERNELOFFSET 0xd0003000
35 #endif
36
37 /* Note: In the following macros, it would be nice to specify only the
38 vector name and section kind and construct "sym" and "section" using
39 CPP concatenation, but that does not work reliably. Concatenating a
40 string with "." produces an invalid token. CPP will not print a
41 warning because it thinks this is an assembly file, but it leaves
42 them as multiple tokens and there may or may not be whitespace
43 between them. */
44
45 /* Macro for a relocation entry */
46
47 #define RELOCATE_ENTRY(sym, section) \
48 LONG(sym ## _start); \
49 LONG(sym ## _end); \
50 LONG(LOADADDR(section))
51
52 /* Macro to define a section for a vector.
53 *
54 * Use of the MIN function catches the types of errors illustrated in
55 * the following example:
56 *
57 * Assume the section .DoubleExceptionVector.literal is completely
58 * full. Then a programmer adds code to .DoubleExceptionVector.text
59 * that produces another literal. The final literal position will
60 * overlay onto the first word of the adjacent code section
61 * .DoubleExceptionVector.text. (In practice, the literals will
62 * overwrite the code, and the first few instructions will be
63 * garbage.)
64 */
65
66 #define SECTION_VECTOR(sym, section, addr, max_prevsec_size, prevsec) \
67 section addr : AT((MIN(LOADADDR(prevsec) + max_prevsec_size, \
68 LOADADDR(prevsec) + SIZEOF(prevsec)) + 3) & ~ 3) \
69 { \
70 . = ALIGN(4); \
71 sym ## _start = ABSOLUTE(.); \
72 *(section) \
73 sym ## _end = ABSOLUTE(.); \
74 }
75
76 /*
77 * Mapping of input sections to output sections when linking.
78 */
79
80 SECTIONS
81 {
82 . = KERNELOFFSET;
83 /* .text section */
84
85 _text = .;
86 _stext = .;
87
88 .text :
89 {
90 /* The HEAD_TEXT section must be the first section! */
91 HEAD_TEXT
92 TEXT_TEXT
93 VMLINUX_SYMBOL(__sched_text_start) = .;
94 *(.sched.literal .sched.text)
95 VMLINUX_SYMBOL(__sched_text_end) = .;
96 VMLINUX_SYMBOL(__cpuidle_text_start) = .;
97 *(.cpuidle.literal .cpuidle.text)
98 VMLINUX_SYMBOL(__cpuidle_text_end) = .;
99 VMLINUX_SYMBOL(__lock_text_start) = .;
100 *(.spinlock.literal .spinlock.text)
101 VMLINUX_SYMBOL(__lock_text_end) = .;
102
103 }
104 _etext = .;
105 PROVIDE (etext = .);
106
107 . = ALIGN(16);
108
109 RODATA
110
111 /* Relocation table */
112
113 .fixup : { *(.fixup) }
114
115 EXCEPTION_TABLE(16)
116 /* Data section */
117
118 _sdata = .;
119 RW_DATA_SECTION(XCHAL_ICACHE_LINESIZE, PAGE_SIZE, THREAD_SIZE)
120 _edata = .;
121
122 /* Initialization code and data: */
123
124 . = ALIGN(PAGE_SIZE);
125 __init_begin = .;
126 INIT_TEXT_SECTION(PAGE_SIZE)
127
128 .init.data :
129 {
130 INIT_DATA
131 . = ALIGN(0x4);
132 __tagtable_begin = .;
133 *(.taglist)
134 __tagtable_end = .;
135
136 . = ALIGN(16);
137 __boot_reloc_table_start = ABSOLUTE(.);
138
139 RELOCATE_ENTRY(_WindowVectors_text,
140 .WindowVectors.text);
141 #if XCHAL_EXCM_LEVEL >= 2
142 RELOCATE_ENTRY(_Level2InterruptVector_text,
143 .Level2InterruptVector.text);
144 #endif
145 #if XCHAL_EXCM_LEVEL >= 3
146 RELOCATE_ENTRY(_Level3InterruptVector_text,
147 .Level3InterruptVector.text);
148 #endif
149 #if XCHAL_EXCM_LEVEL >= 4
150 RELOCATE_ENTRY(_Level4InterruptVector_text,
151 .Level4InterruptVector.text);
152 #endif
153 #if XCHAL_EXCM_LEVEL >= 5
154 RELOCATE_ENTRY(_Level5InterruptVector_text,
155 .Level5InterruptVector.text);
156 #endif
157 #if XCHAL_EXCM_LEVEL >= 6
158 RELOCATE_ENTRY(_Level6InterruptVector_text,
159 .Level6InterruptVector.text);
160 #endif
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);
171 #if defined(CONFIG_SMP)
172 RELOCATE_ENTRY(_SecondaryResetVector_text,
173 .SecondaryResetVector.text);
174 #endif
175
176
177 __boot_reloc_table_end = ABSOLUTE(.) ;
178
179 INIT_SETUP(XCHAL_ICACHE_LINESIZE)
180 INIT_CALLS
181 CON_INITCALL
182 SECURITY_INITCALL
183 INIT_RAM_FS
184 }
185
186 PERCPU_SECTION(XCHAL_ICACHE_LINESIZE)
187
188 /* We need this dummy segment here */
189
190 . = ALIGN(4);
191 .dummy : { LONG(0) }
192
193 /* The vectors are relocated to the real position at startup time */
194
195 SECTION_VECTOR (_WindowVectors_text,
196 .WindowVectors.text,
197 WINDOW_VECTORS_VADDR, 4,
198 .dummy)
199 SECTION_VECTOR (_DebugInterruptVector_literal,
200 .DebugInterruptVector.literal,
201 DEBUG_VECTOR_VADDR - 4,
202 SIZEOF(.WindowVectors.text),
203 .WindowVectors.text)
204 SECTION_VECTOR (_DebugInterruptVector_text,
205 .DebugInterruptVector.text,
206 DEBUG_VECTOR_VADDR,
207 4,
208 .DebugInterruptVector.literal)
209 #undef LAST
210 #define LAST .DebugInterruptVector.text
211 #if XCHAL_EXCM_LEVEL >= 2
212 SECTION_VECTOR (_Level2InterruptVector_text,
213 .Level2InterruptVector.text,
214 INTLEVEL2_VECTOR_VADDR,
215 SIZEOF(LAST), LAST)
216 # undef LAST
217 # define LAST .Level2InterruptVector.text
218 #endif
219 #if XCHAL_EXCM_LEVEL >= 3
220 SECTION_VECTOR (_Level3InterruptVector_text,
221 .Level3InterruptVector.text,
222 INTLEVEL3_VECTOR_VADDR,
223 SIZEOF(LAST), LAST)
224 # undef LAST
225 # define LAST .Level3InterruptVector.text
226 #endif
227 #if XCHAL_EXCM_LEVEL >= 4
228 SECTION_VECTOR (_Level4InterruptVector_text,
229 .Level4InterruptVector.text,
230 INTLEVEL4_VECTOR_VADDR,
231 SIZEOF(LAST), LAST)
232 # undef LAST
233 # define LAST .Level4InterruptVector.text
234 #endif
235 #if XCHAL_EXCM_LEVEL >= 5
236 SECTION_VECTOR (_Level5InterruptVector_text,
237 .Level5InterruptVector.text,
238 INTLEVEL5_VECTOR_VADDR,
239 SIZEOF(LAST), LAST)
240 # undef LAST
241 # define LAST .Level5InterruptVector.text
242 #endif
243 #if XCHAL_EXCM_LEVEL >= 6
244 SECTION_VECTOR (_Level6InterruptVector_text,
245 .Level6InterruptVector.text,
246 INTLEVEL6_VECTOR_VADDR,
247 SIZEOF(LAST), LAST)
248 # undef LAST
249 # define LAST .Level6InterruptVector.text
250 #endif
251 SECTION_VECTOR (_KernelExceptionVector_literal,
252 .KernelExceptionVector.literal,
253 KERNEL_VECTOR_VADDR - 4,
254 SIZEOF(LAST), LAST)
255 #undef LAST
256 SECTION_VECTOR (_KernelExceptionVector_text,
257 .KernelExceptionVector.text,
258 KERNEL_VECTOR_VADDR,
259 4,
260 .KernelExceptionVector.literal)
261 SECTION_VECTOR (_UserExceptionVector_literal,
262 .UserExceptionVector.literal,
263 USER_VECTOR_VADDR - 4,
264 SIZEOF(.KernelExceptionVector.text),
265 .KernelExceptionVector.text)
266 SECTION_VECTOR (_UserExceptionVector_text,
267 .UserExceptionVector.text,
268 USER_VECTOR_VADDR,
269 4,
270 .UserExceptionVector.literal)
271 SECTION_VECTOR (_DoubleExceptionVector_literal,
272 .DoubleExceptionVector.literal,
273 DOUBLEEXC_VECTOR_VADDR - 48,
274 SIZEOF(.UserExceptionVector.text),
275 .UserExceptionVector.text)
276 SECTION_VECTOR (_DoubleExceptionVector_text,
277 .DoubleExceptionVector.text,
278 DOUBLEEXC_VECTOR_VADDR,
279 48,
280 .DoubleExceptionVector.literal)
281
282 . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3;
283
284 #if defined(CONFIG_SMP)
285
286 SECTION_VECTOR (_SecondaryResetVector_text,
287 .SecondaryResetVector.text,
288 RESET_VECTOR1_VADDR,
289 SIZEOF(.DoubleExceptionVector.text),
290 .DoubleExceptionVector.text)
291
292 . = LOADADDR(.SecondaryResetVector.text)+SIZEOF(.SecondaryResetVector.text);
293
294 #endif
295
296 . = ALIGN(PAGE_SIZE);
297
298 __init_end = .;
299
300 BSS_SECTION(0, 8192, 0)
301
302 _end = .;
303
304 .xt.lit : { *(.xt.lit) }
305 .xt.prop : { *(.xt.prop) }
306
307 .debug 0 : { *(.debug) }
308 .line 0 : { *(.line) }
309 .debug_srcinfo 0 : { *(.debug_srcinfo) }
310 .debug_sfnames 0 : { *(.debug_sfnames) }
311 .debug_aranges 0 : { *(.debug_aranges) }
312 .debug_pubnames 0 : { *(.debug_pubnames) }
313 .debug_info 0 : { *(.debug_info) }
314 .debug_abbrev 0 : { *(.debug_abbrev) }
315 .debug_line 0 : { *(.debug_line) }
316 .debug_frame 0 : { *(.debug_frame) }
317 .debug_str 0 : { *(.debug_str) }
318 .debug_loc 0 : { *(.debug_loc) }
319 .debug_macinfo 0 : { *(.debug_macinfo) }
320 .debug_weaknames 0 : { *(.debug_weaknames) }
321 .debug_funcnames 0 : { *(.debug_funcnames) }
322 .debug_typenames 0 : { *(.debug_typenames) }
323 .debug_varnames 0 : { *(.debug_varnames) }
324
325 .xt.insn 0 :
326 {
327 *(.xt.insn)
328 *(.gnu.linkonce.x*)
329 }
330
331 .xt.lit 0 :
332 {
333 *(.xt.lit)
334 *(.gnu.linkonce.p*)
335 }
336
337 /* Sections to be discarded */
338 DISCARDS
339 /DISCARD/ : { *(.exit.literal) }
340 }
This page took 0.039303 seconds and 5 git commands to generate.