source: rtems/c/src/lib/libbsp/or1k/shared/startup/linkcmds.base @ 1fcdd639

Last change on this file since 1fcdd639 was 1fcdd639, checked in by Joel Sherrill <joel@…>, on Jan 12, 2017 at 10:12:51 PM

powerpc/shared/linkcmds.base: Add .rela.rtemsroset and .rela.rtemsrwset

  • Property mode set to 100644
File size: 12.2 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               *(.rela.rtemsroset*)
223               *(.rela.rtemsrwset*)
224               PROVIDE_HIDDEN (__rel_iplt_start = .);
225               PROVIDE_HIDDEN (__rel_iplt_end = .);
226               PROVIDE_HIDDEN (__rela_iplt_start = .);
227               *(.rela.iplt)
228               PROVIDE_HIDDEN (__rela_iplt_end = .);
229       } > REGION_RODATA AT > REGION_RODATA_LOAD
230       .rel.plt : ALIGN_WITH_INPUT {
231               *(.rel.plt)
232       } > REGION_RODATA AT > REGION_RODATA_LOAD
233       .rela.plt : ALIGN_WITH_INPUT {
234               *(.rela.plt)
235       } > REGION_RODATA AT > REGION_RODATA_LOAD
236       .plt : ALIGN_WITH_INPUT {
237               *(.plt)
238       } > REGION_RODATA AT > REGION_RODATA_LOAD
239       .iplt : ALIGN_WITH_INPUT {
240               *(.iplt)
241       } > REGION_RODATA AT > REGION_RODATA_LOAD
242       .dynamic : ALIGN_WITH_INPUT {
243               *(.dynamic)
244       } > REGION_RODATA AT > REGION_RODATA_LOAD
245       .got : ALIGN_WITH_INPUT {
246               *(.got.plt) *(.igot.plt) *(.got) *(.igot)
247       } > REGION_RODATA AT > REGION_RODATA_LOAD
248       .rtemsroset : ALIGN_WITH_INPUT {
249               /* Special FreeBSD linker set sections */
250               __start_set_sysctl_set = .;
251               *(set_sysctl_*);
252               __stop_set_sysctl_set = .;
253               *(set_domain_*);
254               *(set_pseudo_*);
255
256               KEEP (*(SORT(.rtemsroset.*)))
257               bsp_section_rodata_end = .;
258       } > REGION_RODATA AT > REGION_RODATA_LOAD
259  bsp_section_rodata_size = bsp_section_rodata_end - bsp_section_rodata_begin;
260  bsp_section_rodata_load_begin = LOADADDR (.rodata);
261  bsp_section_rodata_load_end = bsp_section_rodata_load_begin + bsp_section_rodata_size;
262
263.rwbarrier : ALIGN_WITH_INPUT {
264    . = ALIGN (bsp_section_rwbarrier_align);
265  } > REGION_DATA AT > REGION_DATA
266
267.data : ALIGN_WITH_INPUT {
268    bsp_section_data_begin = .;
269    *(.data .data.* .gnu.linkonce.d.*)
270    SORT(CONSTRUCTORS)
271  } > REGION_DATA AT > REGION_DATA_LOAD
272  .data1 : ALIGN_WITH_INPUT {
273    *(.data1)
274  } > REGION_DATA AT > REGION_DATA_LOAD
275  .rtemsrwset : ALIGN_WITH_INPUT {
276    KEEP (*(SORT(.rtemsrwset.*)))
277    bsp_section_data_end = .;
278  } > REGION_DATA AT > REGION_DATA_LOAD
279  bsp_section_data_size = bsp_section_data_end - bsp_section_data_begin;
280  bsp_section_data_load_begin = LOADADDR (.data);
281  bsp_section_data_load_end = bsp_section_data_load_begin + bsp_section_data_size;
282
283  .bss : ALIGN_WITH_INPUT {
284    bsp_section_bss_begin = .;
285    *(.dynbss)
286    *(.bss .bss.* .gnu.linkonce.b.*)
287    *(COMMON)
288    bsp_section_bss_end = .;
289  } > REGION_BSS AT > REGION_BSS
290  bsp_section_bss_size = bsp_section_bss_end - bsp_section_bss_begin;
291
292.work : ALIGN_WITH_INPUT {
293    /*
294     * The work section will occupy the remaining REGION_WORK region and
295     * contains the RTEMS work space and heap.
296     */
297    bsp_section_work_begin = .;
298    . += ORIGIN (REGION_WORK) + LENGTH (REGION_WORK) - ABSOLUTE (.);
299    bsp_section_work_end = .;
300  } > REGION_WORK AT > REGION_WORK
301  bsp_section_work_size = bsp_section_work_end - bsp_section_work_begin;
302
303  .stack : ALIGN_WITH_INPUT {
304    bsp_section_stack_end = .;
305  } > REGION_STACK AT > REGION_STACK
306  bsp_section_stack_size = bsp_section_stack_begin - bsp_section_stack_end;
307
308  RamBase = ORIGIN (REGION_WORK);
309  RamSize = LENGTH (REGION_WORK);
310  WorkAreaBase = bsp_section_work_begin;
311  HeapSize = 0;
312}
Note: See TracBrowser for help on using the repository browser.