source: rtems/bsps/arm/shared/start/linkcmds.base @ 6dc0b5f

5
Last change on this file since 6dc0b5f was 511ef83c, checked in by Sebastian Huber <sebastian.huber@…>, on 10/09/18 at 09:59:48

bsps/arm: Fix ctor/dtor invocation order

Remove obsolete .ctor and .dtor output sections.

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