source: rtems/c/src/lib/libbsp/or1k/shared/startup/linkcmds.base @ 2a583a00

5
Last change on this file since 2a583a00 was fd57015, checked in by Hesham ALMatary <heshamelmatary@…>, on 08/20/14 at 17:23:20

Add new (first) OpenRISC BSP called or1ksim.

This BSP is intended to run on or1ksim (the main OpenRISC emulator).
Fixed version according to Joel comments from the mailing list.

  • Property mode set to 100644
File size: 12.1 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup bsp_linker
5 *
6 * @brief Linker command base file.
7 */
8
9/*
10 * COPYRIGHT (c) 2014 Hesham ALMatary <heshamelmatary@gmail.com>
11 *
12 * The license and distribution terms for this file may be
13 * found in the file LICENSE in this distribution or at
14 * http://www.rtems.org/license/LICENSE
15 */
16
17OUTPUT_ARCH (or1k)
18
19ENTRY (_start)
20
21/*
22 * Global symbols that may be defined externally
23 */
24
25bsp_start_vector_table_begin = 0x1F00;
26bsp_vector_table_size = DEFINED (bsp_vector_table_size) ? bsp_vector_table_size
27: 8260;
28/* 8192 for raw vector table, and 17 * 4 for handlers vector. */
29
30bsp_section_xbarrier_align  = DEFINED (bsp_section_xbarrier_align) ? bsp_section_xbarrier_align : 1;
31bsp_section_robarrier_align = DEFINED (bsp_section_robarrier_align) ? bsp_section_robarrier_align : 1;
32bsp_section_rwbarrier_align = DEFINED (bsp_section_rwbarrier_align) ? bsp_section_rwbarrier_align : 1;
33
34bsp_stack_align = DEFINED (bsp_stack_align) ? bsp_stack_align : 8;
35
36bsp_stack_main_size = DEFINED (bsp_stack_main_size) ? bsp_stack_main_size : 0;
37bsp_stack_main_size = ALIGN (bsp_stack_main_size, bsp_stack_align);
38
39bsp_processor_count = DEFINED (bsp_processor_count) ? bsp_processor_count : 1;
40
41SECTIONS {
42
43  .vector : ALIGN_WITH_INPUT {
44    *(.vector)
45    . = ALIGN(bsp_vector_table_size);
46    bsp_section_vector_end = .;
47  } > REGION_VECTOR AT > REGION_VECTOR
48  bsp_section_vector_size = bsp_section_vector_end - bsp_section_vector_begin;
49  bsp_vector_table_begin = bsp_section_vector_begin;
50  bsp_vector_table_end = bsp_vector_table_begin + bsp_vector_table_size;
51
52  .start : ALIGN_WITH_INPUT {
53    bsp_section_start_begin = .;
54    KEEP (*(.bsp_start_text))
55    KEEP (*(.bsp_start_data))
56    bsp_section_start_end = .;
57  } > REGION_START AT > REGION_START
58  bsp_section_start_size = bsp_section_start_end - bsp_section_start_begin;
59
60.xbarrier : ALIGN_WITH_INPUT {
61    . = ALIGN (bsp_section_xbarrier_align);
62  } > REGION_VECTOR AT > REGION_VECTOR
63
64.text : ALIGN_WITH_INPUT {
65    bsp_section_text_begin = .;
66    *(.text.unlikely .text.*_unlikely)
67    *(.text .stub .text.* .gnu.linkonce.t.*)
68    /* .gnu.warning sections are handled specially by elf32.em.  */
69    *(.gnu.warning)
70    *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)
71  } > REGION_TEXT AT > REGION_TEXT_LOAD
72  .init : ALIGN_WITH_INPUT {
73    KEEP (*(.init))
74  } > REGION_TEXT AT > REGION_TEXT_LOAD
75  .fini : ALIGN_WITH_INPUT {
76    KEEP (*(.fini))
77    bsp_section_text_end = .;
78  } > REGION_TEXT AT > REGION_TEXT_LOAD
79  bsp_section_text_size = bsp_section_text_end - bsp_section_text_begin;
80  bsp_section_text_load_begin = LOADADDR (.text);
81  bsp_section_text_load_end = bsp_section_text_load_begin + bsp_section_text_size;
82
83.robarrier : ALIGN_WITH_INPUT {
84    . = ALIGN (bsp_section_robarrier_align);
85  } > REGION_RODATA AT > REGION_RODATA
86
87.rodata : ALIGN_WITH_INPUT {
88    bsp_section_rodata_begin = .;
89    *(.rodata .rodata.* .gnu.linkonce.r.*)
90  } > REGION_RODATA AT > REGION_RODATA_LOAD
91.eh_frame : ALIGN_WITH_INPUT {
92               KEEP (*(.eh_frame))
93       } > REGION_RODATA AT > REGION_RODATA_LOAD
94       .gcc_except_table : ALIGN_WITH_INPUT {
95               *(.gcc_except_table .gcc_except_table.*)
96       } > REGION_RODATA AT > REGION_RODATA_LOAD
97       .tdata : ALIGN_WITH_INPUT {
98               _TLS_Data_begin = .;
99               *(.tdata .tdata.* .gnu.linkonce.td.*)
100               _TLS_Data_end = .;
101       } > REGION_RODATA AT > REGION_RODATA_LOAD
102       .tbss : ALIGN_WITH_INPUT {
103               _TLS_BSS_begin = .;
104               *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
105               _TLS_BSS_end = .;
106       } > REGION_RODATA AT > REGION_RODATA_LOAD
107       _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
108       _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
109       _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
110       _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
111       _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
112       _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
113       .preinit_array : ALIGN_WITH_INPUT {
114               PROVIDE_HIDDEN (__preinit_array_start = .);
115               KEEP (*(.preinit_array))
116               PROVIDE_HIDDEN (__preinit_array_end = .);
117       } > REGION_RODATA AT > REGION_RODATA_LOAD
118       .init_array : ALIGN_WITH_INPUT {
119               PROVIDE_HIDDEN (__init_array_start = .);
120               KEEP (*(SORT(.init_array.*)))
121               KEEP (*(.init_array))
122               PROVIDE_HIDDEN (__init_array_end = .);
123       } > REGION_RODATA AT > REGION_RODATA_LOAD
124       .fini_array : ALIGN_WITH_INPUT {
125               PROVIDE_HIDDEN (__fini_array_start = .);
126               KEEP (*(.fini_array))
127               KEEP (*(SORT(.fini_array.*)))
128               PROVIDE_HIDDEN (__fini_array_end = .);
129       } > REGION_RODATA AT > REGION_RODATA_LOAD
130       .ctors : ALIGN_WITH_INPUT {
131               /* gcc uses crtbegin.o to find the start of
132                  the constructors, so we make sure it is
133                  first.  Because this is a wildcard, it
134                  doesn't matter if the user does not
135                  actually link against crtbegin.o; the
136                  linker won't look for a file to match a
137                  wildcard.  The wildcard also means that it
138                  doesn't matter which directory crtbegin.o
139                  is in.  */
140               KEEP (*crtbegin.o(.ctors))
141               KEEP (*crtbegin?.o(.ctors))
142               /* We don't want to include the .ctor section from
143                  the crtend.o file until after the sorted ctors.
144                  The .ctor section from the crtend file contains the
145                  end of ctors marker and it must be last */
146               KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
147               KEEP (*(SORT(.ctors.*)))
148               KEEP (*(.ctors))
149       } > REGION_RODATA AT > REGION_RODATA_LOAD
150       .dtors : ALIGN_WITH_INPUT {
151               KEEP (*crtbegin.o(.dtors))
152               KEEP (*crtbegin?.o(.dtors))
153               KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
154               KEEP (*(SORT(.dtors.*)))
155               KEEP (*(.dtors))
156       } > REGION_RODATA AT > REGION_RODATA_LOAD
157       .data.rel.ro : ALIGN_WITH_INPUT {
158               *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*)
159               *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*)
160       } > REGION_RODATA AT > REGION_RODATA_LOAD
161       .jcr : ALIGN_WITH_INPUT {
162               KEEP (*(.jcr))
163       } > REGION_RODATA AT > REGION_RODATA_LOAD
164       .interp : ALIGN_WITH_INPUT {
165               *(.interp)
166       } > REGION_RODATA AT > REGION_RODATA_LOAD
167       .note.gnu.build-id : ALIGN_WITH_INPUT {
168               *(.note.gnu.build-id)
169       } > REGION_RODATA AT > REGION_RODATA_LOAD
170       .hash : ALIGN_WITH_INPUT {
171               *(.hash)
172       } > REGION_RODATA AT > REGION_RODATA_LOAD
173       .gnu.hash : ALIGN_WITH_INPUT {
174               *(.gnu.hash)
175       } > REGION_RODATA AT > REGION_RODATA_LOAD
176       .dynsym : ALIGN_WITH_INPUT {
177               *(.dynsym)
178       } > REGION_RODATA AT > REGION_RODATA_LOAD
179       .dynstr : ALIGN_WITH_INPUT {
180               *(.dynstr)
181       } > REGION_RODATA AT > REGION_RODATA_LOAD
182       .gnu.version : ALIGN_WITH_INPUT {
183               *(.gnu.version)
184       } > REGION_RODATA AT > REGION_RODATA_LOAD
185       .gnu.version_d : ALIGN_WITH_INPUT {
186               *(.gnu.version_d)
187       } > REGION_RODATA AT > REGION_RODATA_LOAD
188       .gnu.version_r : ALIGN_WITH_INPUT {
189               *(.gnu.version_r)
190       } > REGION_RODATA AT > REGION_RODATA_LOAD
191       .rel.dyn : ALIGN_WITH_INPUT {
192               *(.rel.init)
193               *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
194               *(.rel.fini)
195               *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
196               *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
197               *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
198               *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
199               *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
200               *(.rel.ctors)
201               *(.rel.dtors)
202               *(.rel.got)
203               *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
204               PROVIDE_HIDDEN (__rel_iplt_start = .);
205               *(.rel.iplt)
206               PROVIDE_HIDDEN (__rel_iplt_end = .);
207               PROVIDE_HIDDEN (__rela_iplt_start = .);
208               PROVIDE_HIDDEN (__rela_iplt_end = .);
209       } > REGION_RODATA AT > REGION_RODATA_LOAD
210       .rela.dyn : ALIGN_WITH_INPUT {
211               *(.rela.init)
212               *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
213               *(.rela.fini)
214               *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
215               *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
216               *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
217               *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
218               *(.rela.ctors)
219               *(.rela.dtors)
220               *(.rela.got)
221               *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
222               PROVIDE_HIDDEN (__rel_iplt_start = .);
223               PROVIDE_HIDDEN (__rel_iplt_end = .);
224               PROVIDE_HIDDEN (__rela_iplt_start = .);
225               *(.rela.iplt)
226               PROVIDE_HIDDEN (__rela_iplt_end = .);
227       } > REGION_RODATA AT > REGION_RODATA_LOAD
228       .rel.plt : ALIGN_WITH_INPUT {
229               *(.rel.plt)
230       } > REGION_RODATA AT > REGION_RODATA_LOAD
231       .rela.plt : ALIGN_WITH_INPUT {
232               *(.rela.plt)
233       } > REGION_RODATA AT > REGION_RODATA_LOAD
234       .plt : ALIGN_WITH_INPUT {
235               *(.plt)
236       } > REGION_RODATA AT > REGION_RODATA_LOAD
237       .iplt : ALIGN_WITH_INPUT {
238               *(.iplt)
239       } > REGION_RODATA AT > REGION_RODATA_LOAD
240       .dynamic : ALIGN_WITH_INPUT {
241               *(.dynamic)
242       } > REGION_RODATA AT > REGION_RODATA_LOAD
243       .got : ALIGN_WITH_INPUT {
244               *(.got.plt) *(.igot.plt) *(.got) *(.igot)
245       } > REGION_RODATA AT > REGION_RODATA_LOAD
246       .rtemsroset : ALIGN_WITH_INPUT {
247               /* Special FreeBSD linker set sections */
248               __start_set_sysctl_set = .;
249               *(set_sysctl_*);
250               __stop_set_sysctl_set = .;
251               *(set_domain_*);
252               *(set_pseudo_*);
253
254               KEEP (*(SORT(.rtemsroset.*)))
255               bsp_section_rodata_end = .;
256       } > REGION_RODATA AT > REGION_RODATA_LOAD
257  bsp_section_rodata_size = bsp_section_rodata_end - bsp_section_rodata_begin;
258  bsp_section_rodata_load_begin = LOADADDR (.rodata);
259  bsp_section_rodata_load_end = bsp_section_rodata_load_begin + bsp_section_rodata_size;
260
261.rwbarrier : ALIGN_WITH_INPUT {
262    . = ALIGN (bsp_section_rwbarrier_align);
263  } > REGION_DATA AT > REGION_DATA
264
265.data : ALIGN_WITH_INPUT {
266    bsp_section_data_begin = .;
267    *(.data .data.* .gnu.linkonce.d.*)
268    SORT(CONSTRUCTORS)
269  } > REGION_DATA AT > REGION_DATA_LOAD
270  .data1 : ALIGN_WITH_INPUT {
271    *(.data1)
272  } > REGION_DATA AT > REGION_DATA_LOAD
273  .rtemsrwset : ALIGN_WITH_INPUT {
274    KEEP (*(SORT(.rtemsrwset.*)))
275    bsp_section_data_end = .;
276  } > REGION_DATA AT > REGION_DATA_LOAD
277  bsp_section_data_size = bsp_section_data_end - bsp_section_data_begin;
278  bsp_section_data_load_begin = LOADADDR (.data);
279  bsp_section_data_load_end = bsp_section_data_load_begin + bsp_section_data_size;
280
281  .bss : ALIGN_WITH_INPUT {
282    bsp_section_bss_begin = .;
283    *(.dynbss)
284    *(.bss .bss.* .gnu.linkonce.b.*)
285    *(COMMON)
286    bsp_section_bss_end = .;
287  } > REGION_BSS AT > REGION_BSS
288  bsp_section_bss_size = bsp_section_bss_end - bsp_section_bss_begin;
289
290.work : ALIGN_WITH_INPUT {
291    /*
292     * The work section will occupy the remaining REGION_WORK region and
293     * contains the RTEMS work space and heap.
294     */
295    bsp_section_work_begin = .;
296    . += ORIGIN (REGION_WORK) + LENGTH (REGION_WORK) - ABSOLUTE (.);
297    bsp_section_work_end = .;
298  } > REGION_WORK AT > REGION_WORK
299  bsp_section_work_size = bsp_section_work_end - bsp_section_work_begin;
300
301  .stack : ALIGN_WITH_INPUT {
302    bsp_section_stack_end = .;
303  } > REGION_STACK AT > REGION_STACK
304  bsp_section_stack_size = bsp_section_stack_begin - bsp_section_stack_end;
305
306  RamBase = ORIGIN (REGION_WORK);
307  RamSize = LENGTH (REGION_WORK);
308  WorkAreaBase = bsp_section_work_begin;
309  HeapSize = 0;
310}
Note: See TracBrowser for help on using the repository browser.