source: rtems/bsps/sh/gensh4/start/linkcmds.rom2ram @ 715d616

5
Last change on this file since 715d616 was 715d616, checked in by Sebastian Huber <sebastian.huber@…>, on 06/19/18 at 13:10:36

bsps: Support .rtemsstack.* linker input sections

Use a dedicated memory region or place it between the BSS and workspace.

Update #3459.

  • Property mode set to 100644
File size: 7.0 KB
Line 
1/*
2 * This file contains GNU linker directives for an general SH4
3 * board.
4 *
5 * Variations in memory size and allocation can be made by
6 * overriding some values with linker command-line arguments.
7 *
8 * Copyright (C) 2000 OKTET Ltd., St.-Petersburg, Russia
9 * Author: Victor V. Vengerov <vvv@oktet.ru>
10 *
11 * The license and distribution terms for this file may be
12 * found in the file LICENSE in this distribution or at
13 *
14 * http://www.rtems.org/license/LICENSE.
15 */
16
17
18OUTPUT_FORMAT("elf32-shl", "elf32-shl",
19              "elf32-shl")
20OUTPUT_ARCH(sh)
21ENTRY(_start)
22STARTUP(start.o)
23
24/* Do we need any of these for elf?
25   __DYNAMIC = 0;    */
26
27_RamBase = DEFINED(_RamBase) ? _RamBase : 0x88000000;
28_RamSize = DEFINED(_RamSize) ? _RamSize : 8M;
29_HeapSize = DEFINED(_HeapSize) ? _HeapSize : (2 * 1024 * 1024);
30
31/*
32 * Area assignments:
33 *     Area 0: Flash memory, SRAM interface
34 *     Area 1: GDC
35 *     Area 2: SDRAM
36 *     Area 3-6: unused
37 */
38MEMORY
39{
40/*
41 * Real values
42 */
43  ram           : o = 0x88000000, l = 8M
44  rom           : o = 0x80000000, l = 4M
45/*
46 * Fake values to test from gdb
47 */
48/*
49  ram           : o = 0x88100000, l = 4M
50  rom           : o = 0x88500000, l = 3M
51*/
52}
53
54SECTIONS
55{
56  rom : {
57    copy_start_in_rom = .;
58  } >rom
59
60  /* Read-only sections, merged into text segment: */
61  .init          :
62  {
63    KEEP (*(.init))
64  } =0
65  .text      : AT(copy_start_in_rom)
66  {
67    copy_start = .;
68    *(.text*)
69
70    /*
71     * Special FreeBSD sysctl sections.
72     */
73    . = ALIGN (16);
74    ___start_set_sysctl_set = .;
75    *(set_sysc*);   /* set_sysctl_* but name is truncated by SH-coff */
76    ___stop_set_sysctl_set = ABSOLUTE(.);
77    *(set_doma*);   /* set_domain_* but name is truncated by SH-coff */
78    *(set_pseudo_*);
79
80    /* .gnu.warning sections are handled specially by elf32.em.  */
81    *(.gnu.warning)
82    *(.gnu.linkonce.t*)
83  } > ram
84  _etext = .;
85  PROVIDE (etext = .);
86  .fini      :
87  {
88    KEEP (*(.fini))
89  } =0
90  .rodata   :  AT(LOADADDR(.text) + SIZEOF(.text))
91  {
92    *(.rodata)
93    *(.rodata.*)
94    KEEP (*(SORT(.rtemsroset.*)))
95    *(.gnu.linkonce.r*)
96    . = ALIGN(32);
97  } > ram
98  .tdata : {
99    __TLS_Data_begin = .;
100    *(.tdata .tdata.* .gnu.linkonce.td.*)
101    __TLS_Data_end = .;
102  } > ram
103  .tbss : {
104    __TLS_BSS_begin = .;
105    *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
106    __TLS_BSS_end = .;
107  } > ram
108  __TLS_Data_size = __TLS_Data_end - __TLS_Data_begin;
109  __TLS_Data_begin = __TLS_Data_size != 0 ? __TLS_Data_begin : __TLS_BSS_begin;
110  __TLS_Data_end = __TLS_Data_size != 0 ? __TLS_Data_end : __TLS_BSS_begin;
111  __TLS_BSS_size = __TLS_BSS_end - __TLS_BSS_begin;
112  __TLS_Size = __TLS_BSS_end - __TLS_Data_begin;
113  __TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
114  .ctors   :  AT(LOADADDR(.rodata) + SIZEOF(.rodata))
115  {
116    ___ctors = .;
117    /* gcc uses crtbegin.o to find the start of
118       the constructors, so we make sure it is
119       first.  Because this is a wildcard, it
120       doesn't matter if the user does not
121       actually link against crtbegin.o; the
122       linker won't look for a file to match a
123       wildcard.  The wildcard also means that it
124       doesn't matter which directory crtbegin.o
125       is in.  */
126    KEEP (*crtbegin.o(.ctors))
127    /* We don't want to include the .ctor section from
128       from the crtend.o file until after the sorted ctors.
129       The .ctor section from the crtend file contains the
130       end of ctors marker and it must be last */
131    KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
132    KEEP (*(SORT(.ctors.*)))
133    KEEP (*(.ctors))
134    ___ctors_end = .;
135  } > ram
136   .dtors         : AT(LOADADDR(.ctors) + SIZEOF(.ctors))
137  {
138    ___dtors = .;
139    KEEP (*crtbegin.o(.dtors))
140    KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
141    KEEP (*(SORT(.dtors.*)))
142    KEEP (*(.dtors))
143    ___dtors_end = .;
144  } > ram
145
146  /* Adjust the address for the data segment.  We want to adjust up to
147     the same address within the page on the next page up.  */
148  . = ALIGN(128) + (. & (128 - 1));
149  .data     : AT(LOADADDR(.dtors) + SIZEOF(.dtors))
150  {
151    *(.data)
152    *(.data.*)
153    KEEP (*(SORT(.rtemsrwset.*)))
154    *(.gnu.linkonce.d*)
155    SORT(CONSTRUCTORS)
156    copy_end = .;
157  } > ram
158  .eh_frame : { *(.eh_frame) } > ram
159  /* We want the small data sections together, so single-instruction offsets
160     can access them all, and initialized data all before uninitialized, so
161     we can shorten the on-disk segment size.  */
162  .bss       :
163  {
164   __bss_start = .;
165   *(.dynbss)
166   *(.bss .bss* .gnu.linkonce.b*)
167   *(COMMON)
168   /* Align here to ensure that the .bss section occupies space up to
169      _end.  Align after .bss to ensure correct alignment even if the
170      .bss section disappears because there are no input sections.  */
171   . = ALIGN(32 / 8);
172   __bss_end = .;
173  } > ram
174
175  .rela.dyn       :
176    {
177      *(.rela.init)
178      *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
179      *(.rela.fini)
180      *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
181      *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
182      *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
183      *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
184      *(.rela.ctors)
185      *(.rela.dtors)
186      *(.rela.got)
187      *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
188      *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
189      *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
190      *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
191      *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
192    } >ram
193
194  .rtemsstack (NOLOAD) : {
195    *(SORT(.rtemsstack.*))
196  } > ram
197
198  _WorkAreaBase = . ;
199
200  . = ALIGN(16);
201  .stack . : {
202     stack_start = .;
203     . = . + 4096;
204     stack_end = .;
205  }
206
207  . = ALIGN(16);
208  _CPU_Interrupt_stack_low  = . ;
209  _CPU_Interrupt_stack_high = _CPU_Interrupt_stack_low + 4096 ;
210
211  /* Stabs debugging sections.  */
212  .stab 0 : { *(.stab) }
213  .stabstr 0 : { *(.stabstr) }
214  .stab.excl 0 : { *(.stab.excl) }
215  .stab.exclstr 0 : { *(.stab.exclstr) }
216  .stab.index 0 : { *(.stab.index) }
217  .stab.indexstr 0 : { *(.stab.indexstr) }
218  .comment 0 : { *(.comment) }
219  /* DWARF debug sections.
220     Symbols in the DWARF debugging sections are relative to the beginning
221     of the section so we begin them at 0.  */
222  /* DWARF 1 */
223  .debug          0 : { *(.debug) }
224  .line           0 : { *(.line) }
225  /* GNU DWARF 1 extensions */
226  .debug_srcinfo  0 : { *(.debug_srcinfo) }
227  .debug_sfnames  0 : { *(.debug_sfnames) }
228  /* DWARF 1.1 and DWARF 2 */
229  .debug_aranges  0 : { *(.debug_aranges) }
230  .debug_pubnames 0 : { *(.debug_pubnames) }
231  /* DWARF 2 */
232  .debug_info     0 : { *(.debug_info) }
233  .debug_abbrev   0 : { *(.debug_abbrev) }
234  .debug_line     0 : { *(.debug_line) }
235  .debug_frame    0 : { *(.debug_frame) }
236  .debug_str      0 : { *(.debug_str) }
237  .debug_loc      0 : { *(.debug_loc) }
238  .debug_macinfo  0 : { *(.debug_macinfo) }
239  /* SGI/MIPS DWARF 2 extensions */
240  .debug_weaknames 0 : { *(.debug_weaknames) }
241  .debug_funcnames 0 : { *(.debug_funcnames) }
242  .debug_typenames 0 : { *(.debug_typenames) }
243  .debug_varnames  0 : { *(.debug_varnames) }
244  .stack : { _stack = .; *(.stack) }
245  /* These must appear regardless of  .  */
246}
Note: See TracBrowser for help on using the repository browser.