source: rtems/c/src/lib/libbsp/arm/shared/startup/linkcmds.base @ 936c8d6

4.115
Last change on this file since 936c8d6 was 27690ec3, checked in by Sebastian Huber <sebastian.huber@…>, on 05/02/13 at 11:36:03

bsps/arm: Move .vector section

The .vector section contains read-write data (several mode stacks).
Move it to the read-write data area.

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