source: rtems/c/src/lib/libbsp/arm/shared/startup/linkcmds.base @ 43c6268

4.115
Last change on this file since 43c6268 was a3a4cd5, checked in by Sebastian Huber <sebastian.huber@…>, on 06/26/13 at 07:40:44

bsps/arm: Move input sections

Move input sections to preserve order of the default Binutils script.

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