source: rtems/c/src/lib/libbsp/m68k/mcf5329/startup/linkcmdsflash @ d60e760

4.115
Last change on this file since d60e760 was d60e760, checked in by Sebastian Huber <sebastian.huber@…>, on 04/22/14 at 07:45:39

bsps: Fix TLS support in linker command files

The TLS section symbols had wrong values in case of an empty TLS data
section and a nonempty TLS BSS section.

  • Property mode set to 100644
File size: 5.3 KB
Line 
1/*
2 *  This file contains directives for the GNU linker which are specific
3 *  to the Freescale ColdFire mcf52235
4 *
5 *  COPYRIGHT (c) 1989-1999.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.org/license/LICENSE.e
11 */
12
13/*
14 * Declare some sizes.
15 */
16_CoreSRamBase = DEFINED(RamBase) ? RamBase : 0x80000000;
17_CoreSRamSize = DEFINED(RamSize) ? RamSize : 32K;
18
19RamBase = DEFINED(RamBase) ? RamBase : 0x40000000;
20RamSize = DEFINED(RamSize) ? RamSize : 32M;
21
22_BootFlashBase = DEFINED(_FlashBase) ? _FlashBase : 0x00000000;
23_BootFlashSize = DEFINED(_FlashBase) ? _FlashBase : 2M;
24
25HeapSize = DEFINED(HeapSize) ? HeapSize : 0;
26_StackSize = DEFINED(_StackSize) ? _StackSize : 0x400;
27
28_VBR = 0x40000000;
29
30ENTRY(start)
31
32MEMORY
33{
34    core_sram : ORIGIN = 0x80000000, LENGTH = 32K
35    boot_flash : ORIGIN = 0x00000000, LENGTH = 2M
36    dram : ORIGIN = 0x40000000, LENGTH = 32M
37}
38
39SECTIONS
40{
41    /*
42    * Text, data and bss segments
43    */
44    .text : {
45
46        *(.text*)
47        *(.ram_code)
48
49        /*
50        * C++ constructors/destructors
51        */
52        *(.gnu.linkonce.t.*)
53
54        /*
55        * Initialization and finalization code.
56        *
57        * Various files can provide initialization and finalization
58        * functions.  crtbegin.o and crtend.o are two instances. The
59        * body of these functions are in .init and .fini sections. We
60        * accumulate the bodies here, and prepend function prologues
61        * from crti.o and function epilogues from crtn.o. crti.o must
62        * be linked first; crtn.o must be linked last.  Because these
63        * are wildcards, it doesn't matter if the user does not
64        * actually link against crti.o and crtn.o; the linker won't
65        * look for a file to match a wildcard.  The wildcard also
66        * means that it doesn't matter which directory crti.o and
67        * crtn.o are in.
68        */
69        PROVIDE (_init = .);
70        *crti.o(.init)
71        *(.init)
72        *crtn.o(.init)
73        PROVIDE (_fini = .);
74        *crti.o(.fini)
75        *(.fini)
76        *crtn.o(.fini)
77
78        /*
79            * Special FreeBSD sysctl sections.
80            */
81        . = ALIGN (16);
82        __start_set_sysctl_set = .;
83        *(set_sysctl_*);
84        __stop_set_sysctl_set = ABSOLUTE(.);
85        *(set_domain_*);
86        *(set_pseudo_*);
87
88        /*
89        * C++ constructors/destructors
90        *
91        * gcc uses crtbegin.o to find the start of the constructors
92        * and destructors so we make sure it is first.  Because this
93        * is a wildcard, it doesn't matter if the user does not
94        * actually link against crtbegin.o; the linker won't look for
95        * a file to match a wildcard.  The wildcard also means that
96        * it doesn't matter which directory crtbegin.o is in. The
97        * constructor and destructor list are terminated in
98        * crtend.o.  The same comments apply to it.
99        */
100        . = ALIGN (16);
101        *crtbegin.o(.ctors)
102        *(.ctors)
103        *crtend.o(.ctors)
104        *crtbegin.o(.dtors)
105        *(.dtors)
106        *crtend.o(.dtors)
107
108        /*
109        * Exception frame info
110        */
111        . = ALIGN (16);
112        *(.eh_frame)
113
114        /*
115        * Read-only data
116        */
117        . = ALIGN (16);
118        _rodata_start = . ;
119        *(.rodata*)
120        *(.gnu.linkonce.r*)
121
122        . = ALIGN (16);
123
124        *(.console_gdb_xfer)
125        *(.bootstrap_data)
126    } > boot_flash
127
128    .tdata : {
129        _TLS_Data_begin = .;
130        *(.tdata .tdata.* .gnu.linkonce.td.*)
131        _TLS_Data_end = .;
132        . = ALIGN(16);
133        _estuff = .;
134        PROVIDE (_etext = .);
135    } > boot_flash
136
137    .tbss : {
138        _TLS_BSS_begin = .;
139        *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
140        _TLS_BSS_end = .;
141    } > boot_flash
142
143    _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
144    _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
145    _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
146    _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
147    _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
148    _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
149
150    .data 0x40000500 : AT (_estuff)
151    {
152        PROVIDE( _data_dest_start = . );
153        PROVIDE( _copy_start = .);
154        *(.data*)
155        *(.gnu.linkonce.d*)
156        *(.gcc_except_table*)
157        *(.jcr)
158        . = ALIGN (16);
159        PROVIDE (_edata = .);
160        PROVIDE (_copy_end = .);
161        PROVIDE (_data_dest_end = . );
162    } > dram
163
164    _data_src_start = _estuff;
165    _data_src_end = _data_dest_start + SIZEOF(.data);
166
167    .bss :
168    {
169        _clear_start = .;
170        *(.bss*)
171        *(COMMON)
172        . = ALIGN (16);
173        PROVIDE (_end = .);
174
175        _clear_end = .;
176        WorkAreaBase = .;
177    } > dram
178
179    .start_stack :
180    {
181        /*
182         * Starting Stack
183         */
184        . += _StackSize;
185        . = ALIGN (16);
186        PROVIDE(_StackInit = .);
187    } > core_sram
188
189    /* Stabs debugging sections.  */
190    .stab 0 : { *(.stab) }
191    .stabstr 0 : { *(.stabstr) }
192    .stab.excl 0 : { *(.stab.excl) }
193    .stab.exclstr 0 : { *(.stab.exclstr) }
194    .stab.index 0 : { *(.stab.index) }
195    .stab.indexstr 0 : { *(.stab.indexstr) }
196    .comment 0 : { *(.comment) }
197
198    PROVIDE (end_of_all = .);
199}
Note: See TracBrowser for help on using the repository browser.