source: rtems/c/src/lib/libbsp/m68k/shared/startup/linkcmds.base @ 6440903c

4.115
Last change on this file since 6440903c was 6440903c, checked in by Sebastian Huber <sebastian.huber@…>, on 12/05/13 at 09:26:08

bsps/m68k: Add and use linkcmds.base

  • Property mode set to 100644
File size: 10.1 KB
Line 
1/*
2 * Copyright (c) 2008-2013 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Dornierstr. 4
6 *  82178 Puchheim
7 *  Germany
8 *  <rtems@embedded-brains.de>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.com/license/LICENSE.
13 */
14
15OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k")
16
17OUTPUT_ARCH(m68k)
18
19ENTRY(_start)
20
21bsp_initstack_size = DEFINED (bsp_initstack_size) ? bsp_initstack_size : 2048;
22
23MEMORY {
24        UNEXPECTED_SECTIONS : ORIGIN = 0xffffffff, LENGTH = 0
25}
26
27SECTIONS {
28        .vector0 : ALIGN_WITH_INPUT {
29                bsp_vector0_begin = .;
30                *(.vectors*)
31                bsp_vector0_end = .;
32        } > REGION_TEXT AT > REGION_TEXT
33        bsp_vector0_size = bsp_vector0_end - bsp_vector0_begin;
34
35        .text : ALIGN_WITH_INPUT {
36                *(.text.unlikely .text.*_unlikely)
37                *(.text .stub .text.* .gnu.linkonce.t.*)
38                /* .gnu.warning sections are handled specially by elf32.em.  */
39                *(.gnu.warning)
40        } > REGION_TEXT AT > REGION_TEXT_LOAD
41        .init : ALIGN_WITH_INPUT {
42                KEEP (*(.init))
43        } > REGION_TEXT AT > REGION_TEXT_LOAD
44        .fini : ALIGN_WITH_INPUT {
45                KEEP (*(.fini))
46        } > REGION_TEXT AT > REGION_TEXT_LOAD
47        .rodata : ALIGN_WITH_INPUT {
48                *(.rodata .rodata.* .gnu.linkonce.r.*)
49        } > REGION_TEXT AT > REGION_TEXT_LOAD
50        .rodata1 : ALIGN_WITH_INPUT {
51                *(.rodata1)
52        } > REGION_TEXT AT > REGION_TEXT_LOAD
53        .eh_frame : ALIGN_WITH_INPUT {
54                KEEP (*(.eh_frame))
55        } > REGION_TEXT AT > REGION_TEXT_LOAD
56        .gcc_except_table : ALIGN_WITH_INPUT {
57                *(.gcc_except_table .gcc_except_table.*)
58        } > REGION_TEXT AT > REGION_TEXT_LOAD
59        .tdata : ALIGN_WITH_INPUT {
60                *(.tdata .tdata.* .gnu.linkonce.td.*)
61        } > REGION_TEXT AT > REGION_TEXT_LOAD
62        .tbss : ALIGN_WITH_INPUT {
63                *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
64        } > REGION_TEXT AT > REGION_TEXT_LOAD
65        .preinit_array : ALIGN_WITH_INPUT {
66                PROVIDE_HIDDEN (__preinit_array_start = .);
67                KEEP (*(.preinit_array))
68                PROVIDE_HIDDEN (__preinit_array_end = .);
69        } > REGION_TEXT AT > REGION_TEXT_LOAD
70        .init_array : ALIGN_WITH_INPUT {
71                PROVIDE_HIDDEN (__init_array_start = .);
72                KEEP (*(SORT(.init_array.*)))
73                KEEP (*(.init_array))
74                PROVIDE_HIDDEN (__init_array_end = .);
75        } > REGION_TEXT AT > REGION_TEXT_LOAD
76        .fini_array : ALIGN_WITH_INPUT {
77                PROVIDE_HIDDEN (__fini_array_start = .);
78                KEEP (*(.fini_array))
79                KEEP (*(SORT(.fini_array.*)))
80                PROVIDE_HIDDEN (__fini_array_end = .);
81        } > REGION_TEXT AT > REGION_TEXT_LOAD
82        .ctors : ALIGN_WITH_INPUT {
83                /* gcc uses crtbegin.o to find the start of
84                   the constructors, so we make sure it is
85                   first.  Because this is a wildcard, it
86                   doesn't matter if the user does not
87                   actually link against crtbegin.o; the
88                   linker won't look for a file to match a
89                   wildcard.  The wildcard also means that it
90                   doesn't matter which directory crtbegin.o
91                   is in.  */
92                KEEP (*crtbegin.o(.ctors))
93                KEEP (*crtbegin?.o(.ctors))
94                /* We don't want to include the .ctor section from
95                   the crtend.o file until after the sorted ctors.
96                   The .ctor section from the crtend file contains the
97                   end of ctors marker and it must be last */
98                KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
99                KEEP (*(SORT(.ctors.*)))
100                KEEP (*(.ctors))
101        } > REGION_TEXT AT > REGION_TEXT_LOAD
102        .dtors : ALIGN_WITH_INPUT {
103                KEEP (*crtbegin.o(.dtors))
104                KEEP (*crtbegin?.o(.dtors))
105                KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
106                KEEP (*(SORT(.dtors.*)))
107                KEEP (*(.dtors))
108        } > REGION_TEXT AT > REGION_TEXT_LOAD
109        .data.rel.ro : ALIGN_WITH_INPUT {
110                *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*)
111                *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*)
112        } > REGION_TEXT AT > REGION_TEXT_LOAD
113        .jcr : ALIGN_WITH_INPUT {
114                KEEP (*(.jcr))
115        } > REGION_TEXT AT > REGION_TEXT_LOAD
116        .interp : ALIGN_WITH_INPUT {
117                *(.interp)
118        } > REGION_TEXT AT > REGION_TEXT_LOAD
119        .note.gnu.build-id : ALIGN_WITH_INPUT {
120                *(.note.gnu.build-id)
121        } > REGION_TEXT AT > REGION_TEXT_LOAD
122        .hash : ALIGN_WITH_INPUT {
123                *(.hash)
124        } > REGION_TEXT AT > REGION_TEXT_LOAD
125        .gnu.hash : ALIGN_WITH_INPUT {
126                *(.gnu.hash)
127        } > REGION_TEXT AT > REGION_TEXT_LOAD
128        .dynsym : ALIGN_WITH_INPUT {
129                *(.dynsym)
130        } > REGION_TEXT AT > REGION_TEXT_LOAD
131        .dynstr : ALIGN_WITH_INPUT {
132                *(.dynstr)
133        } > REGION_TEXT AT > REGION_TEXT_LOAD
134        .gnu.version : ALIGN_WITH_INPUT {
135                *(.gnu.version)
136        } > REGION_TEXT AT > REGION_TEXT_LOAD
137        .gnu.version_d : ALIGN_WITH_INPUT {
138                *(.gnu.version_d)
139        } > REGION_TEXT AT > REGION_TEXT_LOAD
140        .gnu.version_r : ALIGN_WITH_INPUT {
141                *(.gnu.version_r)
142        } > REGION_TEXT AT > REGION_TEXT_LOAD
143        .rel.dyn : ALIGN_WITH_INPUT {
144                *(.rel.init)
145                *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
146                *(.rel.fini)
147                *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
148                *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
149                *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
150                *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
151                *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
152                *(.rel.ctors)
153                *(.rel.dtors)
154                *(.rel.got)
155                *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
156                PROVIDE_HIDDEN (__rel_iplt_start = .);
157                *(.rel.iplt)
158                PROVIDE_HIDDEN (__rel_iplt_end = .);
159                PROVIDE_HIDDEN (__rela_iplt_start = .);
160                PROVIDE_HIDDEN (__rela_iplt_end = .);
161        } > REGION_TEXT AT > REGION_TEXT_LOAD
162        .rela.dyn : ALIGN_WITH_INPUT {
163                *(.rela.init)
164                *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
165                *(.rela.fini)
166                *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
167                *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
168                *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
169                *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
170                *(.rela.ctors)
171                *(.rela.dtors)
172                *(.rela.got)
173                *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
174                PROVIDE_HIDDEN (__rel_iplt_start = .);
175                PROVIDE_HIDDEN (__rel_iplt_end = .);
176                PROVIDE_HIDDEN (__rela_iplt_start = .);
177                *(.rela.iplt)
178                PROVIDE_HIDDEN (__rela_iplt_end = .);
179        } > REGION_TEXT AT > REGION_TEXT_LOAD
180        .rel.plt : ALIGN_WITH_INPUT {
181                *(.rel.plt)
182        } > REGION_TEXT AT > REGION_TEXT_LOAD
183        .rela.plt : ALIGN_WITH_INPUT {
184                *(.rela.plt)
185        } > REGION_TEXT AT > REGION_TEXT_LOAD
186        .plt : ALIGN_WITH_INPUT {
187                *(.plt)
188        } > REGION_TEXT AT > REGION_TEXT_LOAD
189        .iplt : ALIGN_WITH_INPUT {
190                *(.iplt)
191        } > REGION_TEXT AT > REGION_TEXT_LOAD
192        .dynamic : ALIGN_WITH_INPUT {
193                *(.dynamic)
194        } > REGION_TEXT AT > REGION_TEXT_LOAD
195        .got : ALIGN_WITH_INPUT {
196                *(.got.plt) *(.igot.plt) *(.got) *(.igot)
197        } > REGION_TEXT AT > REGION_TEXT_LOAD
198        .rtemsroset : ALIGN_WITH_INPUT {
199                /* Special FreeBSD linker set sections */
200                __start_set_sysctl_set = .;
201                *(set_sysctl_*);
202                __stop_set_sysctl_set = .;
203                *(set_domain_*);
204                *(set_pseudo_*);
205
206                KEEP (*(SORT(.rtemsroset.*)))
207        } > REGION_TEXT AT > REGION_TEXT_LOAD
208
209        .vector1 : ALIGN_WITH_INPUT {
210                bsp_vector1_begin = .;
211                . = . + (ORIGIN (REGION_TEXT) == ORIGIN (REGION_DATA) ? 0 : bsp_vector0_size);
212                bsp_vector1_end = .;
213        } > REGION_DATA AT > REGION_DATA
214        bsp_vector1_size = bsp_vector1_end - bsp_vector1_begin;
215
216        .initstack : ALIGN_WITH_INPUT {
217                bsp_initstack_begin = .;
218                . = . + bsp_initstack_size;
219                bsp_initstack_end = .;
220        } > REGION_DATA AT > REGION_DATA
221
222        .data : ALIGN_WITH_INPUT {
223                bsp_section_data_begin = .;
224                *(.data .data.* .gnu.linkonce.d.*)
225                SORT(CONSTRUCTORS)
226        } > REGION_DATA AT > REGION_DATA_LOAD
227        .data1 : ALIGN_WITH_INPUT {
228                *(.data1)
229        } > REGION_DATA AT > REGION_DATA_LOAD
230        .rtemsrwset : ALIGN_WITH_INPUT {
231                KEEP (*(SORT(.rtemsrwset.*)))
232                bsp_section_data_end = .;
233        } > REGION_DATA AT > REGION_DATA_LOAD
234        bsp_section_data_size = bsp_section_data_end - bsp_section_data_begin;
235        bsp_section_data_load_begin = LOADADDR (.data);
236        bsp_section_data_load_end = bsp_section_data_load_begin + bsp_section_data_size;
237
238        .bss : ALIGN_WITH_INPUT {
239                bsp_section_bss_begin = .;
240                *(.dynbss)
241                *(.bss .bss.* .gnu.linkonce.b.*)
242                *(COMMON)
243                bsp_section_bss_end = .;
244        } > REGION_DATA AT > REGION_DATA
245        bsp_section_bss_size = bsp_section_bss_end - bsp_section_bss_begin;
246
247        .work : ALIGN_WITH_INPUT {
248                /*
249                 * The work section will occupy the remaining REGION_DATA region and
250                 * contains the RTEMS work space and heap.
251                 */
252                bsp_section_work_begin = .;
253                . += ORIGIN (REGION_DATA) + LENGTH (REGION_DATA) - ABSOLUTE (.);
254                bsp_section_work_end = .;
255        } > REGION_DATA AT > REGION_DATA
256        bsp_section_work_size = bsp_section_work_end - bsp_section_work_begin;
257
258        /* FIXME */
259        RamBase = ORIGIN (REGION_DATA);
260        RamSize = LENGTH (REGION_DATA);
261        WorkAreaBase = bsp_section_work_begin;
262        HeapSize = 0;
263
264        /* Stabs debugging sections.  */
265        .stab          0 : { *(.stab) }
266        .stabstr       0 : { *(.stabstr) }
267        .stab.excl     0 : { *(.stab.excl) }
268        .stab.exclstr  0 : { *(.stab.exclstr) }
269        .stab.index    0 : { *(.stab.index) }
270        .stab.indexstr 0 : { *(.stab.indexstr) }
271        .comment       0 : { *(.comment) }
272        /* DWARF debug sections.
273           Symbols in the DWARF debugging sections are relative to the beginning
274           of the section so we begin them at 0.  */
275        /* DWARF 1 */
276        .debug          0 : { *(.debug) }
277        .line           0 : { *(.line) }
278        /* GNU DWARF 1 extensions */
279        .debug_srcinfo  0 : { *(.debug_srcinfo) }
280        .debug_sfnames  0 : { *(.debug_sfnames) }
281        /* DWARF 1.1 and DWARF 2 */
282        .debug_aranges  0 : { *(.debug_aranges) }
283        .debug_pubnames 0 : { *(.debug_pubnames) }
284        /* DWARF 2 */
285        .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
286        .debug_abbrev   0 : { *(.debug_abbrev) }
287        .debug_line     0 : { *(.debug_line) }
288        .debug_frame    0 : { *(.debug_frame) }
289        .debug_str      0 : { *(.debug_str) }
290        .debug_loc      0 : { *(.debug_loc) }
291        .debug_macinfo  0 : { *(.debug_macinfo) }
292        /* SGI/MIPS DWARF 2 extensions */
293        .debug_weaknames 0 : { *(.debug_weaknames) }
294        .debug_funcnames 0 : { *(.debug_funcnames) }
295        .debug_typenames 0 : { *(.debug_typenames) }
296        .debug_varnames  0 : { *(.debug_varnames) }
297        /* DWARF 3 */
298        .debug_pubtypes 0 : { *(.debug_pubtypes) }
299        .debug_ranges   0 : { *(.debug_ranges) }
300        /* DWARF extension */
301        .debug_macro    0 : { *(.debug_macro) }
302        /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
303
304        /*
305         * This is a RTEMS specific section to catch all unexpected input
306         * sections.  In case you get an error like
307         *   "section `.unexpected_sections' will not fit in region
308         *   `UNEXPECTED_SECTIONS'"
309         * you have to figure out the offending input section and add it to the
310         * appropriate output section definition above.
311         */
312        .unexpected_sections : { *(*) } > UNEXPECTED_SECTIONS
313}
Note: See TracBrowser for help on using the repository browser.