Merge branch 'master'
[linux-2.6/verdex.git] / arch / xtensa / kernel / vmlinux.lds.S
blob5ed71dfc81105c5ecf2836db2e34b8884dcf4a1c
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 <linux/config.h>
20 #define _NOCLANGUAGE
21 #include <xtensa/config/core.h>
22 #include <xtensa/config/system.h>
23 OUTPUT_ARCH(xtensa)
24 ENTRY(_start)
26 #if XCHAL_MEMORY_ORDER == XTHAL_BIGENDIAN
27 jiffies = jiffies_64 + 4;
28 #else
29 jiffies = jiffies_64;
30 #endif
32 #define KERNELOFFSET 0x1000
34 /* Note: In the following macros, it would be nice to specify only the
35    vector name and section kind and construct "sym" and "section" using
36    CPP concatenation, but that does not work reliably.  Concatenating a
37    string with "." produces an invalid token.  CPP will not print a
38    warning because it thinks this is an assembly file, but it leaves
39    them as multiple tokens and there may or may not be whitespace
40    between them.  */
42 /* Macro for a relocation entry */
44 #define RELOCATE_ENTRY(sym, section)            \
45         LONG(sym ## _start);                    \
46         LONG(sym ## _end);                      \
47         LONG(LOADADDR(section))
49 /* Macro to define a section for a vector.
50  *
51  * Use of the MIN function catches the types of errors illustrated in
52  * the following example:
53  *
54  * Assume the section .DoubleExceptionVector.literal is completely
55  * full.  Then a programmer adds code to .DoubleExceptionVector.text
56  * that produces another literal.  The final literal position will
57  * overlay onto the first word of the adjacent code section
58  * .DoubleExceptionVector.text.  (In practice, the literals will
59  * overwrite the code, and the first few instructions will be
60  * garbage.)
61  */
63 #define SECTION_VECTOR(sym, section, addr, max_prevsec_size, prevsec)       \
64   section addr : AT((MIN(LOADADDR(prevsec) + max_prevsec_size,              \
65                          LOADADDR(prevsec) + SIZEOF(prevsec)) + 3) & ~ 3)   \
66   {                                                                         \
67     . = ALIGN(4);                                                           \
68     sym ## _start = ABSOLUTE(.);                                            \
69     *(section)                                                              \
70     sym ## _end = ABSOLUTE(.);                                              \
71   }
74  *  Mapping of input sections to output sections when linking.
75  */
77 SECTIONS
79   . = XCHAL_KSEG_CACHED_VADDR + KERNELOFFSET;
80   /* .text section */
82   _text = .;
83   _stext = .;
84   _ftext = .;
86   .text :
87   {
88     /* The .head.text section must be the first section! */
89     *(.head.text)
90     *(.literal .text)
91     *(.srom.text)
92     VMLINUX_SYMBOL(__sched_text_start) = .;
93     *(.sched.literal .sched.text)
94     VMLINUX_SYMBOL(__sched_text_end) = .;
95     VMLINUX_SYMBOL(__lock_text_start) = .;
96     *(.spinlock.literal .spinlock.text)
97     VMLINUX_SYMBOL(__lock_text_end) = .;
99   }
100   _etext = .;
102   . = ALIGN(16);
104   RODATA
106   /*  Relocation table */
108   . = ALIGN(16);
109   __boot_reloc_table_start = ABSOLUTE(.);
111   __relocate : {
113     RELOCATE_ENTRY(_WindowVectors_text,
114                    .WindowVectors.text);
115 #if 0
116     RELOCATE_ENTRY(_KernelExceptionVector_literal,
117                    .KernelExceptionVector.literal);
118 #endif
119     RELOCATE_ENTRY(_KernelExceptionVector_text,
120                    .KernelExceptionVector.text);
121 #if 0
122     RELOCATE_ENTRY(_UserExceptionVector_literal,
123                    .UserExceptionVector.literal);
124 #endif
125     RELOCATE_ENTRY(_UserExceptionVector_text,
126                    .UserExceptionVector.text);
127     RELOCATE_ENTRY(_DoubleExceptionVector_literal,
128                    .DoubleExceptionVector.literal);
129     RELOCATE_ENTRY(_DoubleExceptionVector_text,
130                    .DoubleExceptionVector.text);
131   }
132   __boot_reloc_table_end = ABSOLUTE(.) ;
134   .fixup   : { *(.fixup) }
136   . = ALIGN(16);
138   __ex_table : {
139     __start___ex_table = .;
140     *(__ex_table)
141     __stop___ex_table = .;
142   }
144   /* Data section */
146   . = ALIGN(XCHAL_ICACHE_LINESIZE);
147   _fdata = .;
148   .data :
149   {
150     *(.data) CONSTRUCTORS
151     . = ALIGN(XCHAL_ICACHE_LINESIZE);
152     *(.data.cacheline_aligned)
153   }
155   _edata = .;
157   /* The initial task */
158   . = ALIGN(8192);
159   .data.init_task : { *(.data.init_task) }
161   /* Initialization code and data: */
163   . = ALIGN(1<<XCHAL_MMU_MIN_PTE_PAGE_SIZE);
164   __init_begin = .;
165   .init.text : {
166         _sinittext = .;
167         *(.init.literal) *(.init.text)
168         _einittext = .;
169   }
171   .init.data :
172   {
173     *(.init.data)
174     . = ALIGN(0x4);
175     __tagtable_begin = .;
176     *(.taglist)
177     __tagtable_end = .;
178   }
180   . = ALIGN(XCHAL_ICACHE_LINESIZE);
182   __setup_start = .;
183   .init.setup : { *(.init.setup) }
184   __setup_end = .;
186   __initcall_start = .;
187   .initcall.init : {
188         *(.initcall1.init)
189         *(.initcall2.init)
190         *(.initcall3.init)
191         *(.initcall4.init)
192         *(.initcall5.init)
193         *(.initcall6.init)
194         *(.initcall7.init)
195   }
196   __initcall_end = .;
198   __con_initcall_start = .;
199   .con_initcall.init : { *(.con_initcall.init) }
200   __con_initcall_end = .;
202   SECURITY_INIT
204   . = ALIGN(4);
206   __start___ftr_fixup = .;
207   __ftr_fixup : { *(__ftr_fixup) }
208   __stop___ftr_fixup = .;
210   . = ALIGN(32);
211   __per_cpu_start = .;
212   .data.percpu  : { *(.data.percpu) }
213   __per_cpu_end = .;
215   . = ALIGN(4096);
216   __initramfs_start =.;
217   .init.ramfs : { *(.init.ramfs) }
218   __initramfs_end = .;
220   /* We need this dummy segment here */
222   . = ALIGN(4);
223   .dummy : { LONG(0) }
225   /* The vectors are relocated to the real position at startup time */
227   SECTION_VECTOR (_WindowVectors_text,
228                   .WindowVectors.text,
229                   XCHAL_WINDOW_VECTORS_VADDR, 4,
230                   .dummy)
231   SECTION_VECTOR (_DebugInterruptVector_literal,
232                   .DebugInterruptVector.literal,
233                   XCHAL_INTLEVEL_VECTOR_VADDR(XCHAL_DEBUGLEVEL) - 4,
234                   SIZEOF(.WindowVectors.text),
235                   .WindowVectors.text)
236   SECTION_VECTOR (_DebugInterruptVector_text,
237                   .DebugInterruptVector.text,
238                   XCHAL_INTLEVEL_VECTOR_VADDR(XCHAL_DEBUGLEVEL),
239                   4,
240                   .DebugInterruptVector.literal)
241   SECTION_VECTOR (_KernelExceptionVector_literal,
242                   .KernelExceptionVector.literal,
243                   XCHAL_KERNELEXC_VECTOR_VADDR - 4,
244                   SIZEOF(.DebugInterruptVector.text),
245                   .DebugInterruptVector.text)
246   SECTION_VECTOR (_KernelExceptionVector_text,
247                   .KernelExceptionVector.text,
248                   XCHAL_KERNELEXC_VECTOR_VADDR,
249                   4,
250                   .KernelExceptionVector.literal)
251   SECTION_VECTOR (_UserExceptionVector_literal,
252                   .UserExceptionVector.literal,
253                   XCHAL_USEREXC_VECTOR_VADDR - 4,
254                   SIZEOF(.KernelExceptionVector.text),
255                   .KernelExceptionVector.text)
256   SECTION_VECTOR (_UserExceptionVector_text,
257                   .UserExceptionVector.text,
258                   XCHAL_USEREXC_VECTOR_VADDR,
259                   4,
260                   .UserExceptionVector.literal)
261   SECTION_VECTOR (_DoubleExceptionVector_literal,
262                   .DoubleExceptionVector.literal,
263                   XCHAL_DOUBLEEXC_VECTOR_VADDR - 16,
264                   SIZEOF(.UserExceptionVector.text),
265                   .UserExceptionVector.text)
266   SECTION_VECTOR (_DoubleExceptionVector_text,
267                   .DoubleExceptionVector.text,
268                   XCHAL_DOUBLEEXC_VECTOR_VADDR,
269                   32,
270                   .DoubleExceptionVector.literal)
272   . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3;
273   . = ALIGN(1<<XCHAL_MMU_MIN_PTE_PAGE_SIZE);
275   __init_end = .;
277   . = ALIGN(8192);
279   /* BSS section */
280   _bss_start = .;
281   .sbss : { *(.sbss) *(.scommon) }
282   .bss : { *(COMMON) *(.bss) }
283   _bss_end = .;
284   _end = .;
286   /* only used by the boot loader  */
288   . = ALIGN(0x10);
289   .bootstrap : { *(.bootstrap.literal .bootstrap.text .bootstrap.data) }
291   . = ALIGN(0x1000);
292   __initrd_start = .;
293   .initrd : { *(.initrd) }
294   __initrd_end = .;
296   .ResetVector.text XCHAL_RESET_VECTOR_VADDR :
297   {
298     *(.ResetVector.text)
299   }
302   /* Sections to be discarded */
303   /DISCARD/ :
304   {
305         *(.text.exit)
306         *(.text.exit.literal)
307         *(.data.exit)
308         *(.exitcall.exit)
309   }
312   .debug  0 :  { *(.debug) }
313   .line  0 :  { *(.line) }
314   .debug_srcinfo  0 :  { *(.debug_srcinfo) }
315   .debug_sfnames  0 :  { *(.debug_sfnames) }
316   .debug_aranges  0 :  { *(.debug_aranges) }
317   .debug_pubnames  0 :  { *(.debug_pubnames) }
318   .debug_info  0 :  { *(.debug_info) }
319   .debug_abbrev  0 :  { *(.debug_abbrev) }
320   .debug_line  0 :  { *(.debug_line) }
321   .debug_frame  0 :  { *(.debug_frame) }
322   .debug_str  0 :  { *(.debug_str) }
323   .debug_loc  0 :  { *(.debug_loc) }
324   .debug_macinfo  0 :  { *(.debug_macinfo) }
325   .debug_weaknames  0 :  { *(.debug_weaknames) }
326   .debug_funcnames  0 :  { *(.debug_funcnames) }
327   .debug_typenames  0 :  { *(.debug_typenames) }
328   .debug_varnames  0 :  { *(.debug_varnames) }
330   .xt.insn 0 :
331   {
332     *(.xt.insn)
333     *(.gnu.linkonce.x*)
334   }
336   .xt.lit 0 :
337   {
338     *(.xt.lit)
339     *(.gnu.linkonce.p*)
340   }