source: rtems/c/src/lib/libbsp/powerpc/mbx8xx/startup/linkcmds @ 960fd85

4.115
Last change on this file since 960fd85 was 960fd85, checked in by Sebastian Huber <sebastian.huber@…>, on 01/28/14 at 10:52:17

bsps: Thread-local storage (TLS) for linkcmds

  • Property mode set to 100644
File size: 8.4 KB
Line 
1/*
2 *  This file contains directives for the GNU linker that are specific
3 *  to the MBX860-2 board.
4 */
5
6OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
7OUTPUT_ARCH(powerpc)
8ENTRY(_start)
9
10/*
11 * Declare some sizes.
12 * XXX: The assignment of ". += XyzSize;" fails in older gld's if the
13 *      number used there is not constant.  If this happens to you, edit
14 *      the lines marked XXX below to use a constant value.
15 */
16StackSize = DEFINED(StackSize) ? StackSize : 0x1000;
17RamBase = DEFINED(RamBase) ? RamBase : 0;
18RamSize = DEFINED(RamSize) ? RamSize : 4M;
19HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0;
20 
21MEMORY
22  {
23    ram : org = 0x0, l = 4M
24    nvram : org = 0xfa000000, l = 32K
25    dpram : org = 0xfa200000, l = 16K
26    flash : org = 0xfc000000, l = 2M
27    immr  : org = 0xfa200000, l = 16K
28  }
29
30
31SECTIONS
32{
33  /*
34   *  If the vectors are specified statically rather than created at run time,
35   *  accumulate them starting at VMA 0x0.
36   */
37  .vectors :
38  {
39    *(.vectors)
40  } >ram
41
42  /*
43   *  The stack will live in this area - between the vectors and
44   *  the text section.
45   */
46 
47  .text 0x10000:
48  {
49    /* Read-only sections, merged into text segment: */
50   
51    text.start = .;
52
53    /* Entry point is the .entry section */
54    *(.entry)
55    *(.entry2)
56
57    /* Actual code */
58    *(.text*)
59       
60    /* C++ constructors/destructors */
61    *(.gnu.linkonce.t*)
62       
63    /*  Initialization and finalization code.
64     *
65     *  Various files can provide initialization and finalization functions.
66     *  The bodies of these functions are in .init and .fini sections. We
67     *  accumulate the bodies here, and prepend function prologues from
68     *  ecrti.o and function epilogues from ecrtn.o. ecrti.o must be linked
69     *  first; ecrtn.o must be linked last. Because these are wildcards, it
70     *  doesn't matter if the user does not actually link against ecrti.o and
71     *  ecrtn.o; the linker won't look for a file to match a wildcard.  The
72     *  wildcard also means that it doesn't matter which directory ecrti.o
73     *  and ecrtn.o are in.
74     */
75    PROVIDE (_init = .);
76    *ecrti.o(.init)
77    *(.init)
78    *ecrtn.o(.init)
79   
80    PROVIDE (_fini = .);
81    *ecrti.o(.fini)
82    *(.fini)
83    *ecrtn.o(.init)
84
85    /*
86     *  C++ constructors and destructors for static objects.
87     *  PowerPC EABI does not use crtstuff yet, so we build "old-style"
88     *  constructor and destructor lists that begin with the list lenght
89     *  end terminate with a NULL entry.
90     */
91     
92    PROVIDE (__CTOR_LIST__ = .);       
93    /* LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) */
94    *crtbegin.o(.ctors)
95    *(.ctors)
96    *crtend.o(.ctors)
97    LONG(0)
98    PROVIDE (__CTOR_END__ = .);
99 
100    PROVIDE (__DTOR_LIST__ = .);
101    /* LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) */
102    *crtbegin.o(.dtors)
103    *(.dtors)
104    *crtend.o(.dtors)
105    LONG(0)
106    PROVIDE (__DTOR_END__ = .);
107 
108    /*
109     * Special FreeBSD sysctl sections.
110     */
111    . = ALIGN (16);
112    __start_set_sysctl_set = .;
113    *(set_sysctl_*);
114    __stop_set_sysctl_set = ABSOLUTE(.);
115    *(set_domain_*);
116    *(set_pseudo_*);
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 } > ram
141
142  .tdata : {
143    _TLS_Data_begin = .;
144    *(.tdata .tdata.* .gnu.linkonce.td.*)
145    _TLS_Data_end = .;
146  } >ram
147
148  .tbss : {
149    _TLS_BSS_begin = .;
150    *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
151    _TLS_BSS_end = .;
152  } >ram
153
154  _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
155  _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
156  _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
157  _TLS_Alignment = ALIGNOF (.tdata);
158 
159  .rel.dyn        :
160    {
161      *(.rel.init)
162      *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
163      *(.rel.fini)
164      *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
165      *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
166      *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
167      *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
168      *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
169      *(.rel.ctors)
170      *(.rel.dtors)
171      *(.rel.got)
172      *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
173      *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
174      *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*)
175      *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*)
176      *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
177    } >ram
178  .rela.dyn       :
179    {
180      *(.rela.init)
181      *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
182      *(.rela.fini)
183      *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
184      *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
185      *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
186      *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
187      *(.rela.ctors)
188      *(.rela.dtors)
189      *(.rela.got)
190      *(.rela.got1)
191      *(.rela.got2)
192      *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
193      *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
194      *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
195      *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
196      *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
197    } >ram
198  .rel.plt        : { *(.rel.plt) }
199  .rela.plt       : { *(.rela.plt) }
200
201  /* R/W Data */
202  .data :
203  {
204    data_start = .;
205   
206    *(.data)
207    *(.data.*)
208    *(.data1)
209   
210    PROVIDE (__EXCEPT_START__ = .);
211    *(.gcc_except_table*)
212    PROVIDE (__EXCEPT_END__ = .);
213   
214    PROVIDE(__GOT_START__ = .);
215    *(.got.plt)
216    *(.got)
217    PROVIDE(__GOT_END__ = .);
218 
219    *(.got1)
220   
221    PROVIDE (__GOT2_START__ = .);
222    PROVIDE (_GOT2_START_ = .);
223    *(.got2)
224    PROVIDE (__GOT2_END__ = .);
225    PROVIDE (_GOT2_END_ = .);
226 
227    PROVIDE (__FIXUP_START__ = .);
228    PROVIDE (_FIXUP_START_ = .);
229    *(.fixup)
230    PROVIDE (_FIXUP_END_ = .);
231    PROVIDE (__FIXUP_END__ = .);
232  } > ram
233 
234  .sdata : {
235    PROVIDE (_SDA_BASE_ = 32768);
236    *(.sdata .sdata.* .gnu.linkonce.s.*)
237  } > ram
238
239  .sbss : {
240    __bss_start = .;
241
242    PROVIDE (__sbss_start = .); PROVIDE (___sbss_start = .);
243    *(.scommon)
244    *(.dynsbss)
245    *(.sbss .sbss.* .gnu.linkonce.sb.*)
246    PROVIDE (__sbss_end = .); PROVIDE (___sbss_end = .);
247  } > ram
248
249  .sdata2 : {
250    PROVIDE (_SDA2_BASE_ = 32768);
251
252    *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
253  } > ram =0
254
255  .sbss2 : {
256    *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
257  } > ram =0
258   
259  .bss :
260  {
261    bss.start = .;
262    *(.bss .bss* .gnu.linkonce.b*)
263    *(COMMON)
264    . = ALIGN(4);
265    bss.end = .;
266
267  } > ram
268 
269  bss.size = bss.end - bss.start;
270  text.size = text.end - text.start;
271  PROVIDE(_end = bss.end);
272  /*
273   * Interrupt stack setup
274   */
275
276  IntrStack_start = ALIGN(0x10);
277  . += 0x4000;
278  intrStack = .;
279  PROVIDE(intrStackPtr = intrStack);
280
281  WorkAreaBase = .;
282
283  dpram :
284  {
285  m8xx = .;
286  _m8xx = .;
287  /*   . += (16 * 1024); this makes the mbx loader crash */
288  } >immr
289
290  /* Stabs debugging sections.  */
291  .stab 0 : { *(.stab) }
292  .stabstr 0 : { *(.stabstr) }
293  .stab.excl 0 : { *(.stab.excl) }
294  .stab.exclstr 0 : { *(.stab.exclstr) }
295  .stab.index 0 : { *(.stab.index) }
296  .stab.indexstr 0 : { *(.stab.indexstr) }
297  .comment 0 : { *(.comment) }
298 
299  /* DWARF debug sections.
300     Symbols in the DWARF debugging sections are relative to the beginning
301     of the section so we begin them at 0.  */
302  /* DWARF 1 */
303  .debug          0 : { *(.debug) }
304  .line           0 : { *(.line) }
305 
306  /* GNU DWARF 1 extensions */
307  .debug_srcinfo  0 : { *(.debug_srcinfo) }
308  .debug_sfnames  0 : { *(.debug_sfnames) }
309 
310  /* DWARF 1.1 and DWARF 2 */
311  .debug_aranges  0 : { *(.debug_aranges) }
312  .debug_pubnames 0 : { *(.debug_pubnames) }
313 
314  /* DWARF 2 */
315  .debug_info     0 : { *(.debug_info) }
316  .debug_abbrev   0 : { *(.debug_abbrev) }
317  .debug_line     0 : { *(.debug_line) }
318  .debug_frame    0 : { *(.debug_frame) }
319  .debug_str      0 : { *(.debug_str) }
320  .debug_loc      0 : { *(.debug_loc) }
321  .debug_macinfo  0 : { *(.debug_macinfo) }
322 
323  /* SGI/MIPS DWARF 2 extensions */
324  .debug_weaknames 0 : { *(.debug_weaknames) }
325  .debug_funcnames 0 : { *(.debug_funcnames) }
326  .debug_typenames 0 : { *(.debug_typenames) }
327  .debug_varnames  0 : { *(.debug_varnames) }
328  /* These must appear regardless of  .  */
329}
Note: See TracBrowser for help on using the repository browser.