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