source: rtems/c/src/lib/libbsp/lm32/lm32_evr/startup/linkcmds @ d386bce

5
Last change on this file since d386bce 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: 10.0 KB
Line 
1OUTPUT_FORMAT("elf32-lm32", "elf32-lm32",
2              "elf32-lm32")
3OUTPUT_ARCH(lm32)
4ENTRY(_start)
5/* Do we need any of these for elf?
6   __DYNAMIC = 0;    */
7
8/*
9 * Declare some sizes. Heap is sized at whatever ram space is left.
10 */
11RamBase = DEFINED(RamBase) ? RamBase : 0x08000000;
12RamSize = DEFINED(RamSize) ? RamSize : 32M;
13HeapSize = DEFINED(HeapSize) ? HeapSize : 2M;
14_StackSize = DEFINED(_StackSize) ? _StackSize : 0x2000;
15
16PROVIDE (__stack = 0);
17MEMORY {
18        ebr     : ORIGIN = 0x04000000 , LENGTH = 32k
19        sdram   : ORIGIN = 0x08000000 , LENGTH = 32M
20}
21SECTIONS
22{
23  .boot :
24  {
25    KEEP (*(.boot))
26  } > ebr
27
28  /* Read-only sections, merged into text segment: */
29  .interp   : { *(.interp) }    > sdram
30  .hash           : { *(.hash)          }       > sdram
31  .dynsym         : { *(.dynsym)                }       > sdram
32  .dynstr         : { *(.dynstr)                }       > sdram
33  .gnu.version   : { *(.gnu.version)      }     > sdram
34  .gnu.version_d   : { *(.gnu.version_d)  }     > sdram
35  .gnu.version_r   : { *(.gnu.version_r)  }     > sdram
36  .rela.text     :
37    { *(.rela.text) *(.rela.gnu.linkonce.t*) }  > sdram
38  .rela.data     :
39    { *(.rela.data) *(.rela.gnu.linkonce.d*) }  > sdram
40  .rela.rodata   :
41    { *(.rela.rodata*) *(.rela.gnu.linkonce.r*) }       > sdram
42  .rela.got       : { *(.rela.got)      }       > sdram
43  .rela.got1      : { *(.rela.got1)     }       > sdram
44  .rela.got2      : { *(.rela.got2)     }       > sdram
45  .rela.ctors     : { *(.rela.ctors)    }       > sdram
46  .rela.dtors     : { *(.rela.dtors)    }       > sdram
47  .rela.init      : { *(.rela.init)     }       > sdram
48  .rela.fini      : { *(.rela.fini)     }       > sdram
49  .rela.bss       : { *(.rela.bss)      }       > sdram
50  .rela.plt       : { *(.rela.plt)      }       > sdram
51  .rela.sdata     : { *(.rela.sdata)    }       > sdram
52  .rela.sbss      : { *(.rela.sbss)     }       > sdram
53  .rela.sdata2    : { *(.rela.sdata2)   }       > sdram
54  .rela.sbss2     : { *(.rela.sbss2)    }       > sdram
55  .rela.dyn       : { *(.rela.dyn)      }       > sdram
56
57  .init           : { KEEP(*(.init))            } > sdram
58
59  .text      : 
60  {
61    *(.text*)   
62
63    /*
64     * Special FreeBSD sysctl sections.
65     */
66    . = ALIGN (16);
67    __start_set_sysctl_set = .;
68    *(set_sysctl_*);
69    __stop_set_sysctl_set = ABSOLUTE(.);
70    *(set_domain_*);
71    *(set_pseudo_*);
72
73    /* .gnu.warning sections are handled specially by elf32.em.  */
74    *(.gnu.warning)
75    *(.gnu.linkonce.t*)
76  }  > sdram
77
78  .fini           : { _fini = .; KEEP(*(.fini)) } > sdram
79
80  .rodata         : { *(.rodata*) KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) }   > sdram
81  .rodata1        : { *(.rodata1) }     > sdram
82  .tdata : {
83    _TLS_Data_begin = .;
84    *(.tdata .tdata.* .gnu.linkonce.td.*)
85    _TLS_Data_end = .;
86  } > sdram
87  .tbss : {
88    _TLS_BSS_begin = .;
89    *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
90    _TLS_BSS_end = .;
91  } > sdram
92  _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
93  _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
94  _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
95  _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
96  _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
97  _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
98
99  /* Adjust the address for the data segment.  We want to adjust up to
100     the same address within the page on the next page up.  */
101  . = ALIGN(0x10000) + (. & (0x10000 - 1));
102  /* Ensure the __preinit_array_start label is properly aligned.  We
103     could instead move the label definition inside the section, but
104     the linker would then create the section even if it turns out to
105     be empty, which isn't pretty.  */
106  . = ALIGN(32 / 8);
107  PROVIDE (__preinit_array_start = .);
108  .preinit_array     : { *(.preinit_array) } >sdram
109  PROVIDE (__preinit_array_end = .);
110  PROVIDE (__init_array_start = .);
111  .init_array     : { *(.init_array) } >sdram
112  PROVIDE (__init_array_end = .);
113  PROVIDE (__fini_array_start = .);
114  .fini_array     : { *(.fini_array) } >sdram
115  PROVIDE (__fini_array_end = .);
116
117/* _SDA2_BASE_ = __SDATA2_START__ + 0x8000; */
118  .sdata2         : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) } >sdram
119  .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
120                        /* avoid empty sdata2/sbss2 area -- __eabi would not set up r2
121                         * which may be important if run-time loading is used
122                         */
123                     . += 1;
124                    } >sdram
125  .eh_frame       : { *.(eh_frame)              } >sdram
126
127  /* NOTE: if the BSP uses page tables, the correctness of
128   *       '_etext' (and __DATA_START__) is CRUCIAL - otherwise,
129   *       an invalid mapping may result!!!
130   */
131  _etext = .;
132  PROVIDE (etext = .);
133
134  /* Adjust the address for the data segment.  We want to adjust up to
135     the same address within the page on the next page up.  It would
136     be more correct to do this:
137       . = ALIGN(0x40000) + (ALIGN(8) & (0x40000 - 1));
138     The current expression does not correctly handle the case of a
139     text segment ending precisely at the end of a page; it causes the
140     data segment to skip a page.  The above expression does not have
141     this problem, but it will currently (2/95) cause BFD to allocate
142     a single segment, combining both text and data, for this case.
143     This will prevent the text segment from being shared among
144     multiple executions of the program; I think that is more
145     important than losing a page of the virtual address space (note
146     that no actual memory is lost; the page which is skipped can not
147     be referenced).  */
148  . = ALIGN(0x1000);
149 .data ALIGN(0x1000) :
150  {
151   /* NOTE: if the BSP uses page tables, the correctness of
152    *       '__DATA_START__' (and _etext) is CRUCIAL - otherwise,
153    *       an invalid mapping may result!!!
154    */
155        PROVIDE(__DATA_START__ = ABSOLUTE(.) );
156    *(.data .data.* .gnu.linkonce.d*)   
157    KEEP (*(SORT(.rtemsrwset.*)))
158    SORT(CONSTRUCTORS)
159  } > sdram
160  .data1   : { *(.data1) }      > sdram
161  PROVIDE (__EXCEPT_START__ = .);
162  .gcc_except_table   : {
163    *(.gcc_except_table)
164    *(.gcc_except_table.*)
165  } > sdram
166  PROVIDE (__EXCEPT_END__ = .);
167  .got1           : { *(.got1) }        > sdram
168  /* Put .ctors and .dtors next to the .got2 section, so that the pointers
169     get relocated with -mrelocatable. Also put in the .fixup pointers.
170     The current compiler no longer needs this, but keep it around for 2.7.2  */
171                PROVIDE (_GOT2_START_ = .);
172  .got2           :  { *(.got2) }       > sdram
173  .dynamic        : { *(.dynamic) }     > sdram
174
175  .ctors          :
176  {
177    /* gcc uses crtbegin.o to find the start of
178       the constructors, so we make sure it is
179       first.  Because this is a wildcard, it
180       doesn't matter if the user does not
181       actually link against crtbegin.o; the
182       linker won't look for a file to match a
183       wildcard.  The wildcard also means that it
184       doesn't matter which directory crtbegin.o
185       is in.  */
186    KEEP (*crtbegin.o(.ctors))
187    /* We don't want to include the .ctor section from
188       from the crtend.o file until after the sorted ctors.
189       The .ctor section from the crtend file contains the
190       end of ctors marker and it must be last */
191    KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
192    KEEP (*(SORT(.ctors.*)))
193    KEEP (*(.ctors))
194  } > sdram
195  .dtors          :
196  {
197    KEEP (*crtbegin.o(.dtors))
198    KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
199    KEEP (*(SORT(.dtors.*)))
200    KEEP (*(.dtors))
201  } > sdram
202
203
204                PROVIDE (_FIXUP_START_ = .);
205  .fixup          : { *(.fixup) }       > sdram
206                PROVIDE (_FIXUP_END_ = .);
207                PROVIDE (_GOT2_END_ = .);
208                PROVIDE (_GOT_START_ = .);
209
210  .got            : { *(.got) } > sdram
211  .got.plt        : { *(.got.plt) }     > sdram
212
213                PROVIDE (_GOT_END_ = .);
214
215  .jcr            : { KEEP (*(.jcr)) } > sdram
216
217  /* We want the small data sections together, so single-instruction offsets
218     can access them all, and initialized data all before uninitialized, so
219     we can shorten the on-disk segment size.  */
220/* _SDA_BASE_ = __SDATA_START__ + 0x8000; */
221  .sdata          : { *(.sdata*) *(.gnu.linkonce.s.*)   } >sdram
222  _edata  =  .;
223  _gp = .;
224  PROVIDE (edata = .);
225  .sbss      :
226  {
227    _clear_start = .;
228    PROVIDE (__sbss_start = .);
229    *(.dynsbss)
230    *(.sbss* .gnu.linkonce.sb.*)
231    *(.scommon)
232    /* avoid empty sdata/sbss area -- __eabi would not set up r13
233     * which may be important if run-time loading is used
234     */
235    . += 1;
236    . = ALIGN(16);
237    PROVIDE (__sbss_end = .);
238  } > sdram
239  .plt   : { *(.plt) }  > sdram
240  .bss       :
241  {
242   PROVIDE (__bss_start = .);
243   *(.dynbss)
244   *(.bss .bss* .gnu.linkonce.b*)
245   *(COMMON)
246  . = ALIGN(16);
247  _end = . ;
248  __rtems_end = . ;
249  PROVIDE (end = .);
250
251  . += _StackSize;
252  _fstack = .;
253
254  WorkAreaBase = .;
255
256    . = ALIGN (16);
257    _stack_init = .;
258    _clear_end = .;
259
260  } > sdram
261
262
263  /DISCARD/ :
264  {
265    *(.comment)
266  }
267
268
269  /* Stabs debugging sections.  */
270  .stab 0 : { *(.stab) }
271  .stabstr 0 : { *(.stabstr) }
272  .stab.excl 0 : { *(.stab.excl) }
273  .stab.exclstr 0 : { *(.stab.exclstr) }
274  .stab.index 0 : { *(.stab.index) }
275  .stab.indexstr 0 : { *(.stab.indexstr) }
276  .comment 0 : { *(.comment) }
277
278  /* DWARF debug sections.
279     Symbols in the DWARF debugging sections are relative to the beginning
280     of the section so we begin them at 0.  */
281  /* DWARF 1 */
282  .debug          0 : { *(.debug) }
283  .line           0 : { *(.line) }
284 
285  /* GNU DWARF 1 extensions */
286  .debug_srcinfo  0 : { *(.debug_srcinfo) }
287  .debug_sfnames  0 : { *(.debug_sfnames) }
288 
289  /* DWARF 1.1 and DWARF 2 */
290  .debug_aranges  0 : { *(.debug_aranges) }
291  .debug_pubnames 0 : { *(.debug_pubnames) }
292 
293  /* DWARF 2 */
294  .debug_info     0 : { *(.debug_info) }
295  .debug_abbrev   0 : { *(.debug_abbrev) }
296  .debug_line     0 : { *(.debug_line) }
297  .debug_frame    0 : { *(.debug_frame) }
298  .debug_str      0 : { *(.debug_str) }
299  .debug_loc      0 : { *(.debug_loc) }
300  .debug_macinfo  0 : { *(.debug_macinfo) }
301 
302  /* SGI/MIPS DWARF 2 extensions */
303  .debug_weaknames 0 : { *(.debug_weaknames) }
304  .debug_funcnames 0 : { *(.debug_funcnames) }
305  .debug_typenames 0 : { *(.debug_typenames) }
306  .debug_varnames  0 : { *(.debug_varnames) }
307  /* These must appear regardless of  .  */
308}
Note: See TracBrowser for help on using the repository browser.