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