source: rtems/c/src/lib/libbsp/sh/gensh4/startup/linkcmds.rom2ram @ b618d8c

5
Last change on this file since b618d8c was b618d8c, checked in by Sebastian Huber <sebastian.huber@…>, on 09/16/15 at 05:13:58

Add RTEMS linker sets

Update #2408.

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