source: rtems/bsps/m68k/mcf5235/start/linkcmdsram @ 5ed00353

Last change on this file since 5ed00353 was 5ed00353, checked in by Sebastian Huber <sebastian.huber@…>, on 07/14/22 at 12:41:03

bsps: Sort .noinit* sections

Sort the .noinit* input sections by name first, then by alignment if two
sections have the same name. This allows the placement of begin/end symbols to
initialize some areas with a special value.

Update #4678.

  • Property mode set to 100644
File size: 6.8 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/*
4 *  This file contains directives for the GNU linker which are specific
5 *  to the Freescale ColdFire mcf5235
6 *
7 *  COPYRIGHT (c) 1989-1999.
8 *  On-Line Applications Research Corporation (OAR).
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 *    notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 *    notice, this list of conditions and the following disclaimer in the
17 *    documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32/*
33 * declare for the MCF5235_BSP_START_FROM_FLASH
34 * 0 - use debug monitor to load to ram
35 * 1 - load everything from flash from scratch
36 */
37MCF5235_BSP_START_FROM_FLASH = 0;
38
39/*
40 * Declare some sizes.
41 */
42RamBase = DEFINED(RamBase) ? RamBase : 0x0;
43RamSize = DEFINED(RamSize) ? RamSize : 16M;
44RamEnd = RamBase + RamSize;
45HeapSize = DEFINED(HeapSize) ? HeapSize : 0;
46
47
48/*
49 * System clock speed
50 */
51_CPUClockSpeed = DEFINED(_CPUClockSpeed) ? _CPUClockSpeed : 150000000 ;
52
53/*
54 * Location of on-chip devices
55 */
56__IPSBAR = DEFINED(__IPSBAR) ? __IPSBAR : 0x40000000 ;
57__SRAMBASE = DEFINED(__SRAMBASE) ? __SRAMBASE : 0x20000000 ;
58_VBR = 0x0;
59
60ENTRY(start)
61STARTUP(start.o)
62
63MEMORY
64{
65    ram : ORIGIN = 0, LENGTH = 16M
66    sram : ORIGIN = 0x20000000, LENGTH = 64K
67    flash : ORIGIN = 0xFFE00000, LENGTH = 2M
68}
69
70SECTIONS
71{
72   
73    _header_offset = 0;
74   
75    /*
76     * Text, data and bss segments
77     */
78    .text 0x40000 : {
79       
80       *(.text*)
81        *(.ram_code)
82
83        /*
84         * C++ constructors/destructors
85         */
86        *(.gnu.linkonce.t.*)
87
88        /*
89         * Initialization and finalization code.
90              *
91              * Various files can provide initialization and finalization
92         * functions.  crtbegin.o and crtend.o are two instances. The
93         * body of these functions are in .init and .fini sections. We
94         * accumulate the bodies here, and prepend function prologues
95         * from crti.o and function epilogues from crtn.o. crti.o must
96         * be linked first; crtn.o must be linked last.  Because these
97         * are wildcards, it doesn't matter if the user does not
98         * actually link against crti.o and crtn.o; the linker won't
99         * look for a file to match a wildcard.  The wildcard also
100         * means that it doesn't matter which directory crti.o and
101         * crtn.o are in.
102         */
103        PROVIDE (_init = .);
104        *crti.o(.init)
105        *(.init)
106        *crtn.o(.init)
107        PROVIDE (_fini = .);
108        *crti.o(.fini)
109        *(.fini)
110        *crtn.o(.fini)
111
112        /*
113         * Special FreeBSD sysctl sections.
114         */
115        . = ALIGN (16);
116        __start_set_sysctl_set = .;
117        *(set_sysctl_*);
118        __stop_set_sysctl_set = ABSOLUTE(.);
119        *(set_domain_*);
120        *(set_pseudo_*);
121
122
123        /*
124         * C++ constructors/destructors
125         *
126         * gcc uses crtbegin.o to find the start of the constructors
127         * and destructors so we make sure it is first.  Because this
128         * is a wildcard, it doesn't matter if the user does not
129         * actually link against crtbegin.o; the linker won't look for
130         * a file to match a wildcard.  The wildcard also means that
131         * it doesn't matter which directory crtbegin.o is in. The
132         * constructor and destructor list are terminated in
133         * crtend.o.  The same comments apply to it.
134         */
135        . = ALIGN (16);
136        *crtbegin.o(.ctors)
137        *(.ctors)
138        *crtend.o(.ctors)
139        *crtbegin.o(.dtors)
140        *(.dtors)
141        *crtend.o(.dtors)
142
143        /*
144         * Exception frame info
145         */
146        . = ALIGN (16);
147        *(.eh_frame)
148
149        /*
150         * Read-only data
151         */
152        . = ALIGN (16);
153        _rodata_start = . ;
154        *(.rodata*)
155        KEEP (*(SORT(.rtemsroset.*)))
156        *(.gnu.linkonce.r*)
157       
158        . = ALIGN (16);
159
160        *(.console_gdb_xfer)
161        *(.bootstrap_data)
162        . = ALIGN(16);
163        _estuff = .;
164    PROVIDE (_etext = .);
165    } >ram
166
167    .tdata : {
168        _TLS_Data_begin = .;
169        *(.tdata .tdata.* .gnu.linkonce.td.*)
170        _TLS_Data_end = .;
171    } >ram
172
173    .tbss : {
174        _TLS_BSS_begin = .;
175        *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
176        _TLS_BSS_end = .;
177    } >ram
178
179    _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
180    _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
181    _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
182    _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
183    _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
184    _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
185       
186        .data : {
187            PROVIDE( _data_dest_start = . );
188            PROVIDE( _copy_start = .);
189            *(.data)
190            KEEP (*(SORT(.rtemsrwset.*)))
191            *(.gnu.linkonce.d*)
192            *(.gcc_except_table*)
193            *(.jcr)
194            . = ALIGN (16);
195            PROVIDE (_edata = .);
196        PROVIDE (_copy_end = .);
197        PROVIDE (_data_dest_end = . );
198        } >ram
199
200        _data_src_start = _estuff;
201        _data_src_end = _data_dest_start + SIZEOF(.data);       
202       
203        .bss : {
204                _clear_start = .;
205                *(.bss*)
206                *(COMMON)
207                . = ALIGN (16);
208                PROVIDE (end = .);
209                _clear_end = .;
210        } >ram
211
212        .noinit (NOLOAD) : {
213                *(SORT_BY_NAME (SORT_BY_ALIGNMENT (.noinit*)))
214        } > ram
215
216        .rtemsstack (NOLOAD) : {
217                *(SORT(.rtemsstack.*))
218                WorkAreaBase = .;
219        } >ram
220
221  /* Stabs debugging sections.  */
222  .stab 0 : { *(.stab) }
223  .stabstr 0 : { *(.stabstr) }
224  .stab.excl 0 : { *(.stab.excl) }
225  .stab.exclstr 0 : { *(.stab.exclstr) }
226  .stab.index 0 : { *(.stab.index) }
227  .stab.indexstr 0 : { *(.stab.indexstr) }
228  .comment 0 : { *(.comment) }
229
230PROVIDE (end_of_all = .); 
231}
Note: See TracBrowser for help on using the repository browser.