source: rtems/c/src/lib/libbsp/powerpc/shared/startup/linkcmds.base @ f6999e6

4.115
Last change on this file since f6999e6 was c383372, checked in by Sebastian Huber <sebastian.huber@…>, on 11/13/12 at 14:01:24

bsps/powerpc: Add and use bsp_text input section

  • Property mode set to 100644
File size: 12.5 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup bsp_linker
5 *
6 * @brief Linker command base file.
7 */
8
9/*
10 * Copyright (c) 2011-2012 embedded brains GmbH.  All rights reserved.
11 *
12 *  embedded brains GmbH
13 *  Obere Lagerstr. 30
14 *  82178 Puchheim
15 *  Germany
16 *  <rtems@embedded-brains.de>
17 *
18 * The license and distribution terms for this file may be
19 * found in the file LICENSE in this distribution or at
20 * http://www.rtems.com/license/LICENSE.
21 */
22
23OUTPUT_FORMAT ("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
24
25OUTPUT_ARCH (powerpc:common)
26
27ENTRY (_start)
28
29/*
30 * Global symbols that may be defined externally
31 */
32
33bsp_section_xbarrier_align = DEFINED (bsp_section_xbarrier_align) ? bsp_section_xbarrier_align : 1;
34bsp_section_robarrier_align = DEFINED (bsp_section_robarrier_align) ? bsp_section_robarrier_align : 1;
35bsp_section_rwbarrier_align = DEFINED (bsp_section_rwbarrier_align) ? bsp_section_rwbarrier_align : 1;
36
37MEMORY {
38        UNEXPECTED_SECTIONS : ORIGIN = 0xffffffff, LENGTH = 0
39}
40
41SECTIONS {
42        .start : {
43                bsp_section_start_begin = .;
44                KEEP (*(.bsp_start_text))
45                KEEP (*(.bsp_start_data))
46                bsp_section_start_end = .;
47        } > REGION_START AT > REGION_START
48        bsp_section_start_size = bsp_section_start_end - bsp_section_start_begin;
49
50        .xbarrier : {
51                . = ALIGN (bsp_section_xbarrier_align);
52        } > REGION_TEXT
53
54        .text : {
55                bsp_section_text_begin = .;
56                *(SORT(.bsp_text*))
57                *(.text.unlikely .text.*_unlikely)
58                *(.text .stub .text.* .gnu.linkonce.t.*)
59                *(.gnu.warning)
60                *(.glink)
61        } > REGION_TEXT AT > REGION_TEXT_LOAD
62        .init : {
63                KEEP (*(.init))
64        } > REGION_TEXT AT > REGION_TEXT_LOAD
65        .fini : {
66                PROVIDE (_fini = .);
67                KEEP (*(.fini))
68                bsp_section_text_end = .;
69        } > REGION_TEXT AT > REGION_TEXT_LOAD
70        bsp_section_text_size = bsp_section_text_end - bsp_section_text_begin;
71        bsp_section_text_load_begin = LOADADDR (.text);
72        bsp_section_text_load_end = bsp_section_text_load_begin + bsp_section_text_size;
73
74        .fast_text : {
75                bsp_section_fast_text_begin = .;
76                *(.bsp_fast_text)
77                bsp_section_fast_text_end = .;
78        } > REGION_FAST_TEXT AT > REGION_FAST_TEXT_LOAD
79        bsp_section_fast_text_size = bsp_section_fast_text_end - bsp_section_fast_text_begin;
80        bsp_section_fast_text_load_begin = LOADADDR (.fast_text);
81        bsp_section_fast_text_load_end = bsp_section_fast_text_load_begin + bsp_section_fast_text_size;
82
83        .robarrier : {
84                . = ALIGN (bsp_section_robarrier_align);
85        } > REGION_RODATA
86
87        .rodata : {
88                bsp_section_rodata_begin = .;
89                *(SORT(.bsp_rodata*))
90                *(.rodata .rodata.* .gnu.linkonce.r.*)
91        } > REGION_RODATA AT > REGION_RODATA_LOAD
92        .rodata1 : {
93                *(.rodata1)
94        } > REGION_RODATA AT > REGION_RODATA_LOAD
95        .sdata2 : {
96                PROVIDE (_SDA2_BASE_ = 32768);
97                *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
98        } > REGION_RODATA AT > REGION_RODATA_LOAD
99        .sbss2 : {
100                *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
101        } > REGION_RODATA AT > REGION_RODATA_LOAD
102        .eh_frame_hdr : {
103                *(.eh_frame_hdr)
104        } > REGION_RODATA AT > REGION_RODATA_LOAD
105        .eh_frame : {
106                KEEP (*(.eh_frame))
107        } > REGION_RODATA AT > REGION_RODATA_LOAD
108        .gcc_except_table : {
109                *(.gcc_except_table .gcc_except_table.*)
110        } > REGION_RODATA AT > REGION_RODATA_LOAD
111        .tdata : {
112                *(.tdata .tdata.* .gnu.linkonce.td.*)
113        } > REGION_RODATA AT > REGION_RODATA_LOAD
114        .tbss : {
115                *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
116        } > REGION_RODATA AT > REGION_RODATA_LOAD
117        .preinit_array : {
118                PROVIDE_HIDDEN (__preinit_array_start = .);
119                KEEP (*(.preinit_array))
120                PROVIDE_HIDDEN (__preinit_array_end = .);
121        } > REGION_RODATA AT > REGION_RODATA_LOAD
122        .init_array : {
123                PROVIDE_HIDDEN (__init_array_start = .);
124                KEEP (*(SORT(.init_array.*)))
125                KEEP (*(.init_array))
126                PROVIDE_HIDDEN (__init_array_end = .);
127        } > REGION_RODATA AT > REGION_RODATA_LOAD
128        .fini_array : {
129                PROVIDE_HIDDEN (__fini_array_start = .);
130                KEEP (*(SORT(.fini_array.*)))
131                KEEP (*(.fini_array))
132                PROVIDE_HIDDEN (__fini_array_end = .);
133        } > REGION_RODATA AT > REGION_RODATA_LOAD
134        .ctors : {
135                KEEP (*crtbegin.o(.ctors))
136                KEEP (*crtbegin?.o(.ctors))
137                KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
138                KEEP (*(SORT(.ctors.*)))
139                KEEP (*(.ctors))
140        } > REGION_RODATA AT > REGION_RODATA_LOAD
141        .dtors : {
142                KEEP (*crtbegin.o(.dtors))
143                KEEP (*crtbegin?.o(.dtors))
144                KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
145                KEEP (*(SORT(.dtors.*)))
146                KEEP (*(.dtors))
147        } > REGION_RODATA AT > REGION_RODATA_LOAD
148        .jcr : {
149                KEEP (*(.jcr))
150        } > REGION_RODATA AT > REGION_RODATA_LOAD
151        .data.rel.ro : {
152                *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*)
153        } > REGION_RODATA AT > REGION_RODATA_LOAD
154        .fixup : {
155                *(.fixup)
156        } > REGION_RODATA AT > REGION_RODATA_LOAD
157        .dynamic : {
158                *(.dynamic)
159        } > REGION_RODATA AT > REGION_RODATA_LOAD
160        .got1 : {
161                *(.got1)
162        } > REGION_RODATA AT > REGION_RODATA_LOAD
163        .got2 : {
164                *(.got2)
165        } > REGION_RODATA AT > REGION_RODATA_LOAD
166        .got : {
167                *(.got)
168        } > REGION_RODATA AT > REGION_RODATA_LOAD
169        .plt : {
170                *(.plt)
171        } > REGION_RODATA AT > REGION_RODATA_LOAD
172        .iplt : {
173                *(.iplt)
174        } > REGION_RODATA AT > REGION_RODATA_LOAD
175        .interp : {
176                *(.interp)
177        } > REGION_RODATA AT > REGION_RODATA_LOAD
178        .note.gnu.build-id : {
179                *(.note.gnu.build-id)
180        } > REGION_RODATA AT > REGION_RODATA_LOAD
181        .hash : {
182                *(.hash)
183        } > REGION_RODATA AT > REGION_RODATA_LOAD
184        .gnu.hash : {
185                *(.gnu.hash)
186        } > REGION_RODATA AT > REGION_RODATA_LOAD
187        .dynsym : {
188                *(.dynsym)
189        } > REGION_RODATA AT > REGION_RODATA_LOAD
190        .dynstr : {
191                *(.dynstr)
192        } > REGION_RODATA AT > REGION_RODATA_LOAD
193        .gnu.version : {
194                *(.gnu.version)
195        } > REGION_RODATA AT > REGION_RODATA_LOAD
196        .gnu.version_d : {
197                *(.gnu.version_d)
198        } > REGION_RODATA AT > REGION_RODATA_LOAD
199        .gnu.version_r : {
200                *(.gnu.version_r)
201        } > REGION_RODATA AT > REGION_RODATA_LOAD
202        .rela.dyn : {
203                *(.rela.init)
204                *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
205                *(.rela.fini)
206                *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
207                *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
208                *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
209                *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
210                *(.rela.ctors)
211                *(.rela.dtors)
212                *(.rela.got)
213                *(.rela.got1)
214                *(.rela.got2)
215                *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
216                *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
217                *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
218                *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
219                *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
220                PROVIDE_HIDDEN (__rel_iplt_start = .);
221                PROVIDE_HIDDEN (__rel_iplt_end = .);
222                PROVIDE_HIDDEN (__rela_iplt_start = .);
223                *(.rela.iplt)
224                PROVIDE_HIDDEN (__rela_iplt_end = .);
225        } > REGION_RODATA AT > REGION_RODATA_LOAD
226        .rela.plt : {
227                *(.rela.plt)
228        } > REGION_RODATA AT > REGION_RODATA_LOAD
229        .robsdsets : {
230                /* Special FreeBSD linker set sections */
231                __start_set_sysctl_set = .;
232                *(set_sysctl_*);
233                __stop_set_sysctl_set = .;
234                *(set_domain_*);
235                *(set_pseudo_*);
236                _bsd__start_set_modmetadata_set = .;
237                *(_bsd_set_modmetadata_set);
238                _bsd__stop_set_modmetadata_set = .;
239                _bsd__start_set_sysctl_set = .;
240                *(_bsd_set_sysctl_set);
241                _bsd__stop_set_sysctl_set = .;
242
243                bsp_section_rodata_end = .;
244        } > REGION_RODATA AT > REGION_RODATA_LOAD
245        bsp_section_rodata_size = bsp_section_rodata_end - bsp_section_rodata_begin;
246        bsp_section_rodata_load_begin = LOADADDR (.rodata);
247        bsp_section_rodata_load_end = bsp_section_rodata_load_begin + bsp_section_rodata_size;
248
249        .rwbarrier : {
250                . = ALIGN (bsp_section_rwbarrier_align);
251        } > REGION_DATA
252
253        .fast_data : {
254                bsp_section_fast_data_begin = .;
255                *(SORT(.bsp_fast_data*))
256                bsp_section_fast_data_end = .;
257        } > REGION_FAST_DATA AT > REGION_FAST_DATA_LOAD
258        bsp_section_fast_data_size = bsp_section_fast_data_end - bsp_section_fast_data_begin;
259        bsp_section_fast_data_load_begin = LOADADDR (.fast_data);
260        bsp_section_fast_data_load_end = bsp_section_fast_data_load_begin + bsp_section_fast_data_size;
261
262        .data : {
263                bsp_section_data_begin = .;
264                *(SORT(.bsp_data*))
265                *(.data .data.* .gnu.linkonce.d.*)
266                SORT(CONSTRUCTORS)
267        } > REGION_DATA AT > REGION_DATA_LOAD
268        .data1 : {
269                *(.data1)
270        } > REGION_DATA AT > REGION_DATA_LOAD
271        .rwbsdsets : {
272                /* Special FreeBSD linker set sections */
273                _bsd__start_set_sysinit_set = .;
274                *(_bsd_set_sysinit_set);
275                _bsd__stop_set_sysinit_set = .;
276        } > REGION_DATA AT > REGION_DATA_LOAD
277        .sdata : {
278                PROVIDE (_SDA_BASE_ = 32768);
279                *(.sdata .sdata.* .gnu.linkonce.s.*)
280                bsp_section_data_end = .;
281        } > REGION_DATA AT > REGION_DATA_LOAD
282        bsp_section_data_size = bsp_section_data_end - bsp_section_data_begin;
283        bsp_section_data_load_begin = LOADADDR (.data);
284        bsp_section_data_load_end = bsp_section_data_load_begin + bsp_section_data_size;
285
286        .sbss : {
287                bsp_section_sbss_begin = .;
288                *(.dynsbss)
289                *(.sbss .sbss.* .gnu.linkonce.sb.*)
290                *(.scommon)
291                bsp_section_sbss_end = .;
292        } > REGION_DATA AT > REGION_DATA
293        bsp_section_sbss_size = bsp_section_sbss_end - bsp_section_sbss_begin;
294
295        .bss : {
296                bsp_section_bss_begin = .;
297                *(.dynbss)
298                *(.bss .bss.* .gnu.linkonce.b.*)
299                *(COMMON)
300                bsp_section_bss_end = .;
301        } > REGION_BSS AT > REGION_BSS
302        bsp_section_bss_size = bsp_section_bss_end - bsp_section_bss_begin;
303
304        .rwextra : {
305                bsp_section_rwextra_begin = .;
306                *(.bsp_rwextra)
307                bsp_section_rwextra_end = .;
308        } > REGION_RWEXTRA AT > REGION_RWEXTRA
309        bsp_section_rwextra_size = bsp_section_rwextra_end - bsp_section_rwextra_begin;
310
311        .work : {
312                /*
313                 * The work section will occupy the remaining REGION_WORK region and
314                 * contains the RTEMS work space and heap.
315                 */
316                bsp_section_work_begin = .;
317                . += ORIGIN (REGION_WORK) + LENGTH (REGION_WORK) - ABSOLUTE (.);
318                bsp_section_work_end = .;
319        } > REGION_WORK AT > REGION_WORK
320        bsp_section_work_size = bsp_section_work_end - bsp_section_work_begin;
321
322        .stack : {
323                /*
324                 * The stack section will occupy the remaining REGION_STACK region and may
325                 * contain the task stacks.  Depending on the region distribution this
326                 * section may be of zero size.
327                 */
328                bsp_section_stack_begin = .;
329                . += ORIGIN (REGION_STACK) + LENGTH (REGION_STACK) - ABSOLUTE (.);
330                bsp_section_stack_end = .;
331        } > REGION_STACK AT > REGION_STACK
332        bsp_section_stack_size = bsp_section_stack_end - bsp_section_stack_begin;
333
334        .nocache : {
335                bsp_section_nocache_begin = .;
336                *(SORT(.bsp_nocache*))
337                bsp_section_nocache_end = .;
338        } > REGION_NOCACHE AT > REGION_NOCACHE_LOAD
339        bsp_section_nocache_size = bsp_section_nocache_end - bsp_section_nocache_begin;
340        bsp_section_nocache_load_begin = LOADADDR (.nocache);
341        bsp_section_nocache_load_end = bsp_section_nocache_load_begin + bsp_section_nocache_size;
342
343        /* FIXME */
344        RamBase = ORIGIN (REGION_WORK);
345        RamSize = LENGTH (REGION_WORK);
346        WorkAreaBase = bsp_section_work_begin;
347        HeapSize = 0;
348
349        /* Stabs debugging sections.  */
350        .stab          0 : { *(.stab) }
351        .stabstr       0 : { *(.stabstr) }
352        .stab.excl     0 : { *(.stab.excl) }
353        .stab.exclstr  0 : { *(.stab.exclstr) }
354        .stab.index    0 : { *(.stab.index) }
355        .stab.indexstr 0 : { *(.stab.indexstr) }
356        .comment       0 : { *(.comment) }
357        /* DWARF debug sections.
358           Symbols in the DWARF debugging sections are relative to the beginning
359           of the section so we begin them at 0.  */
360        /* DWARF 1 */
361        .debug          0 : { *(.debug) }
362        .line           0 : { *(.line) }
363        /* GNU DWARF 1 extensions */
364        .debug_srcinfo  0 : { *(.debug_srcinfo .zdebug_srcinfo) }
365        .debug_sfnames  0 : { *(.debug_sfnames .zdebug_sfnames) }
366        /* DWARF 1.1 and DWARF 2 */
367        .debug_aranges  0 : { *(.debug_aranges .zdebug_aranges) }
368        .debug_pubnames 0 : { *(.debug_pubnames .zdebug_pubnames) }
369        /* DWARF 2 */
370        .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.* .zdebug_info) }
371        .debug_abbrev   0 : { *(.debug_abbrev .zdebug_abbrev) }
372        .debug_line     0 : { *(.debug_line .zdebug_line) }
373        .debug_frame    0 : { *(.debug_frame .zdebug_frame) }
374        .debug_str      0 : { *(.debug_str .zdebug_str) }
375        .debug_loc      0 : { *(.debug_loc .zdebug_loc) }
376        .debug_macinfo  0 : { *(.debug_macinfo .zdebug_macinfo) }
377        /* SGI/MIPS DWARF 2 extensions */
378        .debug_weaknames 0 : { *(.debug_weaknames .zdebug_weaknames) }
379        .debug_funcnames 0 : { *(.debug_funcnames .zdebug_funcnames) }
380        .debug_typenames 0 : { *(.debug_typenames .zdebug_typenames) }
381        .debug_varnames  0 : { *(.debug_varnames .zdebug_varnames) }
382        /* DWARF 3 */
383        .debug_pubtypes 0 : { *(.debug_pubtypes .zdebug_pubtypes) }
384        .debug_ranges   0 : { *(.debug_ranges .zdebug_ranges) }
385        .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
386        .PPC.EMB.apuinfo 0 : { *(.PPC.EMB.apuinfo) }
387        /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
388
389        /*
390         * This is a RTEMS specific section to catch all unexpected input
391         * sections.  In case you get an error like
392         *   "section `.unexpected_sections' will not fit in region
393         *   `UNEXPECTED_SECTIONS'"
394         * you have to figure out the offending input section and add it to the
395         * appropriate output section definition above.
396         */
397        .unexpected_sections : { *(*) } > UNEXPECTED_SECTIONS
398}
Note: See TracBrowser for help on using the repository browser.