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