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

5
Last change on this file since ffa1153 was ffa1153, checked in by Sebastian Huber <sebastian.huber@…>, on 12/14/19 at 20:36:09

bsps: Add RamEnd? to linker command files

Update #3838.

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