source: rtems/c/src/lib/libbsp/powerpc/haleakala/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: 7.4 KB
Line 
1/*
2 *  This file contains directives for the GNU linker which are specific
3 *  to the 405GP/EX
4 *  This file is intended to be used together with dlentry.s
5 *  it will generate downloadable code
6 *
7 *  Modifications for gen405 by Dennis Ehlin
8 *  Modifications for virtex by Keith, Greg, and Bob
9 *  Modifications for 405GP/EX by Michael Hamel
10 */
11
12OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
13OUTPUT_ARCH(powerpc)
14ENTRY(download_entry)
15
16kIntrStackSize = 16K;
17kMainStackSize = 64K;
18
19RamBase = DEFINED(RamBase) ? RamBase : 0;
20RamSize = DEFINED(RamSize) ? RamSize : 256M;
21HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0;
22
23MEMORY {
24        RAM : ORIGIN = 0, LENGTH = 256M
25        /*FLASH : ORIGIN = 0xFFE00000, LENGTH = 16M*/
26}
27
28
29SECTIONS
30{
31  /* First 16K is occupied by exception vectors and anything else we want to put there */
32  .text 0x4000:
33  {
34     text.start = . ;
35     *(.entry)
36     *(.entry2)
37     *(.text*)
38     *(.rodata*)
39     *(.rodata1)
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    /* C++ constructors/destructors */
52    *(.gnu.linkonce.t*)
53
54    /*  Initialization and finalization code.
55     *
56     *  Various files can provide initialization and finalization functions.
57     *  The bodies of these functions are in .init and .fini sections. We
58     *  accumulate the bodies here, and prepend function prologues from
59     *  ecrti.o and function epilogues from ecrtn.o. ecrti.o must be linked
60     *  first; ecrtn.o must be linked last. Because these are wildcards, it
61     *  doesn't matter if the user does not actually link against ecrti.o and
62     *  ecrtn.o; the linker won't look for a file to match a wildcard.  The
63     *  wildcard also means that it doesn't matter which directory ecrti.o
64     *  and ecrtn.o are in.
65     */
66    PROVIDE (_init = .);
67    *ecrti.o(.init)
68    *(.init)
69    *ecrtn.o(.init)
70   
71    PROVIDE (_fini = .);
72    *ecrti.o(.fini)
73    *(.fini)
74    *ecrtn.o(.init)
75
76    /*
77     *  C++ constructors and destructors for static objects.
78     *  PowerPC EABI does not use crtstuff yet, so we build "old-style"
79     *  constructor and destructor lists that begin with the list lenght
80     *  end terminate with a NULL entry.
81     */
82     
83    PROVIDE (__CTOR_LIST__ = .);             
84    *crtbegin.o(.ctors)
85    *(.ctors)
86    *crtend.o(.ctors)
87    LONG(0)
88    PROVIDE (__CTOR_END__ = .);
89       
90    PROVIDE (__DTOR_LIST__ = .);
91    *crtbegin.o(.dtors)
92    *(.dtors)
93    *crtend.o(.dtors)
94    LONG(0)
95    PROVIDE (__DTOR_END__ = .);
96       
97    /* Exception frame info */
98     *(.eh_frame)
99    /* Miscellaneous read-only data */
100    _rodata_start = . ;
101    *(.gnu.linkonce.r*)
102    *(.lit)
103    *(.shdata)
104    *(.rodata)
105    *(.rodata1)
106    *(.descriptors)
107    *(rom_ver)
108    _erodata = .;
109
110    PROVIDE (__EXCEPT_START__ = .);
111    *(.gcc_except_table*)
112    PROVIDE (__EXCEPT_END__ = .);
113    __GOT_START__ = .;
114    s.got = .;
115    *(.got.plt)
116    *(.got)
117    *(.got1)
118    PROVIDE (__GOT2_START__ = .);
119    PROVIDE (_GOT2_START_ = .);
120    *(.got2)
121    PROVIDE (__GOT2_END__ = .);
122    PROVIDE (_GOT2_END_ = .);
123   
124    PROVIDE (__FIXUP_START__ = .);
125    PROVIDE (_FIXUP_START_ = .);
126    *(.fixup)
127    PROVIDE (_FIXUP_END_ = .);
128    PROVIDE (__FIXUP_END__ = .);
129   
130
131    /* Various possible names for the end of the .text section */
132     etext = ALIGN(0x10);
133     _etext = .;
134
135     *(.lit)
136     *(.shdata)
137     _endtext = ALIGN(0x10);
138     text.end = .;
139     text.size = text.end - text.start;
140  } >RAM
141
142  text.size = text.end - text.start;
143
144  .tdata : {
145    _TLS_Data_begin = .;
146    *(.tdata .tdata.* .gnu.linkonce.td.*)
147    _TLS_Data_end = .;
148  } >RAM
149
150  .tbss : {
151    _TLS_BSS_begin = .;
152    *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
153    _TLS_BSS_end = .;
154  } >RAM
155
156  _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
157  _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
158  _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
159  _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
160  _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
161  _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
162
163  .jcr : { KEEP (*(.jcr)) } >RAM
164
165    .rel.dyn : {
166      *(.rel.init)
167      *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
168      *(.rel.fini)
169      *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
170      *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
171      *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
172      *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
173      *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
174      *(.rel.ctors)
175      *(.rel.dtors)
176      *(.rel.got)
177      *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
178      *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
179      *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*)
180      *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*)
181      *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
182    } >RAM
183    .rela.dyn : {
184      *(.rela.init)
185      *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
186      *(.rela.fini)
187      *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
188      *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
189      *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
190      *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
191      *(.rela.ctors)
192      *(.rela.dtors)
193      *(.rela.got)
194      *(.rela.got1)
195      *(.rela.got2)
196      *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
197      *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
198      *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
199      *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
200      *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
201    } >RAM
202
203
204    /* Initialised large data */
205    .data ( . ) :
206    {
207      . = ALIGN (4);
208      data.start = .;
209      *(.data)
210      *(.data1)
211      *(.data.* .gnu.linkonce.d.*)
212      data.end = .;
213    } > RAM
214
215        /* Initialised small data addressed as offsets from r13 */
216        .sdata : {
217      . = ALIGN (4);
218          PROVIDE (__SDATA_START__ = .);
219      sdata.start = .;
220          *(.sdata*)
221      *(.gnu.linkonce.s.*)
222          sdata.end = .;
223        } > RAM
224
225        /* Zeroed small data addressed as offsets from r13 */
226   .sbss : {
227      . = ALIGN (4);
228          PROVIDE(__SBSS_START__ = .);
229          sbss.start = .;
230      *(.sbss .sbss.* *.gnu.linkonce.sb.*);
231          sbss.end = .;
232    } > RAM
233    PROVIDE(__SBSS_END__ = .);
234
235        /* Zeroed large data */
236        .bss : {
237      . = ALIGN (4);
238          bss.start = .;
239      *(.bss .bss* .gnu.linkonce.b*)
240      . = ALIGN(4);
241      bss.end = .;
242    } > RAM
243
244    bss.size = bss.end - bss.start;
245    sbss.size = sbss.end - sbss.start;
246                       
247    /* Interrupt stack: align to a cache-line boundary */
248    IntrStack_start = ALIGN(0x20);
249    . += kIntrStackSize;
250    intrStack = .;
251    PROVIDE(intrStackPtr = intrStack);
252    PROVIDE(intrStack_start = IntrStack_start);
253    PROVIDE(intrStack_size = kIntrStackSize);
254
255        /* Main stack: align to a cache-line boundary */
256        stack.start = ALIGN(0x20);
257        . += kMainStackSize;
258        stack.end   = .;
259
260        /* RTEMS workspace: size specified by application */
261        WorkAreaBase = ALIGN(0x20);
262
263        /* Debugging information */
264    .line 0 : { *(.line) }
265    .debug 0 : { *(.debug) }
266    .debug_sfnames 0 : { *(.debug_sfnames) }
267    .debug_srcinfo 0 : { *(.debug_srcinfo) }
268    .debug_pubnames 0 : { *(.debug_pubnames) }
269    .debug_aranges 0 : { *(.debug_aranges) }
270    .debug_aregion 0 : { *(.debug_aregion) }
271    .debug_macinfo 0 : { *(.debug_macinfo) }
272    .stab 0 : { *(.stab) }
273    .stabstr 0 : { *(.stabstr) }
274}
Note: See TracBrowser for help on using the repository browser.