1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup bsp_linker |
---|
5 | * |
---|
6 | * @brief Linker command base file. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Copyright (c) 2011-2012 embedded brains GmbH. All rights reserved. |
---|
11 | * |
---|
12 | * embedded brains GmbH |
---|
13 | * Obere Lagerstr. 30 |
---|
14 | * 82178 Puchheim |
---|
15 | * Germany |
---|
16 | * <rtems@embedded-brains.de> |
---|
17 | * |
---|
18 | * The license and distribution terms for this file may be |
---|
19 | * found in the file LICENSE in this distribution or at |
---|
20 | * http://www.rtems.com/license/LICENSE. |
---|
21 | */ |
---|
22 | |
---|
23 | OUTPUT_FORMAT ("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") |
---|
24 | |
---|
25 | OUTPUT_ARCH (powerpc:common) |
---|
26 | |
---|
27 | ENTRY (_start) |
---|
28 | |
---|
29 | /* |
---|
30 | * Global symbols that may be defined externally |
---|
31 | */ |
---|
32 | |
---|
33 | bsp_section_xbarrier_align = DEFINED (bsp_section_xbarrier_align) ? bsp_section_xbarrier_align : 1; |
---|
34 | bsp_section_robarrier_align = DEFINED (bsp_section_robarrier_align) ? bsp_section_robarrier_align : 1; |
---|
35 | bsp_section_rwbarrier_align = DEFINED (bsp_section_rwbarrier_align) ? bsp_section_rwbarrier_align : 1; |
---|
36 | |
---|
37 | MEMORY { |
---|
38 | UNEXPECTED_SECTIONS : ORIGIN = 0xffffffff, LENGTH = 0 |
---|
39 | } |
---|
40 | |
---|
41 | SECTIONS { |
---|
42 | .start : { |
---|
43 | bsp_section_start_begin = .; |
---|
44 | KEEP (*(.bsp_start_text)) |
---|
45 | KEEP (*(.bsp_start_data)) |
---|
46 | bsp_section_start_end = .; |
---|
47 | } > REGION_START AT > REGION_START |
---|
48 | bsp_section_start_size = bsp_section_start_end - bsp_section_start_begin; |
---|
49 | |
---|
50 | .xbarrier : { |
---|
51 | . = ALIGN (bsp_section_xbarrier_align); |
---|
52 | } > REGION_TEXT |
---|
53 | |
---|
54 | .fast_text : { |
---|
55 | bsp_section_fast_text_begin = .; |
---|
56 | *(.bsp_fast_text) |
---|
57 | bsp_section_fast_text_end = .; |
---|
58 | } > REGION_FAST_TEXT AT > REGION_FAST_TEXT_LOAD |
---|
59 | bsp_section_fast_text_size = bsp_section_fast_text_end - bsp_section_fast_text_begin; |
---|
60 | bsp_section_fast_text_load_begin = LOADADDR (.fast_text); |
---|
61 | bsp_section_fast_text_load_end = bsp_section_fast_text_load_begin + bsp_section_fast_text_size; |
---|
62 | |
---|
63 | .text : { |
---|
64 | bsp_section_text_begin = .; |
---|
65 | *(.text.unlikely .text.*_unlikely) |
---|
66 | *(.text .stub .text.* .gnu.linkonce.t.*) |
---|
67 | *(.gnu.warning) |
---|
68 | *(.glink) |
---|
69 | } > REGION_TEXT AT > REGION_TEXT_LOAD |
---|
70 | .init : { |
---|
71 | KEEP (*(.init)) |
---|
72 | } > REGION_TEXT AT > REGION_TEXT_LOAD |
---|
73 | .fini : { |
---|
74 | PROVIDE (_fini = .); |
---|
75 | KEEP (*(.fini)) |
---|
76 | bsp_section_text_end = .; |
---|
77 | } > REGION_TEXT AT > REGION_TEXT_LOAD |
---|
78 | bsp_section_text_size = bsp_section_text_end - bsp_section_text_begin; |
---|
79 | bsp_section_text_load_begin = LOADADDR (.text); |
---|
80 | bsp_section_text_load_end = bsp_section_text_load_begin + bsp_section_text_size; |
---|
81 | |
---|
82 | .robarrier : { |
---|
83 | . = ALIGN (bsp_section_robarrier_align); |
---|
84 | } > REGION_RODATA |
---|
85 | |
---|
86 | .rodata : { |
---|
87 | bsp_section_rodata_begin = .; |
---|
88 | *(SORT(.bsp_rodata*)) |
---|
89 | *(.rodata .rodata.* .gnu.linkonce.r.*) |
---|
90 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
91 | .rodata1 : { |
---|
92 | *(.rodata1) |
---|
93 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
94 | .sdata2 : { |
---|
95 | PROVIDE (_SDA2_BASE_ = 32768); |
---|
96 | *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) |
---|
97 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
98 | .sbss2 : { |
---|
99 | *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) |
---|
100 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
101 | .eh_frame_hdr : { |
---|
102 | *(.eh_frame_hdr) |
---|
103 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
104 | .eh_frame : { |
---|
105 | KEEP (*(.eh_frame)) |
---|
106 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
107 | .gcc_except_table : { |
---|
108 | *(.gcc_except_table .gcc_except_table.*) |
---|
109 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
110 | .tdata : { |
---|
111 | *(.tdata .tdata.* .gnu.linkonce.td.*) |
---|
112 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
113 | .tbss : { |
---|
114 | *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) |
---|
115 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
116 | .preinit_array : { |
---|
117 | PROVIDE_HIDDEN (__preinit_array_start = .); |
---|
118 | KEEP (*(.preinit_array)) |
---|
119 | PROVIDE_HIDDEN (__preinit_array_end = .); |
---|
120 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
121 | .init_array : { |
---|
122 | PROVIDE_HIDDEN (__init_array_start = .); |
---|
123 | KEEP (*(SORT(.init_array.*))) |
---|
124 | KEEP (*(.init_array)) |
---|
125 | PROVIDE_HIDDEN (__init_array_end = .); |
---|
126 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
127 | .fini_array : { |
---|
128 | PROVIDE_HIDDEN (__fini_array_start = .); |
---|
129 | KEEP (*(SORT(.fini_array.*))) |
---|
130 | KEEP (*(.fini_array)) |
---|
131 | PROVIDE_HIDDEN (__fini_array_end = .); |
---|
132 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
133 | .ctors : { |
---|
134 | KEEP (*crtbegin.o(.ctors)) |
---|
135 | KEEP (*crtbegin?.o(.ctors)) |
---|
136 | KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) |
---|
137 | KEEP (*(SORT(.ctors.*))) |
---|
138 | KEEP (*(.ctors)) |
---|
139 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
140 | .dtors : { |
---|
141 | KEEP (*crtbegin.o(.dtors)) |
---|
142 | KEEP (*crtbegin?.o(.dtors)) |
---|
143 | KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) |
---|
144 | KEEP (*(SORT(.dtors.*))) |
---|
145 | KEEP (*(.dtors)) |
---|
146 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
147 | .jcr : { |
---|
148 | KEEP (*(.jcr)) |
---|
149 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
150 | .data.rel.ro : { |
---|
151 | *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) |
---|
152 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
153 | .fixup : { |
---|
154 | *(.fixup) |
---|
155 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
156 | .dynamic : { |
---|
157 | *(.dynamic) |
---|
158 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
159 | .got1 : { |
---|
160 | *(.got1) |
---|
161 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
162 | .got2 : { |
---|
163 | *(.got2) |
---|
164 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
165 | .got : { |
---|
166 | *(.got) |
---|
167 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
168 | .plt : { |
---|
169 | *(.plt) |
---|
170 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
171 | .iplt : { |
---|
172 | *(.iplt) |
---|
173 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
174 | .interp : { |
---|
175 | *(.interp) |
---|
176 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
177 | .note.gnu.build-id : { |
---|
178 | *(.note.gnu.build-id) |
---|
179 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
180 | .hash : { |
---|
181 | *(.hash) |
---|
182 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
183 | .gnu.hash : { |
---|
184 | *(.gnu.hash) |
---|
185 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
186 | .dynsym : { |
---|
187 | *(.dynsym) |
---|
188 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
189 | .dynstr : { |
---|
190 | *(.dynstr) |
---|
191 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
192 | .gnu.version : { |
---|
193 | *(.gnu.version) |
---|
194 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
195 | .gnu.version_d : { |
---|
196 | *(.gnu.version_d) |
---|
197 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
198 | .gnu.version_r : { |
---|
199 | *(.gnu.version_r) |
---|
200 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
201 | .rela.dyn : { |
---|
202 | *(.rela.init) |
---|
203 | *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) |
---|
204 | *(.rela.fini) |
---|
205 | *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) |
---|
206 | *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) |
---|
207 | *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) |
---|
208 | *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) |
---|
209 | *(.rela.ctors) |
---|
210 | *(.rela.dtors) |
---|
211 | *(.rela.got) |
---|
212 | *(.rela.got1) |
---|
213 | *(.rela.got2) |
---|
214 | *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) |
---|
215 | *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) |
---|
216 | *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) |
---|
217 | *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) |
---|
218 | *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) |
---|
219 | PROVIDE_HIDDEN (__rel_iplt_start = .); |
---|
220 | PROVIDE_HIDDEN (__rel_iplt_end = .); |
---|
221 | PROVIDE_HIDDEN (__rela_iplt_start = .); |
---|
222 | *(.rela.iplt) |
---|
223 | PROVIDE_HIDDEN (__rela_iplt_end = .); |
---|
224 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
225 | .rela.plt : { |
---|
226 | *(.rela.plt) |
---|
227 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
228 | .robsdsets : { |
---|
229 | /* Special FreeBSD linker set sections */ |
---|
230 | __start_set_sysctl_set = .; |
---|
231 | *(set_sysctl_*); |
---|
232 | __stop_set_sysctl_set = .; |
---|
233 | *(set_domain_*); |
---|
234 | *(set_pseudo_*); |
---|
235 | _bsd__start_set_modmetadata_set = .; |
---|
236 | *(_bsd_set_modmetadata_set); |
---|
237 | _bsd__stop_set_modmetadata_set = .; |
---|
238 | _bsd__start_set_sysctl_set = .; |
---|
239 | *(_bsd_set_sysctl_set); |
---|
240 | _bsd__stop_set_sysctl_set = .; |
---|
241 | |
---|
242 | bsp_section_rodata_end = .; |
---|
243 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
244 | bsp_section_rodata_size = bsp_section_rodata_end - bsp_section_rodata_begin; |
---|
245 | bsp_section_rodata_load_begin = LOADADDR (.rodata); |
---|
246 | bsp_section_rodata_load_end = bsp_section_rodata_load_begin + bsp_section_rodata_size; |
---|
247 | |
---|
248 | .rwbarrier : { |
---|
249 | . = ALIGN (bsp_section_rwbarrier_align); |
---|
250 | } > REGION_DATA |
---|
251 | |
---|
252 | .fast_data : { |
---|
253 | bsp_section_fast_data_begin = .; |
---|
254 | *(SORT(.bsp_fast_data*)) |
---|
255 | bsp_section_fast_data_end = .; |
---|
256 | } > REGION_FAST_DATA AT > REGION_FAST_DATA_LOAD |
---|
257 | bsp_section_fast_data_size = bsp_section_fast_data_end - bsp_section_fast_data_begin; |
---|
258 | bsp_section_fast_data_load_begin = LOADADDR (.fast_data); |
---|
259 | bsp_section_fast_data_load_end = bsp_section_fast_data_load_begin + bsp_section_fast_data_size; |
---|
260 | |
---|
261 | .data : { |
---|
262 | bsp_section_data_begin = .; |
---|
263 | *(SORT(.bsp_data*)) |
---|
264 | *(.data .data.* .gnu.linkonce.d.*) |
---|
265 | SORT(CONSTRUCTORS) |
---|
266 | } > REGION_DATA AT > REGION_DATA_LOAD |
---|
267 | .data1 : { |
---|
268 | *(.data1) |
---|
269 | } > REGION_DATA AT > REGION_DATA_LOAD |
---|
270 | .rwbsdsets : { |
---|
271 | /* Special FreeBSD linker set sections */ |
---|
272 | _bsd__start_set_sysinit_set = .; |
---|
273 | *(_bsd_set_sysinit_set); |
---|
274 | _bsd__stop_set_sysinit_set = .; |
---|
275 | } > REGION_DATA AT > REGION_DATA_LOAD |
---|
276 | .sdata : { |
---|
277 | PROVIDE (_SDA_BASE_ = 32768); |
---|
278 | *(.sdata .sdata.* .gnu.linkonce.s.*) |
---|
279 | bsp_section_data_end = .; |
---|
280 | } > REGION_DATA AT > REGION_DATA_LOAD |
---|
281 | bsp_section_data_size = bsp_section_data_end - bsp_section_data_begin; |
---|
282 | bsp_section_data_load_begin = LOADADDR (.data); |
---|
283 | bsp_section_data_load_end = bsp_section_data_load_begin + bsp_section_data_size; |
---|
284 | |
---|
285 | .sbss : { |
---|
286 | bsp_section_sbss_begin = .; |
---|
287 | *(.dynsbss) |
---|
288 | *(.sbss .sbss.* .gnu.linkonce.sb.*) |
---|
289 | *(.scommon) |
---|
290 | bsp_section_sbss_end = .; |
---|
291 | } > REGION_DATA AT > REGION_DATA |
---|
292 | bsp_section_sbss_size = bsp_section_sbss_end - bsp_section_sbss_begin; |
---|
293 | |
---|
294 | .bss : { |
---|
295 | bsp_section_bss_begin = .; |
---|
296 | *(.dynbss) |
---|
297 | *(.bss .bss.* .gnu.linkonce.b.*) |
---|
298 | *(COMMON) |
---|
299 | bsp_section_bss_end = .; |
---|
300 | } > REGION_BSS AT > REGION_BSS |
---|
301 | bsp_section_bss_size = bsp_section_bss_end - bsp_section_bss_begin; |
---|
302 | |
---|
303 | .rwextra : { |
---|
304 | bsp_section_rwextra_begin = .; |
---|
305 | *(.bsp_rwextra) |
---|
306 | bsp_section_rwextra_end = .; |
---|
307 | } > REGION_RWEXTRA AT > REGION_RWEXTRA |
---|
308 | bsp_section_rwextra_size = bsp_section_rwextra_end - bsp_section_rwextra_begin; |
---|
309 | |
---|
310 | .work : { |
---|
311 | /* |
---|
312 | * The work section will occupy the remaining REGION_WORK region and |
---|
313 | * contains the RTEMS work space and heap. |
---|
314 | */ |
---|
315 | bsp_section_work_begin = .; |
---|
316 | . += ORIGIN (REGION_WORK) + LENGTH (REGION_WORK) - ABSOLUTE (.); |
---|
317 | bsp_section_work_end = .; |
---|
318 | } > REGION_WORK AT > REGION_WORK |
---|
319 | bsp_section_work_size = bsp_section_work_end - bsp_section_work_begin; |
---|
320 | |
---|
321 | .stack : { |
---|
322 | /* |
---|
323 | * The stack section will occupy the remaining REGION_STACK region and may |
---|
324 | * contain the task stacks. Depending on the region distribution this |
---|
325 | * section may be of zero size. |
---|
326 | */ |
---|
327 | bsp_section_stack_begin = .; |
---|
328 | . += ORIGIN (REGION_STACK) + LENGTH (REGION_STACK) - ABSOLUTE (.); |
---|
329 | bsp_section_stack_end = .; |
---|
330 | } > REGION_STACK AT > REGION_STACK |
---|
331 | bsp_section_stack_size = bsp_section_stack_end - bsp_section_stack_begin; |
---|
332 | |
---|
333 | .nocache : { |
---|
334 | bsp_section_nocache_begin = .; |
---|
335 | *(SORT(.bsp_nocache*)) |
---|
336 | bsp_section_nocache_end = .; |
---|
337 | } > REGION_NOCACHE AT > REGION_NOCACHE_LOAD |
---|
338 | bsp_section_nocache_size = bsp_section_nocache_end - bsp_section_nocache_begin; |
---|
339 | bsp_section_nocache_load_begin = LOADADDR (.nocache); |
---|
340 | bsp_section_nocache_load_end = bsp_section_nocache_load_begin + bsp_section_nocache_size; |
---|
341 | |
---|
342 | /* FIXME */ |
---|
343 | RamBase = ORIGIN (REGION_WORK); |
---|
344 | RamSize = LENGTH (REGION_WORK); |
---|
345 | WorkAreaBase = bsp_section_work_begin; |
---|
346 | HeapSize = 0; |
---|
347 | |
---|
348 | /* Stabs debugging sections. */ |
---|
349 | .stab 0 : { *(.stab) } |
---|
350 | .stabstr 0 : { *(.stabstr) } |
---|
351 | .stab.excl 0 : { *(.stab.excl) } |
---|
352 | .stab.exclstr 0 : { *(.stab.exclstr) } |
---|
353 | .stab.index 0 : { *(.stab.index) } |
---|
354 | .stab.indexstr 0 : { *(.stab.indexstr) } |
---|
355 | .comment 0 : { *(.comment) } |
---|
356 | /* DWARF debug sections. |
---|
357 | Symbols in the DWARF debugging sections are relative to the beginning |
---|
358 | of the section so we begin them at 0. */ |
---|
359 | /* DWARF 1 */ |
---|
360 | .debug 0 : { *(.debug) } |
---|
361 | .line 0 : { *(.line) } |
---|
362 | /* GNU DWARF 1 extensions */ |
---|
363 | .debug_srcinfo 0 : { *(.debug_srcinfo .zdebug_srcinfo) } |
---|
364 | .debug_sfnames 0 : { *(.debug_sfnames .zdebug_sfnames) } |
---|
365 | /* DWARF 1.1 and DWARF 2 */ |
---|
366 | .debug_aranges 0 : { *(.debug_aranges .zdebug_aranges) } |
---|
367 | .debug_pubnames 0 : { *(.debug_pubnames .zdebug_pubnames) } |
---|
368 | /* DWARF 2 */ |
---|
369 | .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.* .zdebug_info) } |
---|
370 | .debug_abbrev 0 : { *(.debug_abbrev .zdebug_abbrev) } |
---|
371 | .debug_line 0 : { *(.debug_line .zdebug_line) } |
---|
372 | .debug_frame 0 : { *(.debug_frame .zdebug_frame) } |
---|
373 | .debug_str 0 : { *(.debug_str .zdebug_str) } |
---|
374 | .debug_loc 0 : { *(.debug_loc .zdebug_loc) } |
---|
375 | .debug_macinfo 0 : { *(.debug_macinfo .zdebug_macinfo) } |
---|
376 | /* SGI/MIPS DWARF 2 extensions */ |
---|
377 | .debug_weaknames 0 : { *(.debug_weaknames .zdebug_weaknames) } |
---|
378 | .debug_funcnames 0 : { *(.debug_funcnames .zdebug_funcnames) } |
---|
379 | .debug_typenames 0 : { *(.debug_typenames .zdebug_typenames) } |
---|
380 | .debug_varnames 0 : { *(.debug_varnames .zdebug_varnames) } |
---|
381 | /* DWARF 3 */ |
---|
382 | .debug_pubtypes 0 : { *(.debug_pubtypes .zdebug_pubtypes) } |
---|
383 | .debug_ranges 0 : { *(.debug_ranges .zdebug_ranges) } |
---|
384 | .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } |
---|
385 | .PPC.EMB.apuinfo 0 : { *(.PPC.EMB.apuinfo) } |
---|
386 | /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) } |
---|
387 | |
---|
388 | /* |
---|
389 | * This is a RTEMS specific section to catch all unexpected input |
---|
390 | * sections. In case you get an error like |
---|
391 | * "section `.unexpected_sections' will not fit in region |
---|
392 | * `UNEXPECTED_SECTIONS'" |
---|
393 | * you have to figure out the offending input section and add it to the |
---|
394 | * appropriate output section definition above. |
---|
395 | */ |
---|
396 | .unexpected_sections : { *(*) } > UNEXPECTED_SECTIONS |
---|
397 | } |
---|