source: rtems/bsps/m68k/shared/start/linkcmds.base @ b82a4b4

5
Last change on this file since b82a4b4 was 511dc4b, checked in by Sebastian Huber <sebastian.huber@…>, on 06/19/18 at 07:09:51

Rework initialization and interrupt stack support

Statically initialize the interrupt stack area
(_Configuration_Interrupt_stack_area_begin,
_Configuration_Interrupt_stack_area_end, and
_Configuration_Interrupt_stack_size) via <rtems/confdefs.h>. Place the
interrupt stack area in a special section ".rtemsstack.interrupt". Let
BSPs define the optimal placement of this section in their linker
command files (e.g. in a fast on-chip memory).

This change makes makes the CPU_HAS_SOFTWARE_INTERRUPT_STACK and
CPU_HAS_HARDWARE_INTERRUPT_STACK CPU port defines superfluous, since the
low level initialization code has all information available via global
symbols.

This change makes the CPU_ALLOCATE_INTERRUPT_STACK CPU port define
superfluous, since the interrupt stacks are allocated by confdefs.h for
all architectures. There is no need for BSP-specific linker command
file magic (except the section placement), see previous ARM linker
command file as a bad example.

Remove _CPU_Install_interrupt_stack(). Initialize the hardware
interrupt stack in _CPU_Initialize() if necessary (e.g.
m68k_install_interrupt_stack()).

The optional _CPU_Interrupt_stack_setup() is still useful to customize
the registration of the interrupt stack area in the per-CPU information.

The initialization stack can reuse the interrupt stack, since

  • interrupts are disabled during the sequential system initialization, and
  • the boot_card() function does not return.

This stack resuse saves memory.

Changes per architecture:

arm:

  • Mostly replace the linker symbol based configuration of stacks with the standard <rtems/confdefs.h> configuration via CONFIGURE_INTERRUPT_STACK_SIZE. The size of the FIQ, ABT and UND mode stack is still defined via linker symbols. These modes are rarely used in applications and the default values provided by the BSP should be sufficient in most cases.
  • Remove the bsp_processor_count linker symbol hack used for the SMP support. This is possible since the interrupt stack area is now allocated by the linker and not allocated from the heap. This makes some configure.ac stuff obsolete. Remove the now superfluous BSP variants altcycv_devkit_smp and realview_pbx_a9_qemu_smp.

bfin:

  • Remove unused magic linker command file allocation of initialization stack. Maybe a previous linker command file copy and paste problem? In the start.S the initialization stack is set to a hard coded value.

lm32, m32c, mips, nios2, riscv, sh, v850:

  • Remove magic linker command file allocation of initialization stack. Reuse interrupt stack for initialization stack.

m68k:

  • Remove magic linker command file allocation of initialization stack. Reuse interrupt stack for initialization stack.

powerpc:

  • Remove magic linker command file allocation of initialization stack. Reuse interrupt stack for initialization stack.
  • Used dedicated memory region (REGION_RTEMSSTACK) for the interrupt stack on BSPs using the shared linkcmds.base (replacement for REGION_RWEXTRA).

sparc:

  • Remove the hard coded initialization stack. Use the interrupt stack for the initialization stack on the boot processor. This saves 16KiB of RAM.

Update #3459.

  • Property mode set to 100644
File size: 10.4 KB
Line 
1/*
2 * Copyright (c) 2008, 2018 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Dornierstr. 4
6 *  82178 Puchheim
7 *  Germany
8 *  <rtems@embedded-brains.de>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.org/license/LICENSE.
13 */
14
15OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k")
16
17OUTPUT_ARCH(m68k)
18
19ENTRY(start)
20STARTUP(start.o)
21
22MEMORY {
23        UNEXPECTED_SECTIONS : ORIGIN = 0xffffffff, LENGTH = 0
24}
25
26SECTIONS {
27        .vector0 : ALIGN_WITH_INPUT {
28                bsp_vector0_begin = .;
29                KEEP (*(.vectors*))
30                bsp_vector0_end = .;
31        } > REGION_TEXT AT > REGION_TEXT
32        bsp_vector0_size = bsp_vector0_end - bsp_vector0_begin;
33
34        .text : ALIGN_WITH_INPUT {
35                *(.text.unlikely .text.*_unlikely)
36                *(.text .stub .text.* .gnu.linkonce.t.*)
37                /* .gnu.warning sections are handled specially by elf32.em.  */
38                *(.gnu.warning)
39        } > REGION_TEXT AT > REGION_TEXT_LOAD
40        .init : ALIGN_WITH_INPUT {
41                KEEP (*(.init))
42        } > REGION_TEXT AT > REGION_TEXT_LOAD
43        .fini : ALIGN_WITH_INPUT {
44                KEEP (*(.fini))
45        } > REGION_TEXT AT > REGION_TEXT_LOAD
46        .rodata : ALIGN_WITH_INPUT {
47                *(.rodata .rodata.* .gnu.linkonce.r.*)
48        } > REGION_TEXT AT > REGION_TEXT_LOAD
49        .rodata1 : ALIGN_WITH_INPUT {
50                *(.rodata1)
51        } > REGION_TEXT AT > REGION_TEXT_LOAD
52        .eh_frame : ALIGN_WITH_INPUT {
53                KEEP (*(.eh_frame))
54        } > REGION_TEXT AT > REGION_TEXT_LOAD
55        .gcc_except_table : ALIGN_WITH_INPUT {
56                *(.gcc_except_table .gcc_except_table.*)
57        } > REGION_TEXT AT > REGION_TEXT_LOAD
58        .tdata : ALIGN_WITH_INPUT {
59                _TLS_Data_begin = .;
60                *(.tdata .tdata.* .gnu.linkonce.td.*)
61                _TLS_Data_end = .;
62        } > REGION_TEXT AT > REGION_TEXT_LOAD
63        .tbss : ALIGN_WITH_INPUT {
64                _TLS_BSS_begin = .;
65                *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
66                _TLS_BSS_end = .;
67        } > REGION_TEXT AT > REGION_TEXT_LOAD
68        _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
69        _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
70        _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
71        _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
72        _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
73        _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
74        .preinit_array : ALIGN_WITH_INPUT {
75                PROVIDE_HIDDEN (__preinit_array_start = .);
76                KEEP (*(.preinit_array))
77                PROVIDE_HIDDEN (__preinit_array_end = .);
78        } > REGION_TEXT AT > REGION_TEXT_LOAD
79        .init_array : ALIGN_WITH_INPUT {
80                PROVIDE_HIDDEN (__init_array_start = .);
81                KEEP (*(SORT(.init_array.*)))
82                KEEP (*(.init_array))
83                PROVIDE_HIDDEN (__init_array_end = .);
84        } > REGION_TEXT AT > REGION_TEXT_LOAD
85        .fini_array : ALIGN_WITH_INPUT {
86                PROVIDE_HIDDEN (__fini_array_start = .);
87                KEEP (*(.fini_array))
88                KEEP (*(SORT(.fini_array.*)))
89                PROVIDE_HIDDEN (__fini_array_end = .);
90        } > REGION_TEXT AT > REGION_TEXT_LOAD
91        .ctors : ALIGN_WITH_INPUT {
92                /* gcc uses crtbegin.o to find the start of
93                   the constructors, so we make sure it is
94                   first.  Because this is a wildcard, it
95                   doesn't matter if the user does not
96                   actually link against crtbegin.o; the
97                   linker won't look for a file to match a
98                   wildcard.  The wildcard also means that it
99                   doesn't matter which directory crtbegin.o
100                   is in.  */
101                KEEP (*crtbegin.o(.ctors))
102                KEEP (*crtbegin?.o(.ctors))
103                /* We don't want to include the .ctor section from
104                   the crtend.o file until after the sorted ctors.
105                   The .ctor section from the crtend file contains the
106                   end of ctors marker and it must be last */
107                KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
108                KEEP (*(SORT(.ctors.*)))
109                KEEP (*(.ctors))
110        } > REGION_TEXT AT > REGION_TEXT_LOAD
111        .dtors : ALIGN_WITH_INPUT {
112                KEEP (*crtbegin.o(.dtors))
113                KEEP (*crtbegin?.o(.dtors))
114                KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
115                KEEP (*(SORT(.dtors.*)))
116                KEEP (*(.dtors))
117        } > REGION_TEXT AT > REGION_TEXT_LOAD
118        .data.rel.ro : ALIGN_WITH_INPUT {
119                *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*)
120                *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*)
121        } > REGION_TEXT AT > REGION_TEXT_LOAD
122        .jcr : ALIGN_WITH_INPUT {
123                KEEP (*(.jcr))
124        } > REGION_TEXT AT > REGION_TEXT_LOAD
125        .interp : ALIGN_WITH_INPUT {
126                *(.interp)
127        } > REGION_TEXT AT > REGION_TEXT_LOAD
128        .note.gnu.build-id : ALIGN_WITH_INPUT {
129                *(.note.gnu.build-id)
130        } > REGION_TEXT AT > REGION_TEXT_LOAD
131        .hash : ALIGN_WITH_INPUT {
132                *(.hash)
133        } > REGION_TEXT AT > REGION_TEXT_LOAD
134        .gnu.hash : ALIGN_WITH_INPUT {
135                *(.gnu.hash)
136        } > REGION_TEXT AT > REGION_TEXT_LOAD
137        .dynsym : ALIGN_WITH_INPUT {
138                *(.dynsym)
139        } > REGION_TEXT AT > REGION_TEXT_LOAD
140        .dynstr : ALIGN_WITH_INPUT {
141                *(.dynstr)
142        } > REGION_TEXT AT > REGION_TEXT_LOAD
143        .gnu.version : ALIGN_WITH_INPUT {
144                *(.gnu.version)
145        } > REGION_TEXT AT > REGION_TEXT_LOAD
146        .gnu.version_d : ALIGN_WITH_INPUT {
147                *(.gnu.version_d)
148        } > REGION_TEXT AT > REGION_TEXT_LOAD
149        .gnu.version_r : ALIGN_WITH_INPUT {
150                *(.gnu.version_r)
151        } > REGION_TEXT AT > REGION_TEXT_LOAD
152        .rel.dyn : ALIGN_WITH_INPUT {
153                *(.rel.init)
154                *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
155                *(.rel.fini)
156                *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
157                *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
158                *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
159                *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
160                *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
161                *(.rel.ctors)
162                *(.rel.dtors)
163                *(.rel.got)
164                *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
165                PROVIDE_HIDDEN (__rel_iplt_start = .);
166                *(.rel.iplt)
167                PROVIDE_HIDDEN (__rel_iplt_end = .);
168                PROVIDE_HIDDEN (__rela_iplt_start = .);
169                PROVIDE_HIDDEN (__rela_iplt_end = .);
170        } > REGION_TEXT AT > REGION_TEXT_LOAD
171        .rela.dyn : ALIGN_WITH_INPUT {
172                *(.rela.init)
173                *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
174                *(.rela.fini)
175                *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
176                *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
177                *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
178                *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
179                *(.rela.ctors)
180                *(.rela.dtors)
181                *(.rela.got)
182                *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
183                *(.rela.rtemsroset*)
184                *(.rela.rtemsrwset*)
185                PROVIDE_HIDDEN (__rel_iplt_start = .);
186                PROVIDE_HIDDEN (__rel_iplt_end = .);
187                PROVIDE_HIDDEN (__rela_iplt_start = .);
188                *(.rela.iplt)
189                PROVIDE_HIDDEN (__rela_iplt_end = .);
190        } > REGION_TEXT AT > REGION_TEXT_LOAD
191        .rel.plt : ALIGN_WITH_INPUT {
192                *(.rel.plt)
193        } > REGION_TEXT AT > REGION_TEXT_LOAD
194        .rela.plt : ALIGN_WITH_INPUT {
195                *(.rela.plt)
196        } > REGION_TEXT AT > REGION_TEXT_LOAD
197        .plt : ALIGN_WITH_INPUT {
198                *(.plt)
199        } > REGION_TEXT AT > REGION_TEXT_LOAD
200        .iplt : ALIGN_WITH_INPUT {
201                *(.iplt)
202        } > REGION_TEXT AT > REGION_TEXT_LOAD
203        .dynamic : ALIGN_WITH_INPUT {
204                *(.dynamic)
205        } > REGION_TEXT AT > REGION_TEXT_LOAD
206        .got : ALIGN_WITH_INPUT {
207                *(.got.plt) *(.igot.plt) *(.got) *(.igot)
208        } > REGION_TEXT AT > REGION_TEXT_LOAD
209        .rtemsroset : ALIGN_WITH_INPUT {
210                /* Special FreeBSD linker set sections */
211                __start_set_sysctl_set = .;
212                *(set_sysctl_*);
213                __stop_set_sysctl_set = .;
214                *(set_domain_*);
215                *(set_pseudo_*);
216
217                KEEP (*(SORT(.rtemsroset.*)))
218        } > REGION_TEXT AT > REGION_TEXT_LOAD
219
220        .vector1 : ALIGN_WITH_INPUT {
221                bsp_vector1_begin = .;
222                . = . + (ORIGIN (REGION_TEXT) == ORIGIN (REGION_DATA) ? 0 : bsp_vector0_size);
223                bsp_vector1_end = .;
224        } > REGION_DATA AT > REGION_DATA
225        bsp_vector1_size = bsp_vector1_end - bsp_vector1_begin;
226
227        .data : ALIGN_WITH_INPUT {
228                bsp_section_data_begin = .;
229                *(.data .data.* .gnu.linkonce.d.*)
230                SORT(CONSTRUCTORS)
231        } > REGION_DATA AT > REGION_DATA_LOAD
232        .data1 : ALIGN_WITH_INPUT {
233                *(.data1)
234        } > REGION_DATA AT > REGION_DATA_LOAD
235        .rtemsrwset : ALIGN_WITH_INPUT {
236                KEEP (*(SORT(.rtemsrwset.*)))
237                bsp_section_data_end = .;
238        } > REGION_DATA AT > REGION_DATA_LOAD
239        bsp_section_data_size = bsp_section_data_end - bsp_section_data_begin;
240        bsp_section_data_load_begin = LOADADDR (.data);
241        bsp_section_data_load_end = bsp_section_data_load_begin + bsp_section_data_size;
242
243        .bss : ALIGN_WITH_INPUT {
244                bsp_section_bss_begin = .;
245                *(.dynbss)
246                *(.bss .bss.* .gnu.linkonce.b.*)
247                *(COMMON)
248                bsp_section_bss_end = .;
249        } > REGION_DATA AT > REGION_DATA
250        bsp_section_bss_size = bsp_section_bss_end - bsp_section_bss_begin;
251
252        .rtemsstack (NOLOAD) : ALIGN_WITH_INPUT {
253                *(SORT(.rtemsstack.*))
254        } > REGION_DATA AT > REGION_DATA
255
256        .work : ALIGN_WITH_INPUT {
257                /*
258                 * The work section will occupy the remaining REGION_DATA region and
259                 * contains the RTEMS work space and heap.
260                 */
261                bsp_section_work_begin = .;
262                . += ORIGIN (REGION_DATA) + LENGTH (REGION_DATA) - ABSOLUTE (.);
263                bsp_section_work_end = .;
264        } > REGION_DATA AT > REGION_DATA
265        bsp_section_work_size = bsp_section_work_end - bsp_section_work_begin;
266
267        /* FIXME */
268        RamBase = ORIGIN (REGION_DATA);
269        RamSize = LENGTH (REGION_DATA);
270        WorkAreaBase = bsp_section_work_begin;
271        HeapSize = 0;
272
273        /* Stabs debugging sections.  */
274        .stab          0 : { *(.stab) }
275        .stabstr       0 : { *(.stabstr) }
276        .stab.excl     0 : { *(.stab.excl) }
277        .stab.exclstr  0 : { *(.stab.exclstr) }
278        .stab.index    0 : { *(.stab.index) }
279        .stab.indexstr 0 : { *(.stab.indexstr) }
280        .comment       0 : { *(.comment) }
281        /* DWARF debug sections.
282           Symbols in the DWARF debugging sections are relative to the beginning
283           of the section so we begin them at 0.  */
284        /* DWARF 1 */
285        .debug          0 : { *(.debug) }
286        .line           0 : { *(.line) }
287        /* GNU DWARF 1 extensions */
288        .debug_srcinfo  0 : { *(.debug_srcinfo) }
289        .debug_sfnames  0 : { *(.debug_sfnames) }
290        /* DWARF 1.1 and DWARF 2 */
291        .debug_aranges  0 : { *(.debug_aranges) }
292        .debug_pubnames 0 : { *(.debug_pubnames) }
293        /* DWARF 2 */
294        .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
295        .debug_abbrev   0 : { *(.debug_abbrev) }
296        .debug_line     0 : { *(.debug_line) }
297        .debug_frame    0 : { *(.debug_frame) }
298        .debug_str      0 : { *(.debug_str) }
299        .debug_loc      0 : { *(.debug_loc) }
300        .debug_macinfo  0 : { *(.debug_macinfo) }
301        /* SGI/MIPS DWARF 2 extensions */
302        .debug_weaknames 0 : { *(.debug_weaknames) }
303        .debug_funcnames 0 : { *(.debug_funcnames) }
304        .debug_typenames 0 : { *(.debug_typenames) }
305        .debug_varnames  0 : { *(.debug_varnames) }
306        /* DWARF 3 */
307        .debug_pubtypes 0 : { *(.debug_pubtypes) }
308        .debug_ranges   0 : { *(.debug_ranges) }
309        /* DWARF extension */
310        .debug_macro    0 : { *(.debug_macro) }
311        /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
312
313        /*
314         * This is a RTEMS specific section to catch all unexpected input
315         * sections.  In case you get an error like
316         *   "section `.unexpected_sections' will not fit in region
317         *   `UNEXPECTED_SECTIONS'"
318         * you have to figure out the offending input section and add it to the
319         * appropriate output section definition above.
320         */
321        .unexpected_sections : { *(*) } > UNEXPECTED_SECTIONS
322}
Note: See TracBrowser for help on using the repository browser.