Linux 2.6.22.3
[linux-2.6.22.y-op.git] / arch / xtensa / kernel / vmlinux.lds.S
blobb0582c3c5f8da9dad2f43eb5b9d81ca9a14cbfb0
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 - 2005 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  */
17 #include <asm-generic/vmlinux.lds.h>
19 #include <asm/variant/core.h>
20 OUTPUT_ARCH(xtensa)
21 ENTRY(_start)
23 #ifdef __XTENSA_EB__
24 jiffies = jiffies_64 + 4;
25 #else
26 jiffies = jiffies_64;
27 #endif
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
37    between them.  */
39 /* Macro for a relocation entry */
41 #define RELOCATE_ENTRY(sym, section)            \
42         LONG(sym ## _start);                    \
43         LONG(sym ## _end);                      \
44         LONG(LOADADDR(section))
46 /* Macro to define a section for a vector.
47  *
48  * Use of the MIN function catches the types of errors illustrated in
49  * the following example:
50  *
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
57  * garbage.)
58  */
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)   \
63   {                                                                         \
64     . = ALIGN(4);                                                           \
65     sym ## _start = ABSOLUTE(.);                                            \
66     *(section)                                                              \
67     sym ## _end = ABSOLUTE(.);                                              \
68   }
71  *  Mapping of input sections to output sections when linking.
72  */
74 SECTIONS
76   . = KERNELOFFSET;
77   /* .text section */
79   _text = .;
80   _stext = .;
81   _ftext = .;
83   .text :
84   {
85     /* The .head.text section must be the first section! */
86     *(.head.text)
87     *(.literal .text)
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) = .;
95   }
96   _etext = .;
97   PROVIDE (etext = .);
99   . = ALIGN(16);
101   RODATA
103   /*  Relocation table */
105   .fixup   : { *(.fixup) }
107   . = ALIGN(16);
109   __ex_table : {
110     __start___ex_table = .;
111     *(__ex_table)
112     __stop___ex_table = .;
113   }
115   /* Data section */
117   . = ALIGN(XCHAL_ICACHE_LINESIZE);
118   _fdata = .;
119   .data :
120   {
121     *(.data) CONSTRUCTORS
122     . = ALIGN(XCHAL_ICACHE_LINESIZE);
123     *(.data.cacheline_aligned)
124   }
126   _edata = .;
128   /* The initial task */
129   . = ALIGN(8192);
130   .data.init_task : { *(.data.init_task) }
132   /* Initialization code and data: */
134   . = ALIGN(1 << 12);
135   __init_begin = .;
136   .init.text : {
137         _sinittext = .;
138         *(.init.literal) *(.init.text)
139         _einittext = .;
140   }
142   .init.data :
143   {
144     *(.init.data)
145     . = ALIGN(0x4);
146     __tagtable_begin = .;
147     *(.taglist)
148     __tagtable_end = .;
150     . = ALIGN(16);
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);
163   
164     __boot_reloc_table_end = ABSOLUTE(.) ;
165   }
167   . = ALIGN(XCHAL_ICACHE_LINESIZE);
169   __setup_start = .;
170   .init.setup : { *(.init.setup) }
171   __setup_end = .;
173   __initcall_start = .;
174   .initcall.init : {
175         INITCALLS
176   }
177   __initcall_end = .;
179   __con_initcall_start = .;
180   .con_initcall.init : { *(.con_initcall.init) }
181   __con_initcall_end = .;
183   SECURITY_INIT
186 #ifdef CONFIG_BLK_DEV_INITRD
187   . = ALIGN(4096);
188   __initramfs_start =.;
189   .init.ramfs : { *(.init.ramfs) }
190   __initramfs_end = .;
191 #endif
193   . = ALIGN(4096);
194   __per_cpu_start = .;
195   .data.percpu  : { *(.data.percpu) }
196   __per_cpu_end = .;
199   /* We need this dummy segment here */
201   . = ALIGN(4);
202   .dummy : { LONG(0) }
204   /* The vectors are relocated to the real position at startup time */
206   SECTION_VECTOR (_WindowVectors_text,
207                   .WindowVectors.text,
208                   XCHAL_WINDOW_VECTORS_VADDR, 4,
209                   .dummy)
210   SECTION_VECTOR (_DebugInterruptVector_literal,
211                   .DebugInterruptVector.literal,
212                   XCHAL_DEBUG_VECTOR_VADDR - 4,
213                   SIZEOF(.WindowVectors.text),
214                   .WindowVectors.text)
215   SECTION_VECTOR (_DebugInterruptVector_text,
216                   .DebugInterruptVector.text,
217                   XCHAL_DEBUG_VECTOR_VADDR,
218                   4,
219                   .DebugInterruptVector.literal)
220   SECTION_VECTOR (_KernelExceptionVector_literal,
221                   .KernelExceptionVector.literal,
222                   XCHAL_KERNEL_VECTOR_VADDR - 4,
223                   SIZEOF(.DebugInterruptVector.text),
224                   .DebugInterruptVector.text)
225   SECTION_VECTOR (_KernelExceptionVector_text,
226                   .KernelExceptionVector.text,
227                   XCHAL_KERNEL_VECTOR_VADDR,
228                   4,
229                   .KernelExceptionVector.literal)
230   SECTION_VECTOR (_UserExceptionVector_literal,
231                   .UserExceptionVector.literal,
232                   XCHAL_USER_VECTOR_VADDR - 4,
233                   SIZEOF(.KernelExceptionVector.text),
234                   .KernelExceptionVector.text)
235   SECTION_VECTOR (_UserExceptionVector_text,
236                   .UserExceptionVector.text,
237                   XCHAL_USER_VECTOR_VADDR,
238                   4,
239                   .UserExceptionVector.literal)
240   SECTION_VECTOR (_DoubleExceptionVector_literal,
241                   .DoubleExceptionVector.literal,
242                   XCHAL_DOUBLEEXC_VECTOR_VADDR - 16,
243                   SIZEOF(.UserExceptionVector.text),
244                   .UserExceptionVector.text)
245   SECTION_VECTOR (_DoubleExceptionVector_text,
246                   .DoubleExceptionVector.text,
247                   XCHAL_DOUBLEEXC_VECTOR_VADDR,
248                   32,
249                   .DoubleExceptionVector.literal)
251   . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3;
252   . = ALIGN(1 << 12);
254   __init_end = .;
256   . = ALIGN(8192);
258   /* BSS section */
259   _bss_start = .;
260   .bss : { *(.bss.page_aligned) *(.bss) }
261   _bss_end = .;
263   _end = .;
265   /* only used by the boot loader  */
267   . = ALIGN(0x10);
268   .bootstrap : { *(.bootstrap.literal .bootstrap.text .bootstrap.data) }
270   . = ALIGN(0x1000);
271   __initrd_start = .;
272   .initrd : { *(.initrd) }
273   __initrd_end = .;
275   .ResetVector.text XCHAL_RESET_VECTOR_VADDR :
276   {
277     *(.ResetVector.text)
278   }
280   /* Sections to be discarded */
281   /DISCARD/ :
282   {
283         *(.exit.literal .exit.text)
284         *(.exit.data)
285         *(.exitcall.exit)
286   }
288   .xt.lit : { *(.xt.lit) }
289   .xt.prop : { *(.xt.prop) }
291   .debug  0 :  { *(.debug) }
292   .line  0 :  { *(.line) }
293   .debug_srcinfo  0 :  { *(.debug_srcinfo) }
294   .debug_sfnames  0 :  { *(.debug_sfnames) }
295   .debug_aranges  0 :  { *(.debug_aranges) }
296   .debug_pubnames  0 :  { *(.debug_pubnames) }
297   .debug_info  0 :  { *(.debug_info) }
298   .debug_abbrev  0 :  { *(.debug_abbrev) }
299   .debug_line  0 :  { *(.debug_line) }
300   .debug_frame  0 :  { *(.debug_frame) }
301   .debug_str  0 :  { *(.debug_str) }
302   .debug_loc  0 :  { *(.debug_loc) }
303   .debug_macinfo  0 :  { *(.debug_macinfo) }
304   .debug_weaknames  0 :  { *(.debug_weaknames) }
305   .debug_funcnames  0 :  { *(.debug_funcnames) }
306   .debug_typenames  0 :  { *(.debug_typenames) }
307   .debug_varnames  0 :  { *(.debug_varnames) }
309   .xt.insn 0 :
310   {
311     *(.xt.insn)
312     *(.gnu.linkonce.x*)
313   }
315   .xt.lit 0 :
316   {
317     *(.xt.lit)
318     *(.gnu.linkonce.p*)
319   }