Merge branches 'at91', 'dcache', 'ftrace', 'hwbpt', 'misc', 'mmci', 's3c', 'st-ux...
[pandora-kernel.git] / arch / arm / kernel / vmlinux.lds.S
1 /* ld script to make ARM Linux kernel
2  * taken from the i386 version by Russell King
3  * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
4  */
5
6 #include <asm-generic/vmlinux.lds.h>
7 #include <asm/thread_info.h>
8 #include <asm/memory.h>
9 #include <asm/page.h>
10         
11 OUTPUT_ARCH(arm)
12 ENTRY(stext)
13
14 #ifndef __ARMEB__
15 jiffies = jiffies_64;
16 #else
17 jiffies = jiffies_64 + 4;
18 #endif
19
20 SECTIONS
21 {
22 #ifdef CONFIG_XIP_KERNEL
23         . = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR);
24 #else
25         . = PAGE_OFFSET + TEXT_OFFSET;
26 #endif
27
28         .init : {                       /* Init code and data           */
29                 _stext = .;
30                 _sinittext = .;
31                         HEAD_TEXT
32                         INIT_TEXT
33                 _einittext = .;
34                 __proc_info_begin = .;
35                         *(.proc.info.init)
36                 __proc_info_end = .;
37                 __arch_info_begin = .;
38                         *(.arch.info.init)
39                 __arch_info_end = .;
40                 __tagtable_begin = .;
41                         *(.taglist.init)
42                 __tagtable_end = .;
43 #ifdef CONFIG_SMP_ON_UP
44                 __smpalt_begin = .;
45                         *(.alt.smp.init)
46                 __smpalt_end = .;
47 #endif
48
49                 INIT_SETUP(16)
50
51                 INIT_CALLS
52                 CON_INITCALL
53                 SECURITY_INITCALL
54                 INIT_RAM_FS
55
56 #ifndef CONFIG_XIP_KERNEL
57                 __init_begin = _stext;
58                 INIT_DATA
59 #endif
60         }
61
62         PERCPU(PAGE_SIZE)
63
64 #ifndef CONFIG_XIP_KERNEL
65         . = ALIGN(PAGE_SIZE);
66         __init_end = .;
67 #endif
68
69         /*
70          * unwind exit sections must be discarded before the rest of the
71          * unwind sections get included.
72          */
73         /DISCARD/ : {
74                 *(.ARM.exidx.exit.text)
75                 *(.ARM.extab.exit.text)
76 #ifndef CONFIG_HOTPLUG_CPU
77                 *(.ARM.exidx.cpuexit.text)
78                 *(.ARM.extab.cpuexit.text)
79 #endif
80 #ifndef CONFIG_HOTPLUG
81                 *(.ARM.exidx.devexit.text)
82                 *(.ARM.extab.devexit.text)
83 #endif
84 #ifndef CONFIG_MMU
85                 *(.fixup)
86                 *(__ex_table)
87 #endif
88         }
89
90         .text : {                       /* Real text segment            */
91                 _text = .;              /* Text and read-only data      */
92                         __exception_text_start = .;
93                         *(.exception.text)
94                         __exception_text_end = .;
95                         TEXT_TEXT
96                         SCHED_TEXT
97                         LOCK_TEXT
98                         KPROBES_TEXT
99 #ifdef CONFIG_MMU
100                         *(.fixup)
101 #endif
102                         *(.gnu.warning)
103                         *(.rodata)
104                         *(.rodata.*)
105                         *(.glue_7)
106                         *(.glue_7t)
107                 *(.got)                 /* Global offset table          */
108         }
109
110         RO_DATA(PAGE_SIZE)
111
112 #ifdef CONFIG_ARM_UNWIND
113         /*
114          * Stack unwinding tables
115          */
116         . = ALIGN(8);
117         .ARM.unwind_idx : {
118                 __start_unwind_idx = .;
119                 *(.ARM.exidx*)
120                 __stop_unwind_idx = .;
121         }
122         .ARM.unwind_tab : {
123                 __start_unwind_tab = .;
124                 *(.ARM.extab*)
125                 __stop_unwind_tab = .;
126         }
127 #endif
128
129         _etext = .;                     /* End of text and rodata section */
130
131 #ifdef CONFIG_XIP_KERNEL
132         __data_loc = ALIGN(4);          /* location in binary */
133         . = PAGE_OFFSET + TEXT_OFFSET;
134 #else
135         . = ALIGN(THREAD_SIZE);
136         __data_loc = .;
137 #endif
138
139         .data : AT(__data_loc) {
140                 _data = .;              /* address in memory */
141                 _sdata = .;
142
143                 /*
144                  * first, the init task union, aligned
145                  * to an 8192 byte boundary.
146                  */
147                 INIT_TASK_DATA(THREAD_SIZE)
148
149 #ifdef CONFIG_XIP_KERNEL
150                 . = ALIGN(PAGE_SIZE);
151                 __init_begin = .;
152                 INIT_DATA
153                 . = ALIGN(PAGE_SIZE);
154                 __init_end = .;
155 #endif
156
157                 NOSAVE_DATA
158                 CACHELINE_ALIGNED_DATA(32)
159
160                 /*
161                  * The exception fixup table (might need resorting at runtime)
162                  */
163                 . = ALIGN(32);
164                 __start___ex_table = .;
165 #ifdef CONFIG_MMU
166                 *(__ex_table)
167 #endif
168                 __stop___ex_table = .;
169
170                 /*
171                  * and the usual data section
172                  */
173                 DATA_DATA
174                 CONSTRUCTORS
175
176                 _edata = .;
177         }
178         _edata_loc = __data_loc + SIZEOF(.data);
179
180 #ifdef CONFIG_HAVE_TCM
181         /*
182          * We align everything to a page boundary so we can
183          * free it after init has commenced and TCM contents have
184          * been copied to its destination.
185          */
186         .tcm_start : {
187                 . = ALIGN(PAGE_SIZE);
188                 __tcm_start = .;
189                 __itcm_start = .;
190         }
191
192         /*
193          * Link these to the ITCM RAM
194          * Put VMA to the TCM address and LMA to the common RAM
195          * and we'll upload the contents from RAM to TCM and free
196          * the used RAM after that.
197          */
198         .text_itcm ITCM_OFFSET : AT(__itcm_start)
199         {
200                 __sitcm_text = .;
201                 *(.tcm.text)
202                 *(.tcm.rodata)
203                 . = ALIGN(4);
204                 __eitcm_text = .;
205         }
206
207         /*
208          * Reset the dot pointer, this is needed to create the
209          * relative __dtcm_start below (to be used as extern in code).
210          */
211         . = ADDR(.tcm_start) + SIZEOF(.tcm_start) + SIZEOF(.text_itcm);
212
213         .dtcm_start : {
214                 __dtcm_start = .;
215         }
216
217         /* TODO: add remainder of ITCM as well, that can be used for data! */
218         .data_dtcm DTCM_OFFSET : AT(__dtcm_start)
219         {
220                 . = ALIGN(4);
221                 __sdtcm_data = .;
222                 *(.tcm.data)
223                 . = ALIGN(4);
224                 __edtcm_data = .;
225         }
226
227         /* Reset the dot pointer or the linker gets confused */
228         . = ADDR(.dtcm_start) + SIZEOF(.data_dtcm);
229
230         /* End marker for freeing TCM copy in linked object */
231         .tcm_end : AT(ADDR(.dtcm_start) + SIZEOF(.data_dtcm)){
232                 . = ALIGN(PAGE_SIZE);
233                 __tcm_end = .;
234         }
235 #endif
236
237         BSS_SECTION(0, 0, 0)
238         _end = .;
239
240         STABS_DEBUG
241         .comment 0 : { *(.comment) }
242
243         /* Default discards */
244         DISCARDS
245
246 #ifndef CONFIG_SMP_ON_UP
247         /DISCARD/ : {
248                 *(.alt.smp.init)
249         }
250 #endif
251 }
252
253 /*
254  * These must never be empty
255  * If you have to comment these two assert statements out, your
256  * binutils is too old (for other reasons as well)
257  */
258 ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support")
259 ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")