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