source: rtems/c/src/lib/libbsp/mips/hurricane/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: 3.8 KB
Line 
1/*
2 *   linkcmds
3 */
4
5/*
6 * Declare some sizes.
7 */
8RamBase = DEFINED(RamBase) ? RamBase : 0x80000000;
9RamSize = DEFINED(RamSize) ? RamSize : 4M;
10HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0;
11_StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000;
12
13SECTIONS
14{
15  /* 0x80000000 - 0x8001FFFF used by PMON (with 0x80010000 - 0x8001FFFF as heap for symbol storage)
16        0x80020000 - 0x8002FFFF reserved for shared memory
17        0x80030000 beginning of text (code) section
18   */
19  .text 0x80030000  :
20  {
21    _ftext = . ;
22    eprol = .;
23    *(.text)
24    *(.text.*)
25    *(.gnu.linkonce.t*)
26    *(.mips16.fn.*)
27    *(.mips16.call.*)
28    PROVIDE (__runtime_reloc_start = .);
29    *(.rel.sdata)
30    PROVIDE (__runtime_reloc_stop = .);
31
32      /*
33       * Special FreeBSD sysctl sections.
34       */
35      . = ALIGN (16);
36      __start_set_sysctl_set = .;
37      *(set_sysctl_*);
38      __stop_set_sysctl_set = ABSOLUTE(.);
39      *(set_domain_*);
40      *(set_pseudo_*);
41
42      *(.gcc_except_table*)
43      *(.eh_frame_hdr)
44      *(.eh_frame)
45  }
46
47  .init :
48  {
49        KEEP(*crti.o(.init))
50        KEEP(*(.init))
51        KEEP(*crtn.o(.init))
52  }
53
54  .fini :
55  {
56        KEEP(*crti.o(.fini))
57        KEEP(*(.fini))
58        KEEP(*crtn.o(.fini))
59  }
60
61  .ctors    :
62  {
63    /* gcc uses crtbegin.o to find the start of
64       the constructors, so we make sure it is
65       first.  Because this is a wildcard, it
66       doesn't matter if the user does not
67       actually link against crtbegin.o; the
68       linker won't look for a file to match a
69       wildcard.  The wildcard also means that it
70       doesn't matter which directory crtbegin.o
71       is in.  */
72
73    KEEP (*crtbegin.o(.ctors))
74
75    /* We don't want to include the .ctor section from
76       from the crtend.o file until after the sorted ctors.
77       The .ctor section from the crtend file contains the
78       end of ctors marker and it must be last */
79
80    KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
81    KEEP (*(SORT(.ctors.*)))
82    KEEP (*(.ctors))
83  }
84
85  .dtors    :
86  {
87    KEEP (*crtbegin.o(.dtors))
88    KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
89    KEEP (*(SORT(.dtors.*)))
90    KEEP (*(.dtors))
91
92    etext  =  .;
93    _etext  =  .;
94  }
95
96  .rdata : {
97    *(.rdata)
98    *(.rodata)
99    *(.rodata.*)
100    *(.gnu.linkonce.r*)
101  }
102
103  .tdata : {
104    _TLS_Data_begin = .;
105    *(.tdata .tdata.* .gnu.linkonce.td.*)
106    _TLS_Data_end = .;
107  }
108
109  .tbss : {
110    _TLS_BSS_begin = .;
111    *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
112    _TLS_BSS_end = .;
113  }
114
115  _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
116  _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
117  _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
118  _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
119  _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
120  _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
121
122   _fdata = ALIGN(16);
123
124  .data : {
125    *(.data)
126    *(.data.*)
127    *(.gnu.linkonce.d*)
128    SORT(CONSTRUCTORS)
129  }
130  . = ALIGN(8);
131
132  .jcr : {
133        KEEP (*(.jcr))
134  }
135
136  _gp = ALIGN(16) + 0x8000;
137  __global = _gp;
138
139  .sdata : {
140    *(.sdata)
141    *(.sdata.*)
142    *(.gnu.linkonce.s*)
143  }
144  .lit8 : {
145    *(.lit8)
146  }
147  .lit4 : {
148    *(.lit4)
149  }
150
151   edata  =  .;
152   _edata  =  .;
153   _fbss = .;
154
155  .sbss : {
156    *(.sbss)
157    *(.scommon)
158  }
159  .bss : {
160    _bss_start = . ;
161    *(.bss)
162    *(COMMON)
163    . = ALIGN (64);
164    _stack_limit = .;
165    . += _StackSize;
166    __stack = .;
167    _stack_init = .;
168     end = .;
169    _end = .;
170    WorkAreaBase = .;
171  }
172
173
174  /* Debug sections.  These should never be loadable, but they must have
175     zero addresses for the debuggers to work correctly.  */
176  .line                 0 : { *(.line)                  }
177  .debug                0 : { *(.debug)                 }
178  .debug_sfnames        0 : { *(.debug_sfnames)         }
179  .debug_srcinfo        0 : { *(.debug_srcinfo)         }
180  .debug_macinfo        0 : { *(.debug_macinfo)         }
181  .debug_pubnames       0 : { *(.debug_pubnames)        }
182  .debug_aranges        0 : { *(.debug_aranges)         }
183}
Note: See TracBrowser for help on using the repository browser.