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