source: rtems/c/src/lib/libbsp/arm/shared/startup/linkcmds.base @ 287bbb6

4.115
Last change on this file since 287bbb6 was 287bbb6, checked in by Sebastian Huber <sebastian.huber@…>, on 08/30/13 at 15:43:16

bsps/arm: Use ALIGN_WITH_INPUT

This requires at least Binutils 2.24.

  • Property mode set to 100644
File size: 15.4 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 : ALIGN_WITH_INPUT {
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 : ALIGN_WITH_INPUT {
77                . = ALIGN (bsp_section_xbarrier_align);
78        } > REGION_VECTOR
79
80        .text : ALIGN_WITH_INPUT {
81                bsp_section_text_begin = .;
82                *(.text.unlikely .text.*_unlikely)
83                *(.text .stub .text.* .gnu.linkonce.t.*)
84                /* .gnu.warning sections are handled specially by elf32.em.  */
85                *(.gnu.warning)
86                *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)
87        } > REGION_TEXT AT > REGION_TEXT_LOAD
88        .init : ALIGN_WITH_INPUT {
89                KEEP (*(.init))
90        } > REGION_TEXT AT > REGION_TEXT_LOAD
91        .fini : ALIGN_WITH_INPUT {
92                KEEP (*(.fini))
93                bsp_section_text_end = .;
94        } > REGION_TEXT AT > REGION_TEXT_LOAD
95        bsp_section_text_size = bsp_section_text_end - bsp_section_text_begin;
96        bsp_section_text_load_begin = LOADADDR (.text);
97        bsp_section_text_load_end = bsp_section_text_load_begin + bsp_section_text_size;
98
99        .robarrier : ALIGN_WITH_INPUT {
100                . = ALIGN (bsp_section_robarrier_align);
101        } > REGION_RODATA
102
103        .rodata : ALIGN_WITH_INPUT {
104                bsp_section_rodata_begin = .;
105                *(.rodata .rodata.* .gnu.linkonce.r.*)
106        } > REGION_RODATA AT > REGION_RODATA_LOAD
107        .rodata1 : ALIGN_WITH_INPUT {
108                *(.rodata1)
109        } > REGION_RODATA AT > REGION_RODATA_LOAD
110        .ARM.extab : ALIGN_WITH_INPUT {
111                *(.ARM.extab* .gnu.linkonce.armextab.*)
112        } > REGION_RODATA AT > REGION_RODATA_LOAD
113        .ARM.exidx : ALIGN_WITH_INPUT {
114                __exidx_start = .;
115                *(.ARM.exidx* .gnu.linkonce.armexidx.*)
116                __exidx_end = .;
117        } > REGION_RODATA AT > REGION_RODATA_LOAD
118        .eh_frame : ALIGN_WITH_INPUT {
119                KEEP (*(.eh_frame))
120        } > REGION_RODATA AT > REGION_RODATA_LOAD
121        .gcc_except_table : ALIGN_WITH_INPUT {
122                *(.gcc_except_table .gcc_except_table.*)
123        } > REGION_RODATA AT > REGION_RODATA_LOAD
124        .tdata : ALIGN_WITH_INPUT {
125                *(.tdata .tdata.* .gnu.linkonce.td.*)
126        } > REGION_RODATA AT > REGION_RODATA_LOAD
127        .tbss : ALIGN_WITH_INPUT {
128                *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
129        } > REGION_RODATA AT > REGION_RODATA_LOAD
130        .preinit_array : ALIGN_WITH_INPUT {
131                PROVIDE_HIDDEN (__preinit_array_start = .);
132                KEEP (*(.preinit_array))
133                PROVIDE_HIDDEN (__preinit_array_end = .);
134        } > REGION_RODATA AT > REGION_RODATA_LOAD
135        .init_array : ALIGN_WITH_INPUT {
136                PROVIDE_HIDDEN (__init_array_start = .);
137                KEEP (*(SORT(.init_array.*)))
138                KEEP (*(.init_array))
139                PROVIDE_HIDDEN (__init_array_end = .);
140        } > REGION_RODATA AT > REGION_RODATA_LOAD
141        .fini_array : ALIGN_WITH_INPUT {
142                PROVIDE_HIDDEN (__fini_array_start = .);
143                KEEP (*(.fini_array))
144                KEEP (*(SORT(.fini_array.*)))
145                PROVIDE_HIDDEN (__fini_array_end = .);
146        } > REGION_RODATA AT > REGION_RODATA_LOAD
147        .ctors : ALIGN_WITH_INPUT {
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        } > REGION_RODATA AT > REGION_RODATA_LOAD
167        .dtors : ALIGN_WITH_INPUT {
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        } > REGION_RODATA AT > REGION_RODATA_LOAD
174        .data.rel.ro : ALIGN_WITH_INPUT {
175                *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*)
176                *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*)
177        } > REGION_RODATA AT > REGION_RODATA_LOAD
178        .jcr : ALIGN_WITH_INPUT {
179                KEEP (*(.jcr))
180        } > REGION_RODATA AT > REGION_RODATA_LOAD
181        .interp : ALIGN_WITH_INPUT {
182                *(.interp)
183        } > REGION_RODATA AT > REGION_RODATA_LOAD
184        .note.gnu.build-id : ALIGN_WITH_INPUT {
185                *(.note.gnu.build-id)
186        } > REGION_RODATA AT > REGION_RODATA_LOAD
187        .hash : ALIGN_WITH_INPUT {
188                *(.hash)
189        } > REGION_RODATA AT > REGION_RODATA_LOAD
190        .gnu.hash : ALIGN_WITH_INPUT {
191                *(.gnu.hash)
192        } > REGION_RODATA AT > REGION_RODATA_LOAD
193        .dynsym : ALIGN_WITH_INPUT {
194                *(.dynsym)
195        } > REGION_RODATA AT > REGION_RODATA_LOAD
196        .dynstr : ALIGN_WITH_INPUT {
197                *(.dynstr)
198        } > REGION_RODATA AT > REGION_RODATA_LOAD
199        .gnu.version : ALIGN_WITH_INPUT {
200                *(.gnu.version)
201        } > REGION_RODATA AT > REGION_RODATA_LOAD
202        .gnu.version_d : ALIGN_WITH_INPUT {
203                *(.gnu.version_d)
204        } > REGION_RODATA AT > REGION_RODATA_LOAD
205        .gnu.version_r : ALIGN_WITH_INPUT {
206                *(.gnu.version_r)
207        } > REGION_RODATA AT > REGION_RODATA_LOAD
208        .rel.dyn : ALIGN_WITH_INPUT {
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        } > REGION_RODATA AT > REGION_RODATA_LOAD
227        .rela.dyn : ALIGN_WITH_INPUT {
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        } > REGION_RODATA AT > REGION_RODATA_LOAD
245        .rel.plt : ALIGN_WITH_INPUT {
246                *(.rel.plt)
247        } > REGION_RODATA AT > REGION_RODATA_LOAD
248        .rela.plt : ALIGN_WITH_INPUT {
249                *(.rela.plt)
250        } > REGION_RODATA AT > REGION_RODATA_LOAD
251        .plt : ALIGN_WITH_INPUT {
252                *(.plt)
253        } > REGION_RODATA AT > REGION_RODATA_LOAD
254        .iplt : ALIGN_WITH_INPUT {
255                *(.iplt)
256        } > REGION_RODATA AT > REGION_RODATA_LOAD
257        .dynamic : ALIGN_WITH_INPUT {
258                *(.dynamic)
259        } > REGION_RODATA AT > REGION_RODATA_LOAD
260        .got : ALIGN_WITH_INPUT {
261                *(.got.plt) *(.igot.plt) *(.got) *(.igot)
262        } > REGION_RODATA AT > REGION_RODATA_LOAD
263        .robsdsets : ALIGN_WITH_INPUT {
264                /* Special FreeBSD linker set sections */
265                __start_set_sysctl_set = .;
266                *(set_sysctl_*);
267                __stop_set_sysctl_set = .;
268                *(set_domain_*);
269                *(set_pseudo_*);
270                _bsd__start_set_modmetadata_set = .;
271                *(_bsd_set_modmetadata_set);
272                _bsd__stop_set_modmetadata_set = .;
273                _bsd__start_set_sysctl_set = .;
274                *(_bsd_set_sysctl_set);
275                _bsd__stop_set_sysctl_set = .;
276
277                bsp_section_rodata_end = .;
278        } > REGION_RODATA AT > REGION_RODATA_LOAD
279        bsp_section_rodata_size = bsp_section_rodata_end - bsp_section_rodata_begin;
280        bsp_section_rodata_load_begin = LOADADDR (.rodata);
281        bsp_section_rodata_load_end = bsp_section_rodata_load_begin + bsp_section_rodata_size;
282
283        .rwbarrier : ALIGN_WITH_INPUT {
284                . = ALIGN (bsp_section_rwbarrier_align);
285        } > REGION_DATA
286
287        .vector : ALIGN_WITH_INPUT {
288                bsp_section_vector_begin = .;
289
290                . = . + DEFINED (bsp_vector_table_in_start_section) ? 0 : bsp_vector_table_size;
291
292                . = ALIGN (bsp_stack_align);
293
294                bsp_stack_abt_begin = .;
295                . = . + bsp_stack_abt_size;
296                bsp_stack_abt_end = .;
297
298                bsp_stack_fiq_begin = .;
299                . = . + bsp_stack_fiq_size;
300                bsp_stack_fiq_end = .;
301
302                bsp_stack_irq_begin = .;
303                . = . + bsp_stack_irq_size;
304                bsp_stack_irq_end = .;
305
306                bsp_stack_svc_begin = .;
307                . = . + bsp_stack_svc_size;
308                bsp_stack_svc_end = .;
309
310                bsp_stack_und_begin = .;
311                . = . + bsp_stack_und_size;
312                bsp_stack_und_end = .;
313
314                bsp_stack_main_begin = .;
315                . = . + bsp_stack_main_size;
316                bsp_stack_main_end = .;
317
318                bsp_stack_secondary_processors_begin = .;
319                . = . + (bsp_processor_count - 1) * bsp_stack_all_size;
320                bsp_stack_secondary_processors_end = .;
321
322                *(.bsp_vector)
323                bsp_section_vector_end = .;
324        } > REGION_VECTOR AT > REGION_VECTOR
325        bsp_section_vector_size = bsp_section_vector_end - bsp_section_vector_begin;
326        bsp_vector_table_begin = DEFINED (bsp_vector_table_in_start_section) ? bsp_section_start_begin : bsp_section_vector_begin;
327        bsp_vector_table_end = bsp_vector_table_begin + bsp_vector_table_size;
328
329        .fast_text : ALIGN_WITH_INPUT {
330                bsp_section_fast_text_begin = .;
331                *(.bsp_fast_text)
332                bsp_section_fast_text_end = .;
333        } > REGION_FAST_TEXT AT > REGION_FAST_TEXT_LOAD
334        bsp_section_fast_text_size = bsp_section_fast_text_end - bsp_section_fast_text_begin;
335        bsp_section_fast_text_load_begin = LOADADDR (.fast_text);
336        bsp_section_fast_text_load_end = bsp_section_fast_text_load_begin + bsp_section_fast_text_size;
337
338        .fast_data : ALIGN_WITH_INPUT {
339                bsp_section_fast_data_begin = .;
340                *(.bsp_fast_data)
341                bsp_section_fast_data_end = .;
342        } > REGION_FAST_DATA AT > REGION_FAST_DATA_LOAD
343        bsp_section_fast_data_size = bsp_section_fast_data_end - bsp_section_fast_data_begin;
344        bsp_section_fast_data_load_begin = LOADADDR (.fast_data);
345        bsp_section_fast_data_load_end = bsp_section_fast_data_load_begin + bsp_section_fast_data_size;
346
347        .data : ALIGN_WITH_INPUT {
348                bsp_section_data_begin = .;
349                *(.data .data.* .gnu.linkonce.d.*)
350                SORT(CONSTRUCTORS)
351        } > REGION_DATA AT > REGION_DATA_LOAD
352        .data1 : ALIGN_WITH_INPUT {
353                *(.data1)
354        } > REGION_DATA AT > REGION_DATA_LOAD
355        .rwbsdsets : ALIGN_WITH_INPUT {
356                /* Special FreeBSD linker set sections */
357                _bsd__start_set_sysinit_set = .;
358                *(_bsd_set_sysinit_set);
359                _bsd__stop_set_sysinit_set = .;
360
361                bsp_section_data_end = .;
362        } > REGION_DATA AT > REGION_DATA_LOAD
363        bsp_section_data_size = bsp_section_data_end - bsp_section_data_begin;
364        bsp_section_data_load_begin = LOADADDR (.data);
365        bsp_section_data_load_end = bsp_section_data_load_begin + bsp_section_data_size;
366
367        .bss : ALIGN_WITH_INPUT {
368                bsp_section_bss_begin = .;
369                *(.dynbss)
370                *(.bss .bss.* .gnu.linkonce.b.*)
371                *(COMMON)
372                bsp_section_bss_end = .;
373        } > REGION_BSS AT > REGION_BSS
374        bsp_section_bss_size = bsp_section_bss_end - bsp_section_bss_begin;
375
376        .work : ALIGN_WITH_INPUT {
377                /*
378                 * The work section will occupy the remaining REGION_WORK region and
379                 * contains the RTEMS work space and heap.
380                 */
381                bsp_section_work_begin = .;
382                . += ORIGIN (REGION_WORK) + LENGTH (REGION_WORK) - ABSOLUTE (.);
383                bsp_section_work_end = .;
384        } > REGION_WORK AT > REGION_WORK
385        bsp_section_work_size = bsp_section_work_end - bsp_section_work_begin;
386
387        .stack : ALIGN_WITH_INPUT {
388                /*
389                 * The stack section will occupy the remaining REGION_STACK region and may
390                 * contain the task stacks.  Depending on the region distribution this
391                 * section may be of zero size.
392                 */
393                bsp_section_stack_begin = .;
394                . += ORIGIN (REGION_STACK) + LENGTH (REGION_STACK) - ABSOLUTE (.);
395                bsp_section_stack_end = .;
396        } > REGION_STACK AT > REGION_STACK
397        bsp_section_stack_size = bsp_section_stack_end - bsp_section_stack_begin;
398
399        /* FIXME */
400        RamBase = ORIGIN (REGION_WORK);
401        RamSize = LENGTH (REGION_WORK);
402        WorkAreaBase = bsp_section_work_begin;
403        HeapSize = 0;
404
405        /* Stabs debugging sections.  */
406        .stab          0 : { *(.stab) }
407        .stabstr       0 : { *(.stabstr) }
408        .stab.excl     0 : { *(.stab.excl) }
409        .stab.exclstr  0 : { *(.stab.exclstr) }
410        .stab.index    0 : { *(.stab.index) }
411        .stab.indexstr 0 : { *(.stab.indexstr) }
412        .comment       0 : { *(.comment) }
413        /* DWARF debug sections.
414           Symbols in the DWARF debugging sections are relative to the beginning
415           of the section so we begin them at 0.  */
416        /* DWARF 1 */
417        .debug          0 : { *(.debug) }
418        .line           0 : { *(.line) }
419        /* GNU DWARF 1 extensions */
420        .debug_srcinfo  0 : { *(.debug_srcinfo) }
421        .debug_sfnames  0 : { *(.debug_sfnames) }
422        /* DWARF 1.1 and DWARF 2 */
423        .debug_aranges  0 : { *(.debug_aranges) }
424        .debug_pubnames 0 : { *(.debug_pubnames) }
425        /* DWARF 2 */
426        .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
427        .debug_abbrev   0 : { *(.debug_abbrev) }
428        .debug_line     0 : { *(.debug_line) }
429        .debug_frame    0 : { *(.debug_frame) }
430        .debug_str      0 : { *(.debug_str) }
431        .debug_loc      0 : { *(.debug_loc) }
432        .debug_macinfo  0 : { *(.debug_macinfo) }
433        /* SGI/MIPS DWARF 2 extensions */
434        .debug_weaknames 0 : { *(.debug_weaknames) }
435        .debug_funcnames 0 : { *(.debug_funcnames) }
436        .debug_typenames 0 : { *(.debug_typenames) }
437        .debug_varnames  0 : { *(.debug_varnames) }
438        /* DWARF 3 */
439        .debug_pubtypes 0 : { *(.debug_pubtypes) }
440        .debug_ranges   0 : { *(.debug_ranges) }
441        /* DWARF extension */
442        .debug_macro    0 : { *(.debug_macro) }
443        .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }
444        .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
445        /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
446
447        /*
448         * This is a RTEMS specific section to catch all unexpected input
449         * sections.  In case you get an error like
450         *   "section `.unexpected_sections' will not fit in region
451         *   `UNEXPECTED_SECTIONS'"
452         * you have to figure out the offending input section and add it to the
453         * appropriate output section definition above.
454         */
455        .unexpected_sections : { *(*) } > UNEXPECTED_SECTIONS
456}
Note: See TracBrowser for help on using the repository browser.