source: rtems/c/src/lib/libbsp/arm/shared/startup/linkcmds.base @ 6d9ab345

4.115
Last change on this file since 6d9ab345 was fd153c73, checked in by Sebastian Huber <sebastian.huber@…>, on 06/12/12 at 13:27:17

bsps: Replace NIRVANA region

Replace the "NIRVANA" region with the more verbose "UNEXPECTED_SECTIONS"
region. Move the region definition into the "linkcmds.base" files.

  • Property mode set to 100644
File size: 14.0 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup bsp_linker
5 *
6 * @brief Linker command base file.
7 */
8
9/*
10 * Copyright (c) 2008-2011 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
23OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
24
25OUTPUT_ARCH (arm)
26
27ENTRY (_start)
28
29/*
30 * Global symbols that may be defined externally
31 */
32
33bsp_vector_table_size = DEFINED (bsp_vector_table_size) ? bsp_vector_table_size : 64;
34
35bsp_section_xbarrier_align = DEFINED (bsp_section_xbarrier_align) ? bsp_section_xbarrier_align : 1;
36bsp_section_robarrier_align = DEFINED (bsp_section_robarrier_align) ? bsp_section_robarrier_align : 1;
37bsp_section_rwbarrier_align = DEFINED (bsp_section_rwbarrier_align) ? bsp_section_rwbarrier_align : 1;
38
39bsp_stack_align = DEFINED (bsp_stack_align) ? bsp_stack_align : 8;
40
41bsp_stack_abt_size = DEFINED (bsp_stack_abt_size) ? bsp_stack_abt_size : 0;
42bsp_stack_abt_size = ALIGN (bsp_stack_abt_size, bsp_stack_align);
43
44bsp_stack_fiq_size = DEFINED (bsp_stack_fiq_size) ? bsp_stack_fiq_size : 0;
45bsp_stack_fiq_size = ALIGN (bsp_stack_fiq_size, bsp_stack_align);
46
47bsp_stack_irq_size = DEFINED (bsp_stack_irq_size) ? bsp_stack_irq_size : 0;
48bsp_stack_irq_size = ALIGN (bsp_stack_irq_size, bsp_stack_align);
49
50bsp_stack_svc_size = DEFINED (bsp_stack_svc_size) ? bsp_stack_svc_size : 0;
51bsp_stack_svc_size = ALIGN (bsp_stack_svc_size, bsp_stack_align);
52
53bsp_stack_und_size = DEFINED (bsp_stack_und_size) ? bsp_stack_und_size : 0;
54bsp_stack_und_size = ALIGN (bsp_stack_und_size, bsp_stack_align);
55
56bsp_stack_main_size = DEFINED (bsp_stack_main_size) ? bsp_stack_main_size : 0;
57bsp_stack_main_size = ALIGN (bsp_stack_main_size, bsp_stack_align);
58
59MEMORY {
60        UNEXPECTED_SECTIONS : ORIGIN = 0xffffffff, LENGTH = 0
61}
62
63SECTIONS {
64        .start : {
65                bsp_section_start_begin = .;
66                KEEP (*(.bsp_start_text))
67                KEEP (*(.bsp_start_data))
68                bsp_section_start_end = .;
69        } > REGION_START AT > REGION_START
70        bsp_section_start_size = bsp_section_start_end - bsp_section_start_begin;
71
72        .vector : {
73                bsp_section_vector_begin = .;
74
75                . = . + DEFINED (bsp_vector_table_in_start_section) ? 0 : bsp_vector_table_size;
76
77                . = ALIGN (bsp_stack_align);
78
79                bsp_stack_abt_begin = .;
80                . = . + bsp_stack_abt_size;
81                bsp_stack_abt_end = .;
82
83                bsp_stack_fiq_begin = .;
84                . = . + bsp_stack_fiq_size;
85                bsp_stack_fiq_end = .;
86
87                bsp_stack_irq_begin = .;
88                . = . + bsp_stack_irq_size;
89                bsp_stack_irq_end = .;
90
91                bsp_stack_svc_begin = .;
92                . = . + bsp_stack_svc_size;
93                bsp_stack_svc_end = .;
94
95                bsp_stack_und_begin = .;
96                . = . + bsp_stack_und_size;
97                bsp_stack_und_end = .;
98
99                bsp_stack_main_begin = .;
100                . = . + bsp_stack_main_size;
101                bsp_stack_main_end = .;
102
103                *(.bsp_vector)
104                bsp_section_vector_end = .;
105        } > REGION_VECTOR AT > REGION_VECTOR
106        bsp_section_vector_size = bsp_section_vector_end - bsp_section_vector_begin;
107        bsp_vector_table_begin = DEFINED (bsp_vector_table_in_start_section) ? bsp_section_start_begin : bsp_section_vector_begin;
108        bsp_vector_table_end = bsp_vector_table_begin + bsp_vector_table_size;
109
110        .xbarrier : {
111                . = ALIGN (bsp_section_xbarrier_align);
112        } > REGION_VECTOR
113
114        .fast_text : {
115                bsp_section_fast_text_begin = .;
116                *(.bsp_fast_text)
117                bsp_section_fast_text_end = .;
118        } > REGION_FAST_TEXT AT > REGION_FAST_TEXT_LOAD
119        bsp_section_fast_text_size = bsp_section_fast_text_end - bsp_section_fast_text_begin;
120        bsp_section_fast_text_load_begin = LOADADDR (.fast_text);
121        bsp_section_fast_text_load_end = bsp_section_fast_text_load_begin + bsp_section_fast_text_size;
122
123        .text : {
124                bsp_section_text_begin = .;
125                *(.text.unlikely .text.*_unlikely)
126                *(.text .stub .text.* .gnu.linkonce.t.*)
127                /* .gnu.warning sections are handled specially by elf32.em.  */
128                *(.gnu.warning)
129                *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)
130        } > REGION_TEXT AT > REGION_TEXT_LOAD
131        .init : {
132                KEEP (*(.init))
133        } > REGION_TEXT AT > REGION_TEXT_LOAD
134        .fini : {
135                KEEP (*(.fini))
136                bsp_section_text_end = .;
137        } > REGION_TEXT AT > REGION_TEXT_LOAD
138        bsp_section_text_size = bsp_section_text_end - bsp_section_text_begin;
139        bsp_section_text_load_begin = LOADADDR (.text);
140        bsp_section_text_load_end = bsp_section_text_load_begin + bsp_section_text_size;
141
142        .robarrier : {
143                . = ALIGN (bsp_section_robarrier_align);
144        } > REGION_RODATA
145
146        .rodata : {
147                bsp_section_rodata_begin = .;
148                *(.rodata .rodata.* .gnu.linkonce.r.*)
149        } > REGION_RODATA AT > REGION_RODATA_LOAD
150        .rodata1 : {
151                *(.rodata1)
152        } > REGION_RODATA AT > REGION_RODATA_LOAD
153        .ARM.extab : {
154                *(.ARM.extab* .gnu.linkonce.armextab.*)
155        } > REGION_RODATA AT > REGION_RODATA_LOAD
156        .ARM.exidx : {
157                __exidx_start = .;
158                *(.ARM.exidx* .gnu.linkonce.armexidx.*)
159                __exidx_end = .;
160        } > REGION_RODATA AT > REGION_RODATA_LOAD
161        .eh_frame : {
162                KEEP (*(.eh_frame))
163        } > REGION_RODATA AT > REGION_RODATA_LOAD
164        .gcc_except_table : {
165                *(.gcc_except_table .gcc_except_table.*)
166        } > REGION_RODATA AT > REGION_RODATA_LOAD
167        .preinit_array : {
168                PROVIDE_HIDDEN (__preinit_array_start = .);
169                KEEP (*(.preinit_array))
170                PROVIDE_HIDDEN (__preinit_array_end = .);
171        } > REGION_RODATA AT > REGION_RODATA_LOAD
172        .init_array : {
173                PROVIDE_HIDDEN (__init_array_start = .);
174                KEEP (*(SORT(.init_array.*)))
175                KEEP (*(.init_array))
176                PROVIDE_HIDDEN (__init_array_end = .);
177        } > REGION_RODATA AT > REGION_RODATA_LOAD
178        .fini_array : {
179                PROVIDE_HIDDEN (__fini_array_start = .);
180                KEEP (*(.fini_array))
181                KEEP (*(SORT(.fini_array.*)))
182                PROVIDE_HIDDEN (__fini_array_end = .);
183        } > REGION_RODATA AT > REGION_RODATA_LOAD
184        .ctors : {
185                /* gcc uses crtbegin.o to find the start of
186                   the constructors, so we make sure it is
187                   first.  Because this is a wildcard, it
188                   doesn't matter if the user does not
189                   actually link against crtbegin.o; the
190                   linker won't look for a file to match a
191                   wildcard.  The wildcard also means that it
192                   doesn't matter which directory crtbegin.o
193                   is in.  */
194                KEEP (*crtbegin.o(.ctors))
195                KEEP (*crtbegin?.o(.ctors))
196                /* We don't want to include the .ctor section from
197                   the crtend.o file until after the sorted ctors.
198                   The .ctor section from the crtend file contains the
199                   end of ctors marker and it must be last */
200                KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
201                KEEP (*(SORT(.ctors.*)))
202                KEEP (*(.ctors))
203        } > REGION_RODATA AT > REGION_RODATA_LOAD
204        .dtors : {
205                KEEP (*crtbegin.o(.dtors))
206                KEEP (*crtbegin?.o(.dtors))
207                KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
208                KEEP (*(SORT(.dtors.*)))
209                KEEP (*(.dtors))
210        } > REGION_RODATA AT > REGION_RODATA_LOAD
211        .data.rel.ro : {
212                *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*)
213                *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*)
214        } > REGION_RODATA AT > REGION_RODATA_LOAD
215        .jcr : {
216                KEEP (*(.jcr))
217        } > REGION_RODATA AT > REGION_RODATA_LOAD
218        .dynamic : {
219                *(.dynamic)
220        } > REGION_RODATA AT > REGION_RODATA_LOAD
221        .got : {
222                *(.got.plt) *(.igot.plt) *(.got) *(.igot)
223        } > REGION_RODATA AT > REGION_RODATA_LOAD
224        .interp : {
225                *(.interp)
226        } > REGION_RODATA AT > REGION_RODATA_LOAD
227        .note.gnu.build-id : {
228                *(.note.gnu.build-id)
229        } > REGION_RODATA AT > REGION_RODATA_LOAD
230        .hash : {
231                *(.hash)
232        } > REGION_RODATA AT > REGION_RODATA_LOAD
233        .gnu.hash : {
234                *(.gnu.hash)
235        } > REGION_RODATA AT > REGION_RODATA_LOAD
236        .dynsym : {
237                *(.dynsym)
238        } > REGION_RODATA AT > REGION_RODATA_LOAD
239        .dynstr : {
240                *(.dynstr)
241        } > REGION_RODATA AT > REGION_RODATA_LOAD
242        .gnu.version : {
243                *(.gnu.version)
244        } > REGION_RODATA AT > REGION_RODATA_LOAD
245        .gnu.version_d : {
246                *(.gnu.version_d)
247        } > REGION_RODATA AT > REGION_RODATA_LOAD
248        .gnu.version_r : {
249                *(.gnu.version_r)
250        } > REGION_RODATA AT > REGION_RODATA_LOAD
251        .rel.dyn : {
252                *(.rel.init)
253                *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
254                *(.rel.fini)
255                *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
256                *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
257                *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
258                *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
259                *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
260                *(.rel.ctors)
261                *(.rel.dtors)
262                *(.rel.got)
263                *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
264                PROVIDE_HIDDEN (__rel_iplt_start = .);
265                *(.rel.iplt)
266                PROVIDE_HIDDEN (__rel_iplt_end = .);
267                PROVIDE_HIDDEN (__rela_iplt_start = .);
268                PROVIDE_HIDDEN (__rela_iplt_end = .);
269        } > REGION_RODATA AT > REGION_RODATA_LOAD
270        .rela.dyn : {
271                *(.rela.init)
272                *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
273                *(.rela.fini)
274                *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
275                *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
276                *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
277                *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
278                *(.rela.ctors)
279                *(.rela.dtors)
280                *(.rela.got)
281                *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
282                PROVIDE_HIDDEN (__rel_iplt_start = .);
283                PROVIDE_HIDDEN (__rel_iplt_end = .);
284                PROVIDE_HIDDEN (__rela_iplt_start = .);
285                *(.rela.iplt)
286                PROVIDE_HIDDEN (__rela_iplt_end = .);
287        } > REGION_RODATA AT > REGION_RODATA_LOAD
288        .rel.plt : {
289                *(.rel.plt)
290        } > REGION_RODATA AT > REGION_RODATA_LOAD
291        .rela.plt : {
292                *(.rela.plt)
293        } > REGION_RODATA AT > REGION_RODATA_LOAD
294        .plt : {
295                *(.plt)
296        } > REGION_RODATA AT > REGION_RODATA_LOAD
297        .iplt : {
298                *(.iplt)
299        } > REGION_RODATA AT > REGION_RODATA_LOAD
300        .robsdsets : {
301                /* Special FreeBSD linker set sections */
302                __start_set_sysctl_set = .;
303                *(set_sysctl_*);
304                __stop_set_sysctl_set = .;
305                *(set_domain_*);
306                *(set_pseudo_*);
307                _bsd__start_set_modmetadata_set = .;
308                *(_bsd_set_modmetadata_set);
309                _bsd__stop_set_modmetadata_set = .;
310                _bsd__start_set_sysctl_set = .;
311                *(_bsd_set_sysctl_set);
312                _bsd__stop_set_sysctl_set = .;
313
314                bsp_section_rodata_end = .;
315        } > REGION_RODATA AT > REGION_RODATA_LOAD
316        bsp_section_rodata_size = bsp_section_rodata_end - bsp_section_rodata_begin;
317        bsp_section_rodata_load_begin = LOADADDR (.rodata);
318        bsp_section_rodata_load_end = bsp_section_rodata_load_begin + bsp_section_rodata_size;
319
320        .rwbarrier : {
321                . = ALIGN (bsp_section_rwbarrier_align);
322        } > REGION_DATA
323
324        .fast_data : {
325                bsp_section_fast_data_begin = .;
326                *(.bsp_fast_data)
327                bsp_section_fast_data_end = .;
328        } > REGION_FAST_DATA AT > REGION_FAST_DATA_LOAD
329        bsp_section_fast_data_size = bsp_section_fast_data_end - bsp_section_fast_data_begin;
330        bsp_section_fast_data_load_begin = LOADADDR (.fast_data);
331        bsp_section_fast_data_load_end = bsp_section_fast_data_load_begin + bsp_section_fast_data_size;
332
333        .data : {
334                bsp_section_data_begin = .;
335                *(.data .data.* .gnu.linkonce.d.*)
336                SORT(CONSTRUCTORS)
337        } > REGION_DATA AT > REGION_DATA_LOAD
338        .data1 : {
339                *(.data1)
340        } > REGION_DATA AT > REGION_DATA_LOAD
341        .rwbsdsets : {
342                /* Special FreeBSD linker set sections */
343                _bsd__start_set_sysinit_set = .;
344                *(_bsd_set_sysinit_set);
345                _bsd__stop_set_sysinit_set = .;
346
347                bsp_section_data_end = .;
348        } > REGION_DATA AT > REGION_DATA_LOAD
349        bsp_section_data_size = bsp_section_data_end - bsp_section_data_begin;
350        bsp_section_data_load_begin = LOADADDR (.data);
351        bsp_section_data_load_end = bsp_section_data_load_begin + bsp_section_data_size;
352
353        .bss : {
354                bsp_section_bss_begin = .;
355                *(.dynbss)
356                *(.bss .bss.* .gnu.linkonce.b.*)
357                *(COMMON)
358                bsp_section_bss_end = .;
359        } > REGION_BSS AT > REGION_BSS
360        bsp_section_bss_size = bsp_section_bss_end - bsp_section_bss_begin;
361
362        .work : {
363                /*
364                 * The work section will occupy the remaining REGION_WORK region and
365                 * contains the RTEMS work space and heap.
366                 */
367                bsp_section_work_begin = .;
368                . += ORIGIN (REGION_WORK) + LENGTH (REGION_WORK) - ABSOLUTE (.);
369                bsp_section_work_end = .;
370        } > REGION_WORK AT > REGION_WORK
371        bsp_section_work_size = bsp_section_work_end - bsp_section_work_begin;
372
373        .stack : {
374                /*
375                 * The stack section will occupy the remaining REGION_STACK region and may
376                 * contain the task stacks.  Depending on the region distribution this
377                 * section may be of zero size.
378                 */
379                bsp_section_stack_begin = .;
380                . += ORIGIN (REGION_STACK) + LENGTH (REGION_STACK) - ABSOLUTE (.);
381                bsp_section_stack_end = .;
382        } > REGION_STACK AT > REGION_STACK
383        bsp_section_stack_size = bsp_section_stack_end - bsp_section_stack_begin;
384
385        /* FIXME */
386        RamBase = ORIGIN (REGION_WORK);
387        RamSize = LENGTH (REGION_WORK);
388        WorkAreaBase = bsp_section_work_begin;
389        HeapSize = 0;
390
391        /* Stabs debugging sections.  */
392        .stab          0 : { *(.stab) }
393        .stabstr       0 : { *(.stabstr) }
394        .stab.excl     0 : { *(.stab.excl) }
395        .stab.exclstr  0 : { *(.stab.exclstr) }
396        .stab.index    0 : { *(.stab.index) }
397        .stab.indexstr 0 : { *(.stab.indexstr) }
398        .comment       0 : { *(.comment) }
399        /* DWARF debug sections.
400           Symbols in the DWARF debugging sections are relative to the beginning
401           of the section so we begin them at 0.  */
402        /* DWARF 1 */
403        .debug          0 : { *(.debug) }
404        .line           0 : { *(.line) }
405        /* GNU DWARF 1 extensions */
406        .debug_srcinfo  0 : { *(.debug_srcinfo) }
407        .debug_sfnames  0 : { *(.debug_sfnames) }
408        /* DWARF 1.1 and DWARF 2 */
409        .debug_aranges  0 : { *(.debug_aranges) }
410        .debug_pubnames 0 : { *(.debug_pubnames) }
411        /* DWARF 2 */
412        .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
413        .debug_abbrev   0 : { *(.debug_abbrev) }
414        .debug_line     0 : { *(.debug_line) }
415        .debug_frame    0 : { *(.debug_frame) }
416        .debug_str      0 : { *(.debug_str) }
417        .debug_loc      0 : { *(.debug_loc) }
418        .debug_macinfo  0 : { *(.debug_macinfo) }
419        /* SGI/MIPS DWARF 2 extensions */
420        .debug_weaknames 0 : { *(.debug_weaknames) }
421        .debug_funcnames 0 : { *(.debug_funcnames) }
422        .debug_typenames 0 : { *(.debug_typenames) }
423        .debug_varnames  0 : { *(.debug_varnames) }
424        /* DWARF 3 */
425        .debug_pubtypes 0 : { *(.debug_pubtypes) }
426        .debug_ranges   0 : { *(.debug_ranges) }
427        .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }
428        .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
429        /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
430
431        /*
432         * This is a RTEMS specific section to catch all unexpected input
433         * sections.  In case you get an error like
434         *   "section `.unexpected_sections' will not fit in region
435         *   `UNEXPECTED_SECTIONS'"
436         * you have to figure out the offending input section and add it to the
437         * appropriate output section definition above.
438         */
439        .unexpected_sections : { *(*) } > UNEXPECTED_SECTIONS
440}
Note: See TracBrowser for help on using the repository browser.