source: rtems/c/src/lib/libbsp/lm32/lm32_evr/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: 9.8 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*) *(.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_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
94  _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
95  _TLS_Alignment = ALIGNOF (.tdata);
96
97  /* Adjust the address for the data segment.  We want to adjust up to
98     the same address within the page on the next page up.  */
99  . = ALIGN(0x10000) + (. & (0x10000 - 1));
100  /* Ensure the __preinit_array_start label is properly aligned.  We
101     could instead move the label definition inside the section, but
102     the linker would then create the section even if it turns out to
103     be empty, which isn't pretty.  */
104  . = ALIGN(32 / 8);
105  PROVIDE (__preinit_array_start = .);
106  .preinit_array     : { *(.preinit_array) } >sdram
107  PROVIDE (__preinit_array_end = .);
108  PROVIDE (__init_array_start = .);
109  .init_array     : { *(.init_array) } >sdram
110  PROVIDE (__init_array_end = .);
111  PROVIDE (__fini_array_start = .);
112  .fini_array     : { *(.fini_array) } >sdram
113  PROVIDE (__fini_array_end = .);
114
115/* _SDA2_BASE_ = __SDATA2_START__ + 0x8000; */
116  .sdata2         : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) } >sdram
117  .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
118                        /* avoid empty sdata2/sbss2 area -- __eabi would not set up r2
119                         * which may be important if run-time loading is used
120                         */
121                     . += 1;
122                    } >sdram
123  .eh_frame       : { *.(eh_frame)              } >sdram
124
125  /* NOTE: if the BSP uses page tables, the correctness of
126   *       '_etext' (and __DATA_START__) is CRUCIAL - otherwise,
127   *       an invalid mapping may result!!!
128   */
129  _etext = .;
130  PROVIDE (etext = .);
131
132  /* Adjust the address for the data segment.  We want to adjust up to
133     the same address within the page on the next page up.  It would
134     be more correct to do this:
135       . = ALIGN(0x40000) + (ALIGN(8) & (0x40000 - 1));
136     The current expression does not correctly handle the case of a
137     text segment ending precisely at the end of a page; it causes the
138     data segment to skip a page.  The above expression does not have
139     this problem, but it will currently (2/95) cause BFD to allocate
140     a single segment, combining both text and data, for this case.
141     This will prevent the text segment from being shared among
142     multiple executions of the program; I think that is more
143     important than losing a page of the virtual address space (note
144     that no actual memory is lost; the page which is skipped can not
145     be referenced).  */
146  . = ALIGN(0x1000);
147 .data ALIGN(0x1000) :
148  {
149   /* NOTE: if the BSP uses page tables, the correctness of
150    *       '__DATA_START__' (and _etext) is CRUCIAL - otherwise,
151    *       an invalid mapping may result!!!
152    */
153        PROVIDE(__DATA_START__ = ABSOLUTE(.) );
154    *(.data .data.* .gnu.linkonce.d*)   
155    SORT(CONSTRUCTORS)
156  } > sdram
157  .data1   : { *(.data1) }      > sdram
158  PROVIDE (__EXCEPT_START__ = .);
159  .gcc_except_table   : {
160    *(.gcc_except_table)
161    *(.gcc_except_table.*)
162  } > sdram
163  PROVIDE (__EXCEPT_END__ = .);
164  .got1           : { *(.got1) }        > sdram
165  /* Put .ctors and .dtors next to the .got2 section, so that the pointers
166     get relocated with -mrelocatable. Also put in the .fixup pointers.
167     The current compiler no longer needs this, but keep it around for 2.7.2  */
168                PROVIDE (_GOT2_START_ = .);
169  .got2           :  { *(.got2) }       > sdram
170  .dynamic        : { *(.dynamic) }     > sdram
171
172  .ctors          :
173  {
174    /* gcc uses crtbegin.o to find the start of
175       the constructors, so we make sure it is
176       first.  Because this is a wildcard, it
177       doesn't matter if the user does not
178       actually link against crtbegin.o; the
179       linker won't look for a file to match a
180       wildcard.  The wildcard also means that it
181       doesn't matter which directory crtbegin.o
182       is in.  */
183    KEEP (*crtbegin.o(.ctors))
184    /* We don't want to include the .ctor section from
185       from the crtend.o file until after the sorted ctors.
186       The .ctor section from the crtend file contains the
187       end of ctors marker and it must be last */
188    KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
189    KEEP (*(SORT(.ctors.*)))
190    KEEP (*(.ctors))
191  } > sdram
192  .dtors          :
193  {
194    KEEP (*crtbegin.o(.dtors))
195    KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
196    KEEP (*(SORT(.dtors.*)))
197    KEEP (*(.dtors))
198  } > sdram
199
200
201                PROVIDE (_FIXUP_START_ = .);
202  .fixup          : { *(.fixup) }       > sdram
203                PROVIDE (_FIXUP_END_ = .);
204                PROVIDE (_GOT2_END_ = .);
205                PROVIDE (_GOT_START_ = .);
206
207  .got            : { *(.got) } > sdram
208  .got.plt        : { *(.got.plt) }     > sdram
209
210                PROVIDE (_GOT_END_ = .);
211
212  .jcr            : { KEEP (*(.jcr)) } > sdram
213
214  /* We want the small data sections together, so single-instruction offsets
215     can access them all, and initialized data all before uninitialized, so
216     we can shorten the on-disk segment size.  */
217/* _SDA_BASE_ = __SDATA_START__ + 0x8000; */
218  .sdata          : { *(.sdata*) *(.gnu.linkonce.s.*)   } >sdram
219  _edata  =  .;
220  _gp = .;
221  PROVIDE (edata = .);
222  .sbss      :
223  {
224    _clear_start = .;
225    PROVIDE (__sbss_start = .);
226    *(.dynsbss)
227    *(.sbss* .gnu.linkonce.sb.*)
228    *(.scommon)
229    /* avoid empty sdata/sbss area -- __eabi would not set up r13
230     * which may be important if run-time loading is used
231     */
232    . += 1;
233    . = ALIGN(16);
234    PROVIDE (__sbss_end = .);
235  } > sdram
236  .plt   : { *(.plt) }  > sdram
237  .bss       :
238  {
239   PROVIDE (__bss_start = .);
240   *(.dynbss)
241   *(.bss .bss* .gnu.linkonce.b*)
242   *(COMMON)
243  . = ALIGN(16);
244  _end = . ;
245  __rtems_end = . ;
246  PROVIDE (end = .);
247
248  . += _StackSize;
249  _fstack = .;
250
251  WorkAreaBase = .;
252
253    . = ALIGN (16);
254    _stack_init = .;
255    _clear_end = .;
256
257  } > sdram
258
259
260  /DISCARD/ :
261  {
262    *(.comment)
263  }
264
265
266  /* Stabs debugging sections.  */
267  .stab 0 : { *(.stab) }
268  .stabstr 0 : { *(.stabstr) }
269  .stab.excl 0 : { *(.stab.excl) }
270  .stab.exclstr 0 : { *(.stab.exclstr) }
271  .stab.index 0 : { *(.stab.index) }
272  .stab.indexstr 0 : { *(.stab.indexstr) }
273  .comment 0 : { *(.comment) }
274
275  /* DWARF debug sections.
276     Symbols in the DWARF debugging sections are relative to the beginning
277     of the section so we begin them at 0.  */
278  /* DWARF 1 */
279  .debug          0 : { *(.debug) }
280  .line           0 : { *(.line) }
281 
282  /* GNU DWARF 1 extensions */
283  .debug_srcinfo  0 : { *(.debug_srcinfo) }
284  .debug_sfnames  0 : { *(.debug_sfnames) }
285 
286  /* DWARF 1.1 and DWARF 2 */
287  .debug_aranges  0 : { *(.debug_aranges) }
288  .debug_pubnames 0 : { *(.debug_pubnames) }
289 
290  /* DWARF 2 */
291  .debug_info     0 : { *(.debug_info) }
292  .debug_abbrev   0 : { *(.debug_abbrev) }
293  .debug_line     0 : { *(.debug_line) }
294  .debug_frame    0 : { *(.debug_frame) }
295  .debug_str      0 : { *(.debug_str) }
296  .debug_loc      0 : { *(.debug_loc) }
297  .debug_macinfo  0 : { *(.debug_macinfo) }
298 
299  /* SGI/MIPS DWARF 2 extensions */
300  .debug_weaknames 0 : { *(.debug_weaknames) }
301  .debug_funcnames 0 : { *(.debug_funcnames) }
302  .debug_typenames 0 : { *(.debug_typenames) }
303  .debug_varnames  0 : { *(.debug_varnames) }
304  /* These must appear regardless of  .  */
305}
Note: See TracBrowser for help on using the repository browser.