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

5
Last change on this file since 53c99b8 was 53c99b8, checked in by Sebastian Huber <sebastian.huber@…>, on 10/28/15 at 09:18:05

bsps: Generalize .nocacheheap to .nocachenoload

Add ability to place data in a non-loadable cache-inhibited area.

  • Property mode set to 100644
File size: 14.2 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup bsp_linker
5 *
6 * @brief Linker command base file.
7 */
8
9/*
10 * Copyright (c) 2011-2015 embedded brains GmbH.  All rights reserved.
11 *
12 *  embedded brains GmbH
13 *  Dornierstr. 4
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.org/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 : ALIGN_WITH_INPUT {
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 : ALIGN_WITH_INPUT {
51                . = ALIGN (bsp_section_xbarrier_align);
52        } > REGION_TEXT AT > REGION_TEXT
53
54        .text : ALIGN_WITH_INPUT {
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 : ALIGN_WITH_INPUT {
63                KEEP (*(.init))
64        } > REGION_TEXT AT > REGION_TEXT_LOAD
65        .fini : ALIGN_WITH_INPUT {
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 : ALIGN_WITH_INPUT {
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 : 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                *(SORT(.bsp_rodata*))
90                *(.rodata .rodata.* .gnu.linkonce.r.*)
91        } > REGION_RODATA AT > REGION_RODATA_LOAD
92        .rodata1 : ALIGN_WITH_INPUT {
93                *(.rodata1)
94        } > REGION_RODATA AT > REGION_RODATA_LOAD
95        .sdata2 : ALIGN_WITH_INPUT {
96                PROVIDE (_SDA2_BASE_ = 32768);
97                *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
98        } > REGION_RODATA AT > REGION_RODATA_LOAD
99        .sbss2 : ALIGN_WITH_INPUT {
100                *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
101        } > REGION_RODATA AT > REGION_RODATA_LOAD
102        .eh_frame_hdr : ALIGN_WITH_INPUT {
103                *(.eh_frame_hdr)
104        } > REGION_RODATA AT > REGION_RODATA_LOAD
105        .eh_frame : ALIGN_WITH_INPUT {
106                KEEP (*(.eh_frame))
107        } > REGION_RODATA AT > REGION_RODATA_LOAD
108        .gcc_except_table : ALIGN_WITH_INPUT {
109                *(.gcc_except_table .gcc_except_table.*)
110        } > REGION_RODATA AT > REGION_RODATA_LOAD
111        .tdata : ALIGN_WITH_INPUT {
112                _TLS_Data_begin = .;
113                *(.tdata .tdata.* .gnu.linkonce.td.*)
114                _TLS_Data_end = .;
115        } > REGION_RODATA AT > REGION_RODATA_LOAD
116        .tbss : ALIGN_WITH_INPUT {
117                _TLS_BSS_begin = .;
118                *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
119                _TLS_BSS_end = .;
120        } > REGION_RODATA AT > REGION_RODATA_LOAD
121        _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
122        _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
123        _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
124        _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
125        _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
126        _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
127        .preinit_array : ALIGN_WITH_INPUT {
128                PROVIDE_HIDDEN (__preinit_array_start = .);
129                KEEP (*(.preinit_array))
130                PROVIDE_HIDDEN (__preinit_array_end = .);
131        } > REGION_RODATA AT > REGION_RODATA_LOAD
132        .init_array : ALIGN_WITH_INPUT {
133                PROVIDE_HIDDEN (__init_array_start = .);
134                KEEP (*(SORT(.init_array.*)))
135                KEEP (*(.init_array))
136                PROVIDE_HIDDEN (__init_array_end = .);
137        } > REGION_RODATA AT > REGION_RODATA_LOAD
138        .fini_array : ALIGN_WITH_INPUT {
139                PROVIDE_HIDDEN (__fini_array_start = .);
140                KEEP (*(SORT(.fini_array.*)))
141                KEEP (*(.fini_array))
142                PROVIDE_HIDDEN (__fini_array_end = .);
143        } > REGION_RODATA AT > REGION_RODATA_LOAD
144        .ctors : ALIGN_WITH_INPUT {
145                KEEP (*crtbegin.o(.ctors))
146                KEEP (*crtbegin?.o(.ctors))
147                KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
148                KEEP (*(SORT(.ctors.*)))
149                KEEP (*(.ctors))
150        } > REGION_RODATA AT > REGION_RODATA_LOAD
151        .dtors : ALIGN_WITH_INPUT {
152                KEEP (*crtbegin.o(.dtors))
153                KEEP (*crtbegin?.o(.dtors))
154                KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
155                KEEP (*(SORT(.dtors.*)))
156                KEEP (*(.dtors))
157        } > REGION_RODATA AT > REGION_RODATA_LOAD
158        .jcr : ALIGN_WITH_INPUT {
159                KEEP (*(.jcr))
160        } > REGION_RODATA AT > REGION_RODATA_LOAD
161        .data.rel.ro : ALIGN_WITH_INPUT {
162                *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*)
163        } > REGION_RODATA AT > REGION_RODATA_LOAD
164        .fixup : ALIGN_WITH_INPUT {
165                *(.fixup)
166        } > REGION_RODATA AT > REGION_RODATA_LOAD
167        .dynamic : ALIGN_WITH_INPUT {
168                *(.dynamic)
169        } > REGION_RODATA AT > REGION_RODATA_LOAD
170        .got1 : ALIGN_WITH_INPUT {
171                *(.got1)
172        } > REGION_RODATA AT > REGION_RODATA_LOAD
173        .got2 : ALIGN_WITH_INPUT {
174                *(.got2)
175        } > REGION_RODATA AT > REGION_RODATA_LOAD
176        .got : ALIGN_WITH_INPUT {
177                *(.got)
178        } > REGION_RODATA AT > REGION_RODATA_LOAD
179        .plt : ALIGN_WITH_INPUT {
180                *(.plt)
181        } > REGION_RODATA AT > REGION_RODATA_LOAD
182        .iplt : ALIGN_WITH_INPUT {
183                *(.iplt)
184        } > REGION_RODATA AT > REGION_RODATA_LOAD
185        .interp : ALIGN_WITH_INPUT {
186                *(.interp)
187        } > REGION_RODATA AT > REGION_RODATA_LOAD
188        .note.gnu.build-id : ALIGN_WITH_INPUT {
189                *(.note.gnu.build-id)
190        } > REGION_RODATA AT > REGION_RODATA_LOAD
191        .hash : ALIGN_WITH_INPUT {
192                *(.hash)
193        } > REGION_RODATA AT > REGION_RODATA_LOAD
194        .gnu.hash : ALIGN_WITH_INPUT {
195                *(.gnu.hash)
196        } > REGION_RODATA AT > REGION_RODATA_LOAD
197        .dynsym : ALIGN_WITH_INPUT {
198                *(.dynsym)
199        } > REGION_RODATA AT > REGION_RODATA_LOAD
200        .dynstr : ALIGN_WITH_INPUT {
201                *(.dynstr)
202        } > REGION_RODATA AT > REGION_RODATA_LOAD
203        .gnu.version : ALIGN_WITH_INPUT {
204                *(.gnu.version)
205        } > REGION_RODATA AT > REGION_RODATA_LOAD
206        .gnu.version_d : ALIGN_WITH_INPUT {
207                *(.gnu.version_d)
208        } > REGION_RODATA AT > REGION_RODATA_LOAD
209        .gnu.version_r : ALIGN_WITH_INPUT {
210                *(.gnu.version_r)
211        } > REGION_RODATA AT > REGION_RODATA_LOAD
212        .rela.dyn : ALIGN_WITH_INPUT {
213                *(.rela.init)
214                *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
215                *(.rela.fini)
216                *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
217                *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
218                *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
219                *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
220                *(.rela.ctors)
221                *(.rela.dtors)
222                *(.rela.got)
223                *(.rela.got1)
224                *(.rela.got2)
225                *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
226                *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
227                *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
228                *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
229                *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
230                PROVIDE_HIDDEN (__rel_iplt_start = .);
231                PROVIDE_HIDDEN (__rel_iplt_end = .);
232                PROVIDE_HIDDEN (__rela_iplt_start = .);
233                *(.rela.iplt)
234                PROVIDE_HIDDEN (__rela_iplt_end = .);
235        } > REGION_RODATA AT > REGION_RODATA_LOAD
236        .rela.plt : ALIGN_WITH_INPUT {
237                *(.rela.plt)
238        } > REGION_RODATA AT > REGION_RODATA_LOAD
239        .rtemsroset : ALIGN_WITH_INPUT {
240                /* Special FreeBSD linker set sections */
241                __start_set_sysctl_set = .;
242                *(set_sysctl_*);
243                __stop_set_sysctl_set = .;
244                *(set_domain_*);
245                *(set_pseudo_*);
246
247                KEEP (*(SORT(.rtemsroset.*)))
248                bsp_section_rodata_end = .;
249        } > REGION_RODATA AT > REGION_RODATA_LOAD
250        bsp_section_rodata_size = bsp_section_rodata_end - bsp_section_rodata_begin;
251        bsp_section_rodata_load_begin = LOADADDR (.rodata);
252        bsp_section_rodata_load_end = bsp_section_rodata_load_begin + bsp_section_rodata_size;
253
254        .rwbarrier : ALIGN_WITH_INPUT {
255                . = ALIGN (bsp_section_rwbarrier_align);
256        } > REGION_DATA AT > REGION_DATA
257
258        .fast_data : ALIGN_WITH_INPUT {
259                bsp_section_fast_data_begin = .;
260                *(SORT(.bsp_fast_data*))
261                bsp_section_fast_data_end = .;
262        } > REGION_FAST_DATA AT > REGION_FAST_DATA_LOAD
263        bsp_section_fast_data_size = bsp_section_fast_data_end - bsp_section_fast_data_begin;
264        bsp_section_fast_data_load_begin = LOADADDR (.fast_data);
265        bsp_section_fast_data_load_end = bsp_section_fast_data_load_begin + bsp_section_fast_data_size;
266
267        .data : ALIGN_WITH_INPUT {
268                bsp_section_data_begin = .;
269                *(SORT(.bsp_data*))
270                *(.data .data.* .gnu.linkonce.d.*)
271                SORT(CONSTRUCTORS)
272        } > REGION_DATA AT > REGION_DATA_LOAD
273        .data1 : ALIGN_WITH_INPUT {
274                *(.data1)
275        } > REGION_DATA AT > REGION_DATA_LOAD
276        .rtemsrwset : ALIGN_WITH_INPUT {
277                KEEP (*(SORT(.rtemsrwset.*)))
278        } > REGION_DATA AT > REGION_DATA_LOAD
279        .sdata : ALIGN_WITH_INPUT {
280                PROVIDE (_SDA_BASE_ = 32768);
281                *(.sdata .sdata.* .gnu.linkonce.s.*)
282                bsp_section_data_end = .;
283        } > REGION_DATA AT > REGION_DATA_LOAD
284        bsp_section_data_size = bsp_section_data_end - bsp_section_data_begin;
285        bsp_section_data_load_begin = LOADADDR (.data);
286        bsp_section_data_load_end = bsp_section_data_load_begin + bsp_section_data_size;
287
288        .sbss : ALIGN_WITH_INPUT {
289                bsp_section_sbss_begin = .;
290                *(.dynsbss)
291                *(.sbss .sbss.* .gnu.linkonce.sb.*)
292                *(.scommon)
293                bsp_section_sbss_end = .;
294        } > REGION_DATA AT > REGION_DATA
295        bsp_section_sbss_size = bsp_section_sbss_end - bsp_section_sbss_begin;
296
297        .bss : ALIGN_WITH_INPUT {
298                bsp_section_bss_begin = .;
299                *(.dynbss)
300                *(.bss .bss.* .gnu.linkonce.b.*)
301                *(COMMON)
302                bsp_section_bss_end = .;
303        } > REGION_BSS AT > REGION_BSS
304        bsp_section_bss_size = bsp_section_bss_end - bsp_section_bss_begin;
305
306        .rwextra : ALIGN_WITH_INPUT {
307                bsp_section_rwextra_begin = .;
308                *(.bsp_rwextra)
309                bsp_section_rwextra_end = .;
310        } > REGION_RWEXTRA AT > REGION_RWEXTRA
311        bsp_section_rwextra_size = bsp_section_rwextra_end - bsp_section_rwextra_begin;
312
313        .work : ALIGN_WITH_INPUT {
314                /*
315                 * The work section will occupy the remaining REGION_WORK region and
316                 * contains the RTEMS work space and heap.
317                 */
318                bsp_section_work_begin = .;
319                . += ORIGIN (REGION_WORK) + LENGTH (REGION_WORK) - ABSOLUTE (.);
320                bsp_section_work_end = .;
321        } > REGION_WORK AT > REGION_WORK
322        bsp_section_work_size = bsp_section_work_end - bsp_section_work_begin;
323
324        .stack : ALIGN_WITH_INPUT {
325                /*
326                 * The stack section will occupy the remaining REGION_STACK region and may
327                 * contain the task stacks.  Depending on the region distribution this
328                 * section may be of zero size.
329                 */
330                bsp_section_stack_begin = .;
331                . += ORIGIN (REGION_STACK) + LENGTH (REGION_STACK) - ABSOLUTE (.);
332                bsp_section_stack_end = .;
333        } > REGION_STACK AT > REGION_STACK
334        bsp_section_stack_size = bsp_section_stack_end - bsp_section_stack_begin;
335
336        .nocache : ALIGN_WITH_INPUT {
337                bsp_section_nocache_begin = .;
338                *(SORT(.bsp_nocache*))
339                bsp_section_nocache_end = .;
340        } > REGION_NOCACHE AT > REGION_NOCACHE_LOAD
341        bsp_section_nocache_size = bsp_section_nocache_end - bsp_section_nocache_begin;
342        bsp_section_nocache_load_begin = LOADADDR (.nocache);
343        bsp_section_nocache_load_end = bsp_section_nocache_load_begin + bsp_section_nocache_size;
344
345        .nocachenoload (NOLOAD) : ALIGN_WITH_INPUT {
346                bsp_section_nocachenoload_begin = .;
347                *(SORT(.bsp_noload_nocache*))
348                bsp_section_nocacheheap_begin = .;
349                . += ORIGIN (REGION_NOCACHE) + LENGTH (REGION_NOCACHE) - ABSOLUTE (.);
350                bsp_section_nocacheheap_end = .;
351                bsp_section_nocachenoload_end = .;
352        } > REGION_NOCACHE AT > REGION_NOCACHE
353        bsp_section_nocacheheap_size = bsp_section_nocacheheap_end - bsp_section_nocacheheap_begin;
354        bsp_section_nocachenoload_size = bsp_section_nocachenoload_end - bsp_section_nocachenoload_begin;
355
356        .nvram (NOLOAD) : ALIGN_WITH_INPUT {
357                bsp_section_nvram_begin = .;
358                *(SORT(.bsp_nvram*))
359                bsp_section_nvram_end = .;
360        } > REGION_NVRAM AT > REGION_NVRAM
361        bsp_section_nvram_size = bsp_section_nvram_end - bsp_section_nvram_begin;
362
363        /* FIXME */
364        RamBase = ORIGIN (REGION_WORK);
365        RamSize = LENGTH (REGION_WORK);
366        WorkAreaBase = bsp_section_work_begin;
367        HeapSize = 0;
368
369        /* Stabs debugging sections.  */
370        .stab          0 : { *(.stab) }
371        .stabstr       0 : { *(.stabstr) }
372        .stab.excl     0 : { *(.stab.excl) }
373        .stab.exclstr  0 : { *(.stab.exclstr) }
374        .stab.index    0 : { *(.stab.index) }
375        .stab.indexstr 0 : { *(.stab.indexstr) }
376        .comment       0 : { *(.comment) }
377        /* DWARF debug sections.
378           Symbols in the DWARF debugging sections are relative to the beginning
379           of the section so we begin them at 0.  */
380        /* DWARF 1 */
381        .debug          0 : { *(.debug) }
382        .line           0 : { *(.line) }
383        /* GNU DWARF 1 extensions */
384        .debug_srcinfo  0 : { *(.debug_srcinfo) }
385        .debug_sfnames  0 : { *(.debug_sfnames) }
386        /* DWARF 1.1 and DWARF 2 */
387        .debug_aranges  0 : { *(.debug_aranges) }
388        .debug_pubnames 0 : { *(.debug_pubnames) }
389        /* DWARF 2 */
390        .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
391        .debug_abbrev   0 : { *(.debug_abbrev) }
392        .debug_line     0 : { *(.debug_line .debug_line.* .debug_line_end ) }
393        .debug_frame    0 : { *(.debug_frame) }
394        .debug_str      0 : { *(.debug_str) }
395        .debug_loc      0 : { *(.debug_loc) }
396        .debug_macinfo  0 : { *(.debug_macinfo) }
397        /* SGI/MIPS DWARF 2 extensions */
398        .debug_weaknames 0 : { *(.debug_weaknames) }
399        .debug_funcnames 0 : { *(.debug_funcnames) }
400        .debug_typenames 0 : { *(.debug_typenames) }
401        .debug_varnames  0 : { *(.debug_varnames) }
402        /* DWARF 3 */
403        .debug_pubtypes 0 : { *(.debug_pubtypes) }
404        .debug_ranges   0 : { *(.debug_ranges) }
405        /* DWARF Extension.  */
406        .debug_macro    0 : { *(.debug_macro) }
407        .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
408        .PPC.EMB.apuinfo 0 : { *(.PPC.EMB.apuinfo) }
409        /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
410
411        /*
412         * This is a RTEMS specific section to catch all unexpected input
413         * sections.  In case you get an error like
414         *   "section `.unexpected_sections' will not fit in region
415         *   `UNEXPECTED_SECTIONS'"
416         * you have to figure out the offending input section and add it to the
417         * appropriate output section definition above.
418         */
419        .unexpected_sections : { *(*) } > UNEXPECTED_SECTIONS
420}
Note: See TracBrowser for help on using the repository browser.