source: rtems/bsps/m68k/shared/start/linkcmds.base @ a9a99164

Last change on this file since a9a99164 was a9a99164, checked in by Joel Sherrill <joel@…>, on 07/08/22 at 13:58:37

bsps/m68k/shared: Change license to BSD-2

Updates #3053.

  • Property mode set to 100644
File size: 12.1 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/*
4 * Copyright (c) 2008, 2018 embedded brains GmbH.  All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 *    notice, this list of conditions and the following disclaimer in the
13 *    documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
26 */
27
28OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k")
29
30OUTPUT_ARCH(m68k)
31
32ENTRY(start)
33STARTUP(start.o)
34
35MEMORY {
36        UNEXPECTED_SECTIONS : ORIGIN = 0xffffffff, LENGTH = 0
37}
38
39SECTIONS {
40        .vector0 : ALIGN_WITH_INPUT {
41                bsp_vector0_begin = .;
42                KEEP (*(.vectors*))
43                bsp_vector0_end = .;
44        } > REGION_TEXT AT > REGION_TEXT
45        bsp_vector0_size = bsp_vector0_end - bsp_vector0_begin;
46
47        .text : ALIGN_WITH_INPUT {
48                *(.text.unlikely .text.*_unlikely)
49                *(.text .stub .text.* .gnu.linkonce.t.*)
50                /* .gnu.warning sections are handled specially by elf32.em.  */
51                *(.gnu.warning)
52        } > REGION_TEXT AT > REGION_TEXT_LOAD
53        .init : ALIGN_WITH_INPUT {
54                KEEP (*(.init))
55        } > REGION_TEXT AT > REGION_TEXT_LOAD
56        .fini : ALIGN_WITH_INPUT {
57                KEEP (*(.fini))
58        } > REGION_TEXT AT > REGION_TEXT_LOAD
59        .rodata : ALIGN_WITH_INPUT {
60                *(.rodata .rodata.* .gnu.linkonce.r.*)
61        } > REGION_TEXT AT > REGION_TEXT_LOAD
62        .rodata1 : ALIGN_WITH_INPUT {
63                *(.rodata1)
64        } > REGION_TEXT AT > REGION_TEXT_LOAD
65        .eh_frame : ALIGN_WITH_INPUT {
66                KEEP (*(.eh_frame))
67        } > REGION_TEXT AT > REGION_TEXT_LOAD
68        .gcc_except_table : ALIGN_WITH_INPUT {
69                *(.gcc_except_table .gcc_except_table.*)
70        } > REGION_TEXT AT > REGION_TEXT_LOAD
71        .tdata : ALIGN_WITH_INPUT {
72                _TLS_Data_begin = .;
73                *(.tdata .tdata.* .gnu.linkonce.td.*)
74                _TLS_Data_end = .;
75        } > REGION_TEXT AT > REGION_TEXT_LOAD
76        .tbss : ALIGN_WITH_INPUT {
77                _TLS_BSS_begin = .;
78                *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
79                _TLS_BSS_end = .;
80        } > REGION_TEXT AT > REGION_TEXT_LOAD
81        _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
82        _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
83        _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
84        _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
85        _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
86        _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
87        .preinit_array : ALIGN_WITH_INPUT {
88                PROVIDE_HIDDEN (__preinit_array_start = .);
89                KEEP (*(.preinit_array))
90                PROVIDE_HIDDEN (__preinit_array_end = .);
91        } > REGION_TEXT AT > REGION_TEXT_LOAD
92        .init_array : ALIGN_WITH_INPUT {
93                PROVIDE_HIDDEN (__init_array_start = .);
94                KEEP (*(SORT(.init_array.*)))
95                KEEP (*(.init_array))
96                PROVIDE_HIDDEN (__init_array_end = .);
97        } > REGION_TEXT AT > REGION_TEXT_LOAD
98        .fini_array : ALIGN_WITH_INPUT {
99                PROVIDE_HIDDEN (__fini_array_start = .);
100                KEEP (*(.fini_array))
101                KEEP (*(SORT(.fini_array.*)))
102                PROVIDE_HIDDEN (__fini_array_end = .);
103        } > REGION_TEXT AT > REGION_TEXT_LOAD
104        .ctors : ALIGN_WITH_INPUT {
105                /* gcc uses crtbegin.o to find the start of
106                   the constructors, so we make sure it is
107                   first.  Because this is a wildcard, it
108                   doesn't matter if the user does not
109                   actually link against crtbegin.o; the
110                   linker won't look for a file to match a
111                   wildcard.  The wildcard also means that it
112                   doesn't matter which directory crtbegin.o
113                   is in.  */
114                KEEP (*crtbegin.o(.ctors))
115                KEEP (*crtbegin?.o(.ctors))
116                /* We don't want to include the .ctor section from
117                   the crtend.o file until after the sorted ctors.
118                   The .ctor section from the crtend file contains the
119                   end of ctors marker and it must be last */
120                KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
121                KEEP (*(SORT(.ctors.*)))
122                KEEP (*(.ctors))
123        } > REGION_TEXT AT > REGION_TEXT_LOAD
124        .dtors : ALIGN_WITH_INPUT {
125                KEEP (*crtbegin.o(.dtors))
126                KEEP (*crtbegin?.o(.dtors))
127                KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
128                KEEP (*(SORT(.dtors.*)))
129                KEEP (*(.dtors))
130        } > REGION_TEXT AT > REGION_TEXT_LOAD
131        .data.rel.ro : ALIGN_WITH_INPUT {
132                *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*)
133                *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*)
134        } > REGION_TEXT AT > REGION_TEXT_LOAD
135        .jcr : ALIGN_WITH_INPUT {
136                KEEP (*(.jcr))
137        } > REGION_TEXT AT > REGION_TEXT_LOAD
138        .interp : ALIGN_WITH_INPUT {
139                *(.interp)
140        } > REGION_TEXT AT > REGION_TEXT_LOAD
141        .note.gnu.build-id : ALIGN_WITH_INPUT {
142                *(.note.gnu.build-id)
143        } > REGION_TEXT AT > REGION_TEXT_LOAD
144        .hash : ALIGN_WITH_INPUT {
145                *(.hash)
146        } > REGION_TEXT AT > REGION_TEXT_LOAD
147        .gnu.hash : ALIGN_WITH_INPUT {
148                *(.gnu.hash)
149        } > REGION_TEXT AT > REGION_TEXT_LOAD
150        .dynsym : ALIGN_WITH_INPUT {
151                *(.dynsym)
152        } > REGION_TEXT AT > REGION_TEXT_LOAD
153        .dynstr : ALIGN_WITH_INPUT {
154                *(.dynstr)
155        } > REGION_TEXT AT > REGION_TEXT_LOAD
156        .gnu.version : ALIGN_WITH_INPUT {
157                *(.gnu.version)
158        } > REGION_TEXT AT > REGION_TEXT_LOAD
159        .gnu.version_d : ALIGN_WITH_INPUT {
160                *(.gnu.version_d)
161        } > REGION_TEXT AT > REGION_TEXT_LOAD
162        .gnu.version_r : ALIGN_WITH_INPUT {
163                *(.gnu.version_r)
164        } > REGION_TEXT AT > REGION_TEXT_LOAD
165        .rel.dyn : ALIGN_WITH_INPUT {
166                *(.rel.init)
167                *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
168                *(.rel.fini)
169                *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
170                *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
171                *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
172                *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
173                *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
174                *(.rel.ctors)
175                *(.rel.dtors)
176                *(.rel.got)
177                *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
178                PROVIDE_HIDDEN (__rel_iplt_start = .);
179                *(.rel.iplt)
180                PROVIDE_HIDDEN (__rel_iplt_end = .);
181                PROVIDE_HIDDEN (__rela_iplt_start = .);
182                PROVIDE_HIDDEN (__rela_iplt_end = .);
183        } > REGION_TEXT AT > REGION_TEXT_LOAD
184        .rela.dyn : ALIGN_WITH_INPUT {
185                *(.rela.init)
186                *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
187                *(.rela.fini)
188                *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
189                *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
190                *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
191                *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
192                *(.rela.ctors)
193                *(.rela.dtors)
194                *(.rela.got)
195                *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
196                *(.rela.rtemsroset*)
197                *(.rela.rtemsrwset*)
198                PROVIDE_HIDDEN (__rel_iplt_start = .);
199                PROVIDE_HIDDEN (__rel_iplt_end = .);
200                PROVIDE_HIDDEN (__rela_iplt_start = .);
201                *(.rela.iplt)
202                PROVIDE_HIDDEN (__rela_iplt_end = .);
203        } > REGION_TEXT AT > REGION_TEXT_LOAD
204        .rel.plt : ALIGN_WITH_INPUT {
205                *(.rel.plt)
206        } > REGION_TEXT AT > REGION_TEXT_LOAD
207        .rela.plt : ALIGN_WITH_INPUT {
208                *(.rela.plt)
209        } > REGION_TEXT AT > REGION_TEXT_LOAD
210        .plt : ALIGN_WITH_INPUT {
211                *(.plt)
212        } > REGION_TEXT AT > REGION_TEXT_LOAD
213        .iplt : ALIGN_WITH_INPUT {
214                *(.iplt)
215        } > REGION_TEXT AT > REGION_TEXT_LOAD
216        .dynamic : ALIGN_WITH_INPUT {
217                *(.dynamic)
218        } > REGION_TEXT AT > REGION_TEXT_LOAD
219        .got : ALIGN_WITH_INPUT {
220                *(.got.plt) *(.igot.plt) *(.got) *(.igot)
221        } > REGION_TEXT AT > REGION_TEXT_LOAD
222        .rtemsroset : ALIGN_WITH_INPUT {
223                /* Special FreeBSD linker set sections */
224                __start_set_sysctl_set = .;
225                *(set_sysctl_*);
226                __stop_set_sysctl_set = .;
227                *(set_domain_*);
228                *(set_pseudo_*);
229
230                KEEP (*(SORT(.rtemsroset.*)))
231        } > REGION_TEXT AT > REGION_TEXT_LOAD
232
233        .vector1 : ALIGN_WITH_INPUT {
234                bsp_vector1_begin = .;
235                . = . + (ORIGIN (REGION_TEXT) == ORIGIN (REGION_DATA) ? 0 : bsp_vector0_size);
236                bsp_vector1_end = .;
237        } > REGION_DATA AT > REGION_DATA
238        bsp_vector1_size = bsp_vector1_end - bsp_vector1_begin;
239
240        .data : ALIGN_WITH_INPUT {
241                bsp_section_data_begin = .;
242                *(.data .data.* .gnu.linkonce.d.*)
243                SORT(CONSTRUCTORS)
244        } > REGION_DATA AT > REGION_DATA_LOAD
245        .data1 : ALIGN_WITH_INPUT {
246                *(.data1)
247        } > REGION_DATA AT > REGION_DATA_LOAD
248        .rtemsrwset : ALIGN_WITH_INPUT {
249                KEEP (*(SORT(.rtemsrwset.*)))
250                bsp_section_data_end = .;
251        } > REGION_DATA AT > REGION_DATA_LOAD
252        bsp_section_data_size = bsp_section_data_end - bsp_section_data_begin;
253        bsp_section_data_load_begin = LOADADDR (.data);
254        bsp_section_data_load_end = bsp_section_data_load_begin + bsp_section_data_size;
255
256        .bss : ALIGN_WITH_INPUT {
257                bsp_section_bss_begin = .;
258                *(.dynbss)
259                *(.bss .bss.* .gnu.linkonce.b.*)
260                *(COMMON)
261                bsp_section_bss_end = .;
262        } > REGION_DATA AT > REGION_DATA
263        bsp_section_bss_size = bsp_section_bss_end - bsp_section_bss_begin;
264
265        .noinit (NOLOAD) : ALIGN_WITH_INPUT {
266                bsp_section_noinit_begin = .;
267                *(.noinit*)
268                bsp_section_noinit_end = .;
269        } > REGION_DATA AT > REGION_DATA
270        bsp_section_noinit_size = bsp_section_noinit_end - bsp_section_noinit_begin;
271
272        .rtemsstack (NOLOAD) : ALIGN_WITH_INPUT {
273                *(SORT(.rtemsstack.*))
274        } > REGION_DATA AT > REGION_DATA
275
276        .work : ALIGN_WITH_INPUT {
277                /*
278                 * The work section will occupy the remaining REGION_DATA region and
279                 * contains the RTEMS work space and heap.
280                 */
281                bsp_section_work_begin = .;
282                . += ORIGIN (REGION_DATA) + LENGTH (REGION_DATA) - ABSOLUTE (.);
283                bsp_section_work_end = .;
284        } > REGION_DATA AT > REGION_DATA
285        bsp_section_work_size = bsp_section_work_end - bsp_section_work_begin;
286
287        /* FIXME */
288        RamBase = ORIGIN (REGION_DATA);
289        RamSize = LENGTH (REGION_DATA);
290        RamEnd = RamBase + RamSize;
291        WorkAreaBase = bsp_section_work_begin;
292        HeapSize = 0;
293
294        /* Stabs debugging sections.  */
295        .stab          0 : { *(.stab) }
296        .stabstr       0 : { *(.stabstr) }
297        .stab.excl     0 : { *(.stab.excl) }
298        .stab.exclstr  0 : { *(.stab.exclstr) }
299        .stab.index    0 : { *(.stab.index) }
300        .stab.indexstr 0 : { *(.stab.indexstr) }
301        .comment       0 : { *(.comment) }
302        /* DWARF debug sections.
303           Symbols in the DWARF debugging sections are relative to the beginning
304           of the section so we begin them at 0.  */
305        /* DWARF 1.  */
306        .debug          0 : { *(.debug) }
307        .line           0 : { *(.line) }
308        /* GNU DWARF 1 extensions.  */
309        .debug_srcinfo  0 : { *(.debug_srcinfo) }
310        .debug_sfnames  0 : { *(.debug_sfnames) }
311        /* DWARF 1.1 and DWARF 2.  */
312        .debug_aranges  0 : { *(.debug_aranges) }
313        .debug_pubnames 0 : { *(.debug_pubnames) }
314        /* DWARF 2.  */
315        .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
316        .debug_abbrev   0 : { *(.debug_abbrev) }
317        .debug_line     0 : { *(.debug_line .debug_line.* .debug_line_end) }
318        .debug_frame    0 : { *(.debug_frame) }
319        .debug_str      0 : { *(.debug_str) }
320        .debug_loc      0 : { *(.debug_loc) }
321        .debug_macinfo  0 : { *(.debug_macinfo) }
322        /* SGI/MIPS DWARF 2 extensions.  */
323        .debug_weaknames 0 : { *(.debug_weaknames) }
324        .debug_funcnames 0 : { *(.debug_funcnames) }
325        .debug_typenames 0 : { *(.debug_typenames) }
326        .debug_varnames  0 : { *(.debug_varnames) }
327        /* DWARF 3.  */
328        .debug_pubtypes 0 : { *(.debug_pubtypes) }
329        .debug_ranges   0 : { *(.debug_ranges) }
330        /* DWARF 5.  */
331        .debug_addr     0 : { *(.debug_addr) }
332        .debug_line_str 0 : { *(.debug_line_str) }
333        .debug_loclists 0 : { *(.debug_loclists) }
334        .debug_macro    0 : { *(.debug_macro) }
335        .debug_names    0 : { *(.debug_names) }
336        .debug_rnglists 0 : { *(.debug_rnglists) }
337        .debug_str_offsets 0 : { *(.debug_str_offsets) }
338        .debug_sup      0 : { *(.debug_sup) }
339        /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
340
341        /*
342         * This is a RTEMS specific section to catch all unexpected input
343         * sections.  In case you get an error like
344         *   "section `.unexpected_sections' will not fit in region
345         *   `UNEXPECTED_SECTIONS'"
346         * you have to figure out the offending input section and add it to the
347         * appropriate output section definition above.
348         */
349        .unexpected_sections : { *(*) } > UNEXPECTED_SECTIONS
350}
Note: See TracBrowser for help on using the repository browser.