source: rtems/c/src/lib/libbsp/arm/shared/startup/linkcmds.base @ c5d8d2dc

4.115
Last change on this file since c5d8d2dc was c5d8d2dc, checked in by Sebastian Huber <sebastian.huber@…>, on 06/21/10 at 12:28:36

2010-06-21 Sebastian Huber <sebastian.huber@…>

  • shared/start/start.S, shared/startup/linkcmds.base, shared/include/linker-symbols.h: Added and use bsp_vector_table_begin, bsp_vector_table_size and bsp_vector_table_end.
  • Property mode set to 100644
File size: 10.8 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup bsp_linker
5 *
6 * @brief Linker command base file.
7 */
8
9/*
10 * Copyright (c) 2008
11 * Embedded Brains GmbH
12 * Obere Lagerstr. 30
13 * D-82178 Puchheim
14 * Germany
15 * rtems@embedded-brains.de
16 *
17 * The license and distribution terms for this file may be found in the file
18 * LICENSE in this distribution or at http://www.rtems.com/license/LICENSE.
19 */
20
21OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
22
23OUTPUT_ARCH (arm)
24
25ENTRY (start)
26
27/*
28 * BSP: Global symbols that may be defined externally
29 */
30
31bsp_stack_align = DEFINED (bsp_stack_align) ? bsp_stack_align : 4;
32
33bsp_section_align = DEFINED (bsp_section_align) ? bsp_section_align : 32;
34
35bsp_section_start_end_align = DEFINED (bsp_section_start_end_align) ? bsp_section_start_end_align : bsp_section_align;
36bsp_section_vector_end_align = DEFINED (bsp_section_vector_end_align) ? bsp_section_vector_end_align : bsp_section_align;
37bsp_section_text_end_align = DEFINED (bsp_section_text_end_align) ? bsp_section_text_end_align : bsp_section_align;
38bsp_section_rodata_end_align = DEFINED (bsp_section_rodata_end_align) ? bsp_section_rodata_end_align : bsp_section_align;
39bsp_section_data_end_align = DEFINED (bsp_section_data_end_align) ? bsp_section_data_end_align : bsp_section_align;
40bsp_section_fast_end_align = DEFINED (bsp_section_fast_end_align) ? bsp_section_fast_end_align : bsp_section_align;
41bsp_section_bss_end_align = DEFINED (bsp_section_bss_end_align) ? bsp_section_bss_end_align : bsp_section_align;
42
43bsp_section_vbarrier_align = DEFINED (bsp_section_vbarrier_align) ? bsp_section_vbarrier_align : 1;
44bsp_section_robarrier_align = DEFINED (bsp_section_robarrier_align) ? bsp_section_robarrier_align : 1;
45
46bsp_stack_abt_size = DEFINED (bsp_stack_abt_size) ? bsp_stack_abt_size : 128;
47bsp_stack_abt_size = ALIGN (bsp_stack_abt_size, bsp_stack_align);
48
49bsp_stack_fiq_size = DEFINED (bsp_stack_fiq_size) ? bsp_stack_fiq_size : 128;
50bsp_stack_fiq_size = ALIGN (bsp_stack_fiq_size, bsp_stack_align);
51
52bsp_stack_irq_size = DEFINED (bsp_stack_irq_size) ? bsp_stack_irq_size : 512;
53bsp_stack_irq_size = ALIGN (bsp_stack_irq_size, bsp_stack_align);
54
55bsp_stack_svc_size = DEFINED (bsp_stack_svc_size) ? bsp_stack_svc_size : 512;
56bsp_stack_svc_size = ALIGN (bsp_stack_svc_size, bsp_stack_align);
57
58bsp_stack_und_size = DEFINED (bsp_stack_und_size) ? bsp_stack_und_size : 128;
59bsp_stack_und_size = ALIGN (bsp_stack_und_size, bsp_stack_align);
60
61bsp_vector_table_size = DEFINED (bsp_vector_table_size) ? bsp_vector_table_size : 64;
62
63SECTIONS {
64        .start : {
65                /*
66                 * BSP: Begin of start section
67                 */
68                bsp_section_start_begin = .;
69
70                /*
71                 * BSP: System startup entry
72                 */
73                KEEP (*(.bsp_start))
74                KEEP (*(.bsp_start_data))
75
76                . = ALIGN (bsp_section_start_end_align);
77
78                /*
79                 * BSP: End of start section
80                 */
81                bsp_section_start_end = .;
82        } > REGION_START AT > REGION_START
83
84        bsp_section_start_size = bsp_section_start_end - bsp_section_start_begin;
85
86        .vector : {
87                /*
88                 * BSP: Begin of vector section
89                 */
90                bsp_section_vector_begin = .;
91
92                /*
93                 * BSP: Reserve space for the the exception vector table and
94                 * the pointers to the default exceptions handlers.
95                 */
96                . = . + bsp_vector_table_size;
97
98                /*
99                 * BSP: Reserve space for mode stacks
100                 */
101
102                . = ALIGN (bsp_stack_align);
103
104                bsp_stack_abt_begin = .;
105                . = . + bsp_stack_abt_size;
106                bsp_stack_abt_end = .;
107
108                bsp_stack_fiq_begin = .;
109                . = . + bsp_stack_fiq_size;
110                bsp_stack_fiq_end = .;
111
112                bsp_stack_irq_begin = .;
113                . = . + bsp_stack_irq_size;
114                bsp_stack_irq_end = .;
115
116                bsp_stack_svc_begin = .;
117                . = . + bsp_stack_svc_size;
118                bsp_stack_svc_end = .;
119
120                bsp_stack_und_begin = .;
121                . = . + bsp_stack_und_size;
122                bsp_stack_und_end = .;
123
124                /*
125                 * BSP: Special vector data
126                 */
127                *(.bsp_vector)
128
129                . = ALIGN (bsp_section_vector_end_align);
130
131                /*
132                 * BSP: End of vector section
133                 */
134                bsp_section_vector_end = .;
135        } > REGION_VECTOR AT > REGION_VECTOR
136
137        bsp_section_vector_size = bsp_section_vector_end - bsp_section_vector_begin;
138
139        bsp_vector_table_begin = bsp_vector_table_size != 0 ? bsp_section_vector_begin : bsp_section_start_begin;
140        bsp_vector_table_end = bsp_vector_table_begin + bsp_vector_table_size;
141
142        .vbarrier : {
143                . = ALIGN (bsp_section_vbarrier_align);
144        } > REGION_VECTOR
145
146        .text : {
147                /*
148                 * BSP: Begin of text section
149                 */
150                bsp_section_text_begin = .;
151
152                /*
153                 * BSP: Moved into .text from .init
154                 */
155                KEEP (*(.init))
156
157                *(.text .stub .text.* .gnu.linkonce.t.*)
158                KEEP (*(.text.*personality*))
159                /* .gnu.warning sections are handled specially by elf32.em.  */
160                *(.gnu.warning)
161
162                /*
163                 * BSP: Magic ARM stuff
164                 */
165                *(.ARM.*)
166                *(.glue_7)
167                *(.glue_7t)
168                *(.vfp11_veneer)
169               
170                /*
171                 * BSP: Special FreeBSD sysctl sections
172                 */
173                . = ALIGN (16);
174                __start_set_sysctl_set = .;
175                *(set_sysctl_*);
176                __stop_set_sysctl_set = ABSOLUTE(.);
177                *(set_domain_*);
178                *(set_pseudo_*);
179
180                /*
181                 * BSP: Moved into .text from .*
182                 */
183                *(.eh_frame_hdr)
184
185                /*
186                 * BSP: Required by cpukit/score/src/threadhandler.c
187                 */
188                PROVIDE (_fini = .);
189
190                /*
191                 * BSP: Moved into .text from .fini
192                 */
193                KEEP (*(.fini))
194
195                . = ALIGN (bsp_section_text_end_align);
196
197                /*
198                 * BSP: End of text section
199                 */
200                bsp_section_text_end = .;
201        } > REGION_TEXT AT > REGION_TEXT_LOAD
202
203        bsp_section_text_size = bsp_section_text_end - bsp_section_text_begin;
204
205        bsp_section_text_load_begin = LOADADDR (.text);
206
207        .rodata : {
208                /*
209                 * BSP: Begin of rodata section
210                 */
211                bsp_section_rodata_begin = .;
212
213                __start_set_modmetadata_set = .;
214                *(set_modmetadata_set);
215                __stop_set_modmetadata_set = .;
216
217                /*
218                 * BSP: Moved into .rodata from .*
219                 */
220                *(.rodata .rodata.* .gnu.linkonce.r.*)
221                *(.rodata1)
222
223                . = ALIGN (bsp_section_rodata_end_align);
224
225                /*
226                 * BSP: End of rodata section
227                 */
228                bsp_section_rodata_end = .;
229        } > REGION_RODATA AT > REGION_RODATA_LOAD
230
231        bsp_section_rodata_size = bsp_section_rodata_end - bsp_section_rodata_begin;
232
233        bsp_section_rodata_load_begin = LOADADDR (.rodata);
234
235        .robarrier : {
236                . = ALIGN (bsp_section_robarrier_align);
237        } > REGION_RODATA
238
239        .data : {
240                /*
241                 * BSP: Begin of data section
242                 */
243                bsp_section_data_begin = .;
244
245                /*
246                 * BSP: Moved into .data from .ctors
247                 */
248                /* gcc uses crtbegin.o to find the start of
249                   the constructors, so we make sure it is
250                   first.  Because this is a wildcard, it
251                   doesn't matter if the user does not
252                   actually link against crtbegin.o; the
253                   linker won't look for a file to match a
254                   wildcard.  The wildcard also means that it
255                   doesn't matter which directory crtbegin.o
256                   is in.  */
257                KEEP (*crtbegin.o(.ctors))
258                KEEP (*crtbegin?.o(.ctors))
259                /* We don't want to include the .ctor section from
260                   the crtend.o file until after the sorted ctors.
261                   The .ctor section from the crtend file contains the
262                   end of ctors marker and it must be last */
263                KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
264                KEEP (*(SORT(.ctors.*)))
265                KEEP (*(.ctors))
266
267                /*
268                 * BSP: Moved into .data from .dtors
269                 */
270                KEEP (*crtbegin.o(.dtors))
271                KEEP (*crtbegin?.o(.dtors))
272                KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
273                KEEP (*(SORT(.dtors.*)))
274                KEEP (*(.dtors))
275
276                /*
277                 * BSP: Moved into .data from .*
278                 */
279                *(.data1)
280                KEEP (*(.eh_frame))
281                *(.gcc_except_table .gcc_except_table.*)
282                KEEP (*(.jcr))
283
284                *(.data .data.* .gnu.linkonce.d.*)
285                KEEP (*(.gnu.linkonce.d.*personality*))
286                SORT(CONSTRUCTORS)
287
288                . = ALIGN (bsp_section_data_end_align);
289
290                /*
291                 * BSP: End of data section
292                 */
293                bsp_section_data_end = .;
294        } > REGION_DATA AT > REGION_DATA_LOAD
295
296        bsp_section_data_size = bsp_section_data_end - bsp_section_data_begin;
297
298        bsp_section_data_load_begin = LOADADDR (.data);
299
300        .fast : {
301                bsp_section_fast_begin = .;
302
303                *(.bsp_fast)
304
305                . = ALIGN (bsp_section_fast_end_align);
306
307                bsp_section_fast_end = .;
308        } > REGION_FAST AT > REGION_FAST_LOAD
309
310        bsp_section_fast_size = bsp_section_fast_end - bsp_section_fast_begin;
311
312        bsp_section_fast_load_begin = LOADADDR (.fast);
313
314        .bss : {
315                /*
316                 * BSP: Begin of bss section
317                 */
318                bsp_section_bss_begin = .;
319
320                *(COMMON)
321                *(.dynbss)
322                *(.bss .bss.* .gnu.linkonce.b.*)
323
324                . = ALIGN (bsp_section_bss_end_align);
325
326                /*
327                 * BSP: End of bss section
328                 */
329                bsp_section_bss_end = .;
330        } > REGION_BSS AT > REGION_BSS
331
332        bsp_section_bss_size = bsp_section_bss_end - bsp_section_bss_begin;
333
334        .work : {
335                /*
336                 * BSP: Begin of work section.  The work section will occupy
337                 * the remaining REGION_WORK region and contains the RTEMS work
338                 * space and heap.
339                 */
340                bsp_section_work_begin = .;
341
342                . += ORIGIN (REGION_WORK) + LENGTH (REGION_WORK) - ABSOLUTE (.);
343
344                /*
345                 * BSP: End of work section
346                 */
347                bsp_section_work_end = .;
348        } > REGION_WORK AT > REGION_WORK
349
350        bsp_section_work_size = bsp_section_work_end - bsp_section_work_begin;
351
352        .stack : {
353                /*
354                 * BSP: Begin of stack section.  The stack section will occupy
355                 * the remaining REGION_STACK region and may contain the task
356                 * stacks.  Depending on the region distribution this section
357                 * may be of zero size.
358                 */
359                bsp_section_stack_begin = .;
360
361                . += ORIGIN (REGION_STACK) + LENGTH (REGION_STACK) - ABSOLUTE (.);
362
363                /*
364                 * BSP: End of stack section
365                 */
366                bsp_section_stack_end = .;
367        } > REGION_STACK AT > REGION_STACK
368
369        bsp_section_stack_size = bsp_section_stack_end - bsp_section_stack_begin;
370
371        /*
372         * BSP: External symbols (FIXME)
373         */
374        RamBase = ORIGIN (REGION_WORK);
375        RamSize = LENGTH (REGION_WORK);
376        WorkAreaBase = bsp_section_work_begin;
377        HeapSize = 0;
378       
379        /* Stabs debugging sections.  */
380        .stab          0 : { *(.stab) }
381        .stabstr       0 : { *(.stabstr) }
382        .stab.excl     0 : { *(.stab.excl) }
383        .stab.exclstr  0 : { *(.stab.exclstr) }
384        .stab.index    0 : { *(.stab.index) }
385        .stab.indexstr 0 : { *(.stab.indexstr) }
386        .comment       0 : { *(.comment) }
387        /* DWARF debug sections.
388           Symbols in the DWARF debugging sections are relative to the beginning
389           of the section so we begin them at 0.  */
390        /* DWARF 1 */
391        .debug          0 : { *(.debug) }
392        .line           0 : { *(.line) }
393        /* GNU DWARF 1 extensions */
394        .debug_srcinfo  0 : { *(.debug_srcinfo) }
395        .debug_sfnames  0 : { *(.debug_sfnames) }
396        /* DWARF 1.1 and DWARF 2 */
397        .debug_aranges  0 : { *(.debug_aranges) }
398        .debug_pubnames 0 : { *(.debug_pubnames) }
399        /* DWARF 2 */
400        .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
401        .debug_abbrev   0 : { *(.debug_abbrev) }
402        .debug_line     0 : { *(.debug_line) }
403        .debug_frame    0 : { *(.debug_frame) }
404        .debug_str      0 : { *(.debug_str) }
405        .debug_loc      0 : { *(.debug_loc) }
406        .debug_macinfo  0 : { *(.debug_macinfo) }
407        /* SGI/MIPS DWARF 2 extensions */
408        .debug_weaknames 0 : { *(.debug_weaknames) }
409        .debug_funcnames 0 : { *(.debug_funcnames) }
410        .debug_typenames 0 : { *(.debug_typenames) }
411        .debug_varnames  0 : { *(.debug_varnames) }
412        /* DWARF 3 */
413        .debug_pubtypes 0 : { *(.debug_pubtypes) }
414        .debug_ranges   0 : { *(.debug_ranges) }
415        .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
416
417        /DISCARD/ : {
418                *(.note.GNU-stack) *(.gnu_debuglink)
419        }
420
421        /*
422         * BSP: Catch all unknown sections
423         */
424        .nirvana : {
425                *(*)
426        } > NIRVANA
427}
Note: See TracBrowser for help on using the repository browser.