source: rtems/c/src/lib/libbsp/mips/csb350/startup/linkcmds @ 6279149

4.115
Last change on this file since 6279149 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: 4.6 KB
Line 
1/*
2 *  Linker script for CSB350 AU1100 based board
3 */
4
5/*    . = 0x80020000; */
6
7/*
8 * Declare some sizes.
9 */
10
11_sdram_base = DEFINED(_sdram_base) ? _sdram_base : 0x80400000;
12_sdram_size = DEFINED(_sdram_size) ? _sdram_size : 12M;
13
14/* standard items provided by RTEMS linkcmds files */
15RamBase = _sdram_base;
16RamSize = _sdram_size;
17HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0;
18_StackSize = DEFINED(_StackSize) ? _StackSize : 0x4000;
19
20
21MEMORY
22{
23   ram      : ORIGIN = 0x80400000, LENGTH = 12M
24}
25
26SECTIONS
27{
28    .text :
29    {
30       _ftext = . ;
31
32      */start.o(.text)
33
34      *(.text*)
35      *(.gnu.linkonce.t*)
36      *(.mips16.fn.*)
37      *(.mips16.call.*)
38      *(.reginfo*)
39      PROVIDE (__runtime_reloc_start = .);
40      *(.rel.sdata)
41      *(.rel.dyn)
42      PROVIDE (__runtime_reloc_stop = .);
43
44      /*
45       * Special FreeBSD sysctl sections.
46       */
47      . = ALIGN (16);
48      __start_set_sysctl_set = .;
49      *(set_sysctl_*);
50      __stop_set_sysctl_set = ABSOLUTE(.);
51      *(set_domain_*);
52      *(set_pseudo_*);
53
54      *(.gcc_except_table*)
55      *(.eh_frame_hdr)
56      *(.eh_frame)
57    } >ram 
58
59  .init :
60  {
61     KEEP(*(.init))
62
63  } > ram
64
65  .fini :
66  {
67     KEEP(*(.fini))
68
69  }  >ram
70
71
72  .ctors    :
73  {
74    /* gcc uses crtbegin.o to find the start of
75       the constructors, so we make sure it is
76       first.  Because this is a wildcard, it
77       doesn't matter if the user does not
78       actually link against crtbegin.o; the
79       linker won't look for a file to match a
80       wildcard.  The wildcard also means that it
81       doesn't matter which directory crtbegin.o
82       is in.  */
83
84    KEEP (*crtbegin.o(.ctors))
85
86    /* We don't want to include the .ctor section from
87       from the crtend.o file until after the sorted ctors.
88       The .ctor section from the crtend file contains the
89       end of ctors marker and it must be last */
90
91    KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
92    KEEP (*(SORT(.ctors.*)))
93    KEEP (*(.ctors))
94  } >ram 
95
96  .dtors    :
97  {
98    KEEP (*crtbegin.o(.dtors))
99    KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
100    KEEP (*(SORT(.dtors.*)))
101    KEEP (*(.dtors))
102
103    etext  =  .;
104    _etext  =  .;
105  } >ram 
106
107
108
109  .rdata :
110  {
111    *(.rdata)
112    *(.rodata)
113    *(.rodata.*)
114    *(.gnu.linkonce.r*)
115  } >ram 
116
117  .tdata : {
118    _TLS_Data_begin = .;
119    *(.tdata .tdata.* .gnu.linkonce.td.*)
120    _TLS_Data_end = .;
121  } >ram
122
123  .tbss : {
124    _TLS_BSS_begin = .;
125    *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
126    _TLS_BSS_end = .;
127  } >ram
128
129  _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
130  _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
131  _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
132  _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
133  _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
134  _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
135
136  .data :
137  {
138    _fdata = ALIGN(16);
139
140    *(.data)
141    *(.data.*)
142    *(.gnu.linkonce.d*)
143  } >ram 
144
145  .jcr :
146  {
147    . = ALIGN(8);
148    KEEP (*(.jcr))
149
150    _gp = ALIGN(16) + 0x7440;
151    __global = _gp;
152  } >ram
153
154  .lit8 :
155  {
156    *(.lit8)
157  } >ram 
158
159  .lit4 :
160  {
161    *(.lit4)
162  } >ram   
163
164  .sdata :   
165  {
166    *(.sdata*)
167    *(.gnu.linkonce.s*)
168  } >ram 
169
170  .sbss :
171  {
172   edata  =  .;
173   _edata  =  .;
174   _fbss = .;
175    *(.sbss*)
176    *(.scommon)
177  } >ram   
178
179
180  .bss :
181  {
182    _bss_start = . ;
183    *(.bss .bss.* .gnu.linkonce.b.*)
184    *(COMMON)
185    . = ALIGN (64);
186    _stack_limit = .;
187    . += _StackSize;
188    __stack = .;
189    _stack_init = .;
190    _clear_end = .;
191    end = .;
192    _end = .;
193    . = ALIGN (1024);
194    WorkAreaBase = .;
195   
196  } >ram   
197
198
199/*
200** DWARF debug sections.
201** Symbols in the DWARF debugging sections are relative to
202** the beginning of the section so we begin them at 0. 
203*/
204
205  /* DWARF 1 */
206  .debug          0 : { *(.debug) }
207  .line           0 : { *(.line) }
208
209  /* GNU DWARF 1 extensions */
210  .debug_srcinfo  0 : { *(.debug_srcinfo) }
211  .debug_sfnames  0 : { *(.debug_sfnames) }
212
213  /* DWARF 1.1 and DWARF 2 */
214  .debug_aranges  0 : { *(.debug_aranges) }
215  .debug_pubnames 0 : { *(.debug_pubnames) }
216
217  /* DWARF 2 */
218  .debug_info     0 : { *(.debug_info) }   
219  .debug_abbrev   0 : { *(.debug_abbrev) } 
220  .debug_line     0 : { *(.debug_line) }   
221  .debug_frame    0 : { *(.debug_frame)}   
222  .debug_str      0 : { *(.debug_str) }     
223  .debug_loc      0 : { *(.debug_loc) }     
224  .debug_macinfo  0 : { *(.debug_macinfo) }
225
226  /* SGI/MIPS DWARF 2 extensions */
227  .debug_weaknames 0 : { *(.debug_weaknames) }
228  .debug_funcnames 0 : { *(.debug_funcnames) }
229  .debug_typenames 0 : { *(.debug_typenames) }
230  .debug_varnames  0 : { *(.debug_varnames) } 
231}
Note: See TracBrowser for help on using the repository browser.