source: rtems/c/src/lib/libbsp/powerpc/mpc8260ads/startup/linkcmds @ 9736283

5
Last change on this file since 9736283 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: 8.6 KB
Line 
1/*
2 *  This file contains directives for the GNU linker which are specific
3 *  to the MPC8260ADS Board
4 */
5
6OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc",
7              "elf32-powerpc")
8OUTPUT_ARCH(powerpc)
9
10ENTRY(start)
11
12/*
13 * Declare some sizes.
14 * XXX: The assignment of ". += XyzSize;" fails in older gld's if the
15 *      number used there is not constant.  If this happens to you, edit
16 *      the lines marked XXX below to use a constant value.
17 */
18StackSize   = DEFINED(StackSize) ? StackSize : 0x8000;
19RamBase     = DEFINED(RamBase) ? RamBase : 0x0;
20RamSize     = DEFINED(RamSize) ? RamDiskSize : 0x0800000; /* 8M program ram */
21HeapSize    = DEFINED(HeapSize) ? HeapSize : 0x0;
22RamDiskBase = DEFINED(RamDiskBase) ? RamDiskBase : 0x0800000;
23RamDiskSize = DEFINED(RamDiskSize) ? RamDiskSize : 0x0800000; /* 8M ram disk */
24
25MEMORY
26{
27  ram : org = 0x0, l = 8M
28  ramdisk : org = 0x0800000, l = 8M
29  dpram : org = 0x04700000, l = 128K
30  flash : org = 0xff800000, l = 8M
31}
32
33
34SECTIONS
35{
36    /*
37     * The stack will live in this area - between the vectors and
38     * the text section.
39     */
40
41    .text 0x10000:
42    {
43    _textbase = .;
44
45
46    text.start = .;
47
48    /* Entry point is the .entry section */
49    *(.entry)
50    *(.entry2)
51
52    /* Actual Code */
53    *(.text*)
54
55
56    *(.rodata*)
57    *(.rodata1)
58
59
60    /*
61     * Special FreeBSD sysctl sections.
62     */
63    . = ALIGN (16);
64    __start_set_sysctl_set = .;
65    *(set_sysctl_*);
66    __stop_set_sysctl_set = ABSOLUTE(.);
67    *(set_domain_*);
68    *(set_pseudo_*);
69
70    /* C++ constructors/destructors */
71    *(.gnu.linkonce.t*)
72
73    /*  Initialization and finalization code.
74     *
75     *  Various files can provide initialization and finalization functions.
76     *  The bodies of these functions are in .init and .fini sections. We
77     *  accumulate the bodies here, and prepend function prologues from
78     *  ecrti.o and function epilogues from ecrtn.o. ecrti.o must be linked
79     *  first; ecrtn.o must be linked last. Because these are wildcards, it
80     *  doesn't matter if the user does not actually link against ecrti.o and
81     *  ecrtn.o; the linker won't look for a file to match a wildcard.  The
82     *  wildcard also means that it doesn't matter which directory ecrti.o
83     *  and ecrtn.o are in.
84     */
85    PROVIDE (_init = .);
86    *ecrti.o(.init)
87    *(.init)
88    *ecrtn.o(.init)
89
90    PROVIDE (_fini = .);
91    *ecrti.o(.fini)
92    *(.fini)
93    *ecrtn.o(.init)
94
95    /*
96     *  C++ constructors and destructors for static objects.
97     *  PowerPC EABI does not use crtstuff yet, so we build "old-style"
98     *  constructor and destructor lists that begin with the list lenght
99     *  end terminate with a NULL entry.
100     */
101
102    PROVIDE (__CTOR_LIST__ = .);       
103    /* LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) */
104    *crtbegin.o(.ctors)
105    *(.ctors)
106    *crtend.o(.ctors)
107    LONG(0)
108    PROVIDE (__CTOR_END__ = .);
109
110    PROVIDE (__DTOR_LIST__ = .);
111    /* LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) */
112    *crtbegin.o(.dtors)
113    *(.dtors)
114    *crtend.o(.dtors)
115    LONG(0)
116    PROVIDE (__DTOR_END__ = .);
117
118    /* Exception frame info */
119    *(.eh_frame)
120
121    /* Miscellaneous read-only data */
122    _rodata_start = . ;
123    *(.gnu.linkonce.r*)
124    *(.lit)
125    *(.shdata)
126    *(.rodata)
127    *(.rodata1)
128    *(.descriptors)
129    *(rom_ver)
130    _erodata = .;
131
132
133    /* Various possible names for the end of the .text section */
134    etext = ALIGN(0x10);
135    _etext = .;
136    _endtext = .;
137    text.end = .;
138    PROVIDE (etext = .);
139    PROVIDE (__etext = .);
140
141    } > ram
142
143  .tdata : {
144    _TLS_Data_begin = .;
145    *(.tdata .tdata.* .gnu.linkonce.td.*)
146    _TLS_Data_end = .;
147  } >ram
148
149  .tbss : {
150    _TLS_BSS_begin = .;
151    *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
152    _TLS_BSS_end = .;
153  } >ram
154
155  _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
156  _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
157  _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
158  _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
159  _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
160  _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
161
162
163  .rel.dyn        :
164    {
165      *(.rel.init)
166      *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
167      *(.rel.fini)
168      *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
169      *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
170      *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
171      *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
172      *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
173      *(.rel.ctors)
174      *(.rel.dtors)
175      *(.rel.got)
176      *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
177      *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
178      *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*)
179      *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*)
180      *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
181    } >ram
182  .rela.dyn       :
183    {
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  .rel.plt        : { *(.rel.plt) }
203  .rela.plt       : { *(.rela.plt) }
204
205    PROVIDE (__EXCEPT_START__ = .);
206    .gcc_except_table   : { *(.gcc_except_table*) } >ram
207    PROVIDE (__EXCEPT_END__ = .);
208    __GOT_START__ = .;
209    .got :
210    {
211      s.got = .;
212      *(.got.plt) *(.got)
213    } > ram
214    __GOT_END__ = .;
215
216    .got1                 : { *(.got1)          } >ram
217    PROVIDE (__GOT2_START__ = .);
218    PROVIDE (_GOT2_START_ = .);
219    .got2                 :  { *(.got2)         } >ram
220    PROVIDE (__GOT2_END__ = .);
221    PROVIDE (_GOT2_END_ = .);
222
223    PROVIDE (__FIXUP_START__ = .);
224    PROVIDE (_FIXUP_START_ = .);
225    .fixup        : { *(.fixup)         } >ram
226    PROVIDE (_FIXUP_END_ = .);
227    PROVIDE (__FIXUP_END__ = .);
228 
229    .sdata : {
230      PROVIDE (_SDA_BASE_ = 32768);
231      *(.sdata .sdata.* .gnu.linkonce.s.*)
232    } > ram
233 
234    .sbss : {
235      __bss_start = .;
236 
237      PROVIDE (__sbss_start = .); PROVIDE (___sbss_start = .);
238      *(.scommon)
239      *(.dynsbss)
240      *(.sbss .sbss.* .gnu.linkonce.sb.*)
241      PROVIDE (__sbss_end = .); PROVIDE (___sbss_end = .);
242    } > ram
243 
244    .sdata2 : {
245      PROVIDE (_SDA2_BASE_ = 32768);
246 
247      *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
248    } > ram =0
249 
250    .sbss2 : {
251      *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
252    } > ram =0
253
254    .bss :
255    {
256      bss.start = .;
257      *(.bss .bss* .gnu.linkonce.b*)
258      . = ALIGN(4);
259      bss.end = .;
260    } > ram
261
262    /* R/W Data */
263    .data ( . ) :
264    {
265      . = ALIGN (4);
266
267      data.start = .;
268
269      *(.data)
270      *(.data1)
271      *(.data.* .gnu.linkonce.d.*)
272      PROVIDE (__SDATA_START__ = .);
273      *(.sdata .sdata.* .gnu.linkonce.s.*)
274      data.end = .;
275    } > ram
276
277    data.size = data.end - data.start;
278    bss.size = bss.end - bss.start;
279    text.size = text.end - text.start;
280
281    PROVIDE(_end = data.end);
282
283    .gzipmalloc : {
284        . = ALIGN (16);
285        _startmalloc = .;
286     } >ram
287
288
289    /*
290     * Interrupt stack setup
291     */
292    IntrStack_start = ALIGN(0x10);
293    . += 0x4000;
294    intrStack = .;
295    PROVIDE(intrStackPtr = intrStack);
296
297
298    clear_end = .;
299
300    WorkAreaBase = .;
301
302    /* Sections for compressed .text and .data         */
303    /* after the .datarom section is an int specifying */
304    /* the length of the following compressed image    */
305    /* Executes once then could get overwritten        */
306    .textrom 0x100000 :
307    {
308        *(.textrom)
309        _endloader = .;
310    } > ram
311
312    .datarom :
313    {
314        _dr_start = .;
315        *(.datarom)
316        _dr_end = .;
317    } > ram
318    dr_len = _dr_end - _dr_start;
319
320    .dpram :
321    {
322      m8260 = .;
323      _m8260 = .;
324      . += (128 * 1024);
325     } > dpram
326
327
328     /* the reset vector is at 0xfff00000 which is */
329     /* located at offset 0x400000 from the base   */
330     /* of flash                                   */
331    .bootrom 0xFFF00000 :
332    {
333      *(.bootrom)
334      _endboot = .;
335    } > flash
336
337
338    .line 0 : { *(.line) }
339    .debug 0 : { *(.debug) }
340    .debug_sfnames 0 : { *(.debug_sfnames) }
341    .debug_srcinfo 0 : { *(.debug_srcinfo) }
342    .debug_pubnames 0 : { *(.debug_pubnames) }
343    .debug_aranges 0 : { *(.debug_aranges) }
344    .debug_aregion 0 : { *(.debug_aregion) }
345    .debug_macinfo 0 : { *(.debug_macinfo) }
346    .stab 0 : { *(.stab) }
347    .stabstr 0 : { *(.stabstr) }
348}
Note: See TracBrowser for help on using the repository browser.