source: rtems/c/src/lib/libbsp/m32c/m32cbsp/startup/linkcmds @ 78c9fe8

5
Last change on this file since 78c9fe8 was 44d18b9, checked in by Sebastian Huber <sebastian.huber@…>, on 12/09/15 at 13:03:09

bsps: Fix some linker set descriptions

Fix broken RTEMS linker set descriptions introduced by
b618d8cfc54f84d4ed03dc7b7fa510c872e6128a.

  • Property mode set to 100644
File size: 6.6 KB
Line 
1/*
2 * Declare some sizes.
3 */
4_RamBase = DEFINED(_RamBase) ? _RamBase : 0x200000;
5_RamSize = DEFINED(_RamSize) ? _RamSize : 0x800000;
6_HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x0;
7_StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000;
8
9
10/* Default linker script, for normal executables */
11OUTPUT_FORMAT("elf32-m32c", "elf32-m32c",
12              "elf32-m32c")
13OUTPUT_ARCH(m32c)
14ENTRY(_start)
15/* Do we need any of these for elf?
16   __DYNAMIC = 0;    */
17MEMORY {
18        RAM (w) : ORIGIN = 0x200000, LENGTH = 0x800000
19        VEC (r) : ORIGIN = 0xffffdc, LENGTH = 32
20        RESETVEC (r) : ORIGIN = 0xfffffc, LENGTH = 4
21}
22SECTIONS
23{
24  /* There are three cases we care about: First, RW data that must be
25     in the low 64k.  This will always be copied from ROM.  Second, RO
26     data that must be in the low 64k.  This may be copied from ROM if
27     the ROM is above 64k.  Third, anything that does not need to be
28     in the first 64k.  Chips normally only have two memory regions;
29     low ram and either high or low rom.  We map the low rom needs
30     into one of the actual regions.  */
31
32  /* .text goes first so the rom image of ram data will follow it.  */
33  .text           :
34  {
35    *(.text .stub .text.* .gnu.linkonce.t.*)
36    KEEP (*(.text.*personality*))
37    /* .gnu.warning sections are handled specially by elf32.em.  */
38    *(.gnu.warning)
39    *(.interp .hash .dynsym .dynstr .gnu.version*)
40    PROVIDE (__etext = .);
41    PROVIDE (_etext = .);
42    PROVIDE (etext = .);
43    . = ALIGN(2);
44  } > RAM =0
45
46  /* rodata will either be part of data, or will be in low rom.  So we
47     might be spanning it, or we might not.  This lets us include it
48     in our calculations when appropriate.  */
49
50  .rodata : {
51    . = ALIGN(2);
52    *(.plt)
53    KEEP (*(.init))
54    KEEP (*(.fini))
55    *(.rodata .rodata.* .gnu.linkonce.r.*)
56    KEEP (*(SORT(.rtemsroset.*)))
57    *(.rodata1)
58    *(.eh_frame_hdr)
59    KEEP (*(.eh_frame))
60    KEEP (*(.gcc_except_table)) *(.gcc_except_table.*)
61    . = ALIGN(2);
62    PROVIDE(__romdatastart = .); /* IF_ROROM */
63  } > RAM
64
65  .tdata : {
66    __TLS_Data_begin = .;
67    *(.tdata .tdata.* .gnu.linkonce.td.*)
68    __TLS_Data_end = .;
69  } > RAM
70  .tbss : {
71    __TLS_BSS_begin = .;
72    *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
73    __TLS_BSS_end = .;
74  } > RAM
75  __TLS_Data_size = __TLS_Data_end - __TLS_Data_begin;
76  __TLS_Data_begin = __TLS_Data_size != 0 ? __TLS_Data_begin : __TLS_BSS_begin;
77  __TLS_Data_end = __TLS_Data_size != 0 ? __TLS_Data_end : __TLS_BSS_begin;
78  __TLS_BSS_size = __TLS_BSS_end - __TLS_BSS_begin;
79  __TLS_Size = __TLS_BSS_end - __TLS_Data_begin;
80  __TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
81
82  .data : {
83    . = ALIGN(32 / 8);
84    PROVIDE (__datastart = .); /* IF_ROROM */
85    PROVIDE (__preinit_array_start = .);
86    KEEP (*(.preinit_array))
87    PROVIDE (__preinit_array_end = .);
88    PROVIDE (__init_array_start = .);
89    KEEP (*(.init_array))
90    PROVIDE (__init_array_end = .);
91    PROVIDE (__fini_array_start = .);
92    KEEP (*(.fini_array))
93    PROVIDE (__fini_array_end = .);
94
95    /* gcc uses crtbegin.o to find the start of
96       the constructors, so we make sure it is
97       first.  Because this is a wildcard, it
98       doesn't matter if the user does not
99       actually link against crtbegin.o; the
100       linker won't look for a file to match a
101       wildcard.  The wildcard also means that it
102       doesn't matter which directory crtbegin.o
103       is in.  */
104    KEEP (*crtbegin*.o(.ctors))
105    /* We don't want to include the .ctor section from
106       from the crtend.o file until after the sorted ctors.
107       The .ctor section from the crtend file contains the
108       end of ctors marker and it must be last */
109    KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
110    KEEP (*(SORT(.ctors.*)))
111    KEEP (*(.ctors))
112
113    KEEP (*crtbegin*.o(.dtors))
114    KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
115    KEEP (*(SORT(.dtors.*)))
116    KEEP (*(.dtors))
117
118    KEEP (*(.jcr))
119    *(.data.rel.ro.local) *(.data.rel.ro*)
120    *(.dynamic)
121
122    *(.data .data.* .gnu.linkonce.d.*)
123    KEEP (*(SORT(.rtemsrwset.*)))
124    KEEP (*(.gnu.linkonce.d.*personality*))
125    SORT(CONSTRUCTORS)
126    *(.data1)
127    *(.got.plt) *(.got)
128
129    . = ALIGN(2);
130    _edata = .;
131    PROVIDE (edata = .);
132    PROVIDE (__dataend = .);
133  } > RAM
134
135  /* Note that __romdatacopysize may be ZERO for the simulator, which
136     knows how to intialize RAM directly.  It should ONLY be used for
137     copying data from ROM to RAM; if you need to know the size of the
138     data section, subtract the end symbol from the start symbol.  */
139  /* Note that crt0 assumes this is even; all the start/stop symbols
140     are also assumed word-aligned.  */
141  PROVIDE (__romdatacopysize = 0);
142
143  .bss : {
144    . = ALIGN(2);
145    PROVIDE (__bssstart = .);
146    *(.dynbss)
147    *(.bss .bss.* .gnu.linkonce.b.*)
148    *(COMMON)
149    . = ALIGN(2);
150    PROVIDE (__bssend = .);
151    _end = .;
152    PROVIDE (end = .);
153  } > RAM
154  PROVIDE (__bsssize = 0);
155  . = ALIGN(16);
156
157  . += _StackSize;
158  PROVIDE (__stack = .);
159  PROVIDE (_WorkAreaBase = .);
160  . = 0xa00000;
161  PROVIDE (_WorkAreaEnd = .);
162  PROVIDE (_WorkAreaSize = _WorkAreaEnd - _WorkAreaBase);
163
164/*
165  .stack (0x200000 + 0x800000 - 2) :
166  {
167    PROVIDE (__stack = .);
168    *(.stack)
169  }
170*/
171
172  .vec : {
173    *(.vec)
174  } > VEC
175  .resetvec : {
176    *(.resetvec)
177  } > RESETVEC
178
179  /* The rest are all not normally part of the runtime image.  */
180
181  /* Stabs debugging sections.  */
182  .stab          0 : { *(.stab) }
183  .stabstr       0 : { *(.stabstr) }
184  .stab.excl     0 : { *(.stab.excl) }
185  .stab.exclstr  0 : { *(.stab.exclstr) }
186  .stab.index    0 : { *(.stab.index) }
187  .stab.indexstr 0 : { *(.stab.indexstr) }
188  .comment       0 : { *(.comment) }
189  /* DWARF debug sections.
190     Symbols in the DWARF debugging sections are relative to the beginning
191     of the section so we begin them at 0.  */
192  /* DWARF 1 */
193  .debug          0 : { *(.debug) }
194  .line           0 : { *(.line) }
195  /* GNU DWARF 1 extensions */
196  .debug_srcinfo  0 : { *(.debug_srcinfo) }
197  .debug_sfnames  0 : { *(.debug_sfnames) }
198  /* DWARF 1.1 and DWARF 2 */
199  .debug_aranges  0 : { *(.debug_aranges) }
200  .debug_pubnames 0 : { *(.debug_pubnames) }
201  /* DWARF 2 */
202  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
203  .debug_abbrev   0 : { *(.debug_abbrev) }
204  .debug_line     0 : { *(.debug_line) }
205  .debug_frame    0 : { *(.debug_frame) }
206  .debug_str      0 : { *(.debug_str) }
207  .debug_loc      0 : { *(.debug_loc) }
208  .debug_macinfo  0 : { *(.debug_macinfo) }
209  /* SGI/MIPS DWARF 2 extensions */
210  .debug_weaknames 0 : { *(.debug_weaknames) }
211  .debug_funcnames 0 : { *(.debug_funcnames) }
212  .debug_typenames 0 : { *(.debug_typenames) }
213  .debug_varnames  0 : { *(.debug_varnames) }
214  /DISCARD/ : { *(.note.GNU-stack) }
215}
Note: See TracBrowser for help on using the repository browser.