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

5
Last change on this file since b618d8c was b618d8c, checked in by Sebastian Huber <sebastian.huber@…>, on 09/16/15 at 05:13:58

Add RTEMS linker sets

Update #2408.

  • Property mode set to 100644
File size: 8.6 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    KEEP (*(SORT(.rtemsroset.*)))
129    *(.descriptors)
130    *(rom_ver)
131    _erodata = .;
132
133
134    /* Various possible names for the end of the .text section */
135    etext = ALIGN(0x10);
136    _etext = .;
137    _endtext = .;
138    text.end = .;
139    PROVIDE (etext = .);
140    PROVIDE (__etext = .);
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  .rel.dyn        :
163    {
164      *(.rel.init)
165      *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
166      *(.rel.fini)
167      *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
168      *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
169      *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
170      *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
171      *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
172      *(.rel.ctors)
173      *(.rel.dtors)
174      *(.rel.got)
175      *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
176      *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
177      *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*)
178      *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*)
179      *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
180    } >ram
181  .rela.dyn       :
182    {
183      *(.rela.init)
184      *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
185      *(.rela.fini)
186      *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
187      *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
188      *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
189      *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
190      *(.rela.ctors)
191      *(.rela.dtors)
192      *(.rela.got)
193      *(.rela.got1)
194      *(.rela.got2)
195      *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
196      *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
197      *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
198      *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
199      *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
200    } >ram
201  .rel.plt        : { *(.rel.plt) }
202  .rela.plt       : { *(.rela.plt) }
203
204  /* R/W Data */
205  .data :
206  {
207    data_start = .;
208   
209    *(.data)
210    *(.data.*)
211    KEEP (*(SORT(.rtemsrwset.*)))
212    *(.data1)
213   
214    PROVIDE (__EXCEPT_START__ = .);
215    *(.gcc_except_table*)
216    PROVIDE (__EXCEPT_END__ = .);
217   
218    PROVIDE(__GOT_START__ = .);
219    *(.got.plt)
220    *(.got)
221    PROVIDE(__GOT_END__ = .);
222 
223    *(.got1)
224   
225    PROVIDE (__GOT2_START__ = .);
226    PROVIDE (_GOT2_START_ = .);
227    *(.got2)
228    PROVIDE (__GOT2_END__ = .);
229    PROVIDE (_GOT2_END_ = .);
230 
231    PROVIDE (__FIXUP_START__ = .);
232    PROVIDE (_FIXUP_START_ = .);
233    *(.fixup)
234    PROVIDE (_FIXUP_END_ = .);
235    PROVIDE (__FIXUP_END__ = .);
236  } > ram
237 
238  .sdata : {
239    PROVIDE (_SDA_BASE_ = 32768);
240    *(.sdata .sdata.* .gnu.linkonce.s.*)
241  } > ram
242
243  .sbss : {
244    __bss_start = .;
245
246    PROVIDE (__sbss_start = .); PROVIDE (___sbss_start = .);
247    *(.scommon)
248    *(.dynsbss)
249    *(.sbss .sbss.* .gnu.linkonce.sb.*)
250    PROVIDE (__sbss_end = .); PROVIDE (___sbss_end = .);
251  } > ram
252
253  .sdata2 : {
254    PROVIDE (_SDA2_BASE_ = 32768);
255
256    *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
257  } > ram =0
258
259  .sbss2 : {
260    *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
261  } > ram =0
262   
263  .bss :
264  {
265    bss.start = .;
266    *(.bss .bss* .gnu.linkonce.b*)
267    *(COMMON)
268    . = ALIGN(4);
269    bss.end = .;
270
271  } > ram
272 
273  bss.size = bss.end - bss.start;
274  text.size = text.end - text.start;
275  PROVIDE(_end = bss.end);
276  /*
277   * Interrupt stack setup
278   */
279
280  IntrStack_start = ALIGN(0x10);
281  . += 0x4000;
282  intrStack = .;
283  PROVIDE(intrStackPtr = intrStack);
284
285  WorkAreaBase = .;
286
287  dpram :
288  {
289  m8xx = .;
290  _m8xx = .;
291  /*   . += (16 * 1024); this makes the mbx loader crash */
292  } >immr
293
294  /* Stabs debugging sections.  */
295  .stab 0 : { *(.stab) }
296  .stabstr 0 : { *(.stabstr) }
297  .stab.excl 0 : { *(.stab.excl) }
298  .stab.exclstr 0 : { *(.stab.exclstr) }
299  .stab.index 0 : { *(.stab.index) }
300  .stab.indexstr 0 : { *(.stab.indexstr) }
301  .comment 0 : { *(.comment) }
302 
303  /* DWARF debug sections.
304     Symbols in the DWARF debugging sections are relative to the beginning
305     of the section so we begin them at 0.  */
306  /* DWARF 1 */
307  .debug          0 : { *(.debug) }
308  .line           0 : { *(.line) }
309 
310  /* GNU DWARF 1 extensions */
311  .debug_srcinfo  0 : { *(.debug_srcinfo) }
312  .debug_sfnames  0 : { *(.debug_sfnames) }
313 
314  /* DWARF 1.1 and DWARF 2 */
315  .debug_aranges  0 : { *(.debug_aranges) }
316  .debug_pubnames 0 : { *(.debug_pubnames) }
317 
318  /* DWARF 2 */
319  .debug_info     0 : { *(.debug_info) }
320  .debug_abbrev   0 : { *(.debug_abbrev) }
321  .debug_line     0 : { *(.debug_line) }
322  .debug_frame    0 : { *(.debug_frame) }
323  .debug_str      0 : { *(.debug_str) }
324  .debug_loc      0 : { *(.debug_loc) }
325  .debug_macinfo  0 : { *(.debug_macinfo) }
326 
327  /* SGI/MIPS DWARF 2 extensions */
328  .debug_weaknames 0 : { *(.debug_weaknames) }
329  .debug_funcnames 0 : { *(.debug_funcnames) }
330  .debug_typenames 0 : { *(.debug_typenames) }
331  .debug_varnames  0 : { *(.debug_varnames) }
332  /* These must appear regardless of  .  */
333}
Note: See TracBrowser for help on using the repository browser.