source: trunk/libs/newlib/src/libgloss/rl78/rl78-sim.ld @ 453

Last change on this file since 453 was 444, checked in by satin@…, 7 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 8.1 KB
RevLine 
[444]1/*
2
3Copyright (c) 2005,2008,2009,2011 Red Hat Incorporated.
4All rights reserved.
5
6Redistribution and use in source and binary forms, with or without
7modification, are permitted provided that the following conditions are met:
8
9    Redistributions of source code must retain the above copyright
10    notice, this list of conditions and the following disclaimer.
11
12    Redistributions in binary form must reproduce the above copyright
13    notice, this list of conditions and the following disclaimer in the
14    documentation and/or other materials provided with the distribution.
15
16    The name of Red Hat Incorporated may not be used to endorse
17    or promote products derived from this software without specific
18    prior written permission.
19
20THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23DISCLAIMED.  IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
24DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31*/
32
33/* Default linker script, for normal executables */
34OUTPUT_ARCH(rl78)
35ENTRY(_start)
36
37/* Do we need any of these for elf?
38   __DYNAMIC = 0;    */
39
40/* This is for the simulator - 512k flash, 32k ram, no data flash */
41MEMORY {
42        VEC (r)   : ORIGIN = 0x00000, LENGTH = 0x00002
43        IVEC (r)  : ORIGIN = 0x00004, LENGTH = 0x0007c
44        OPT (r)   : ORIGIN = 0x000c0, LENGTH = 0x00004
45        ROM (r)   : ORIGIN = 0x000d8, LENGTH = 0x7ff28
46/* The G10 variant needs to use RAM for virtual registers.  */
47        RAM (w)   : ORIGIN = 0xf8000, LENGTH = 0x07e20
48        STACK (w) : ORIGIN = 0xffe20, LENGTH = 0x00002
49        SADDR (w) : ORIGIN = 0xffe20, LENGTH = 0x000a0
50}
51
52SECTIONS
53{
54  .vec :
55  {
56    *(.vec)
57  } > VEC
58  .ivec :
59  {
60    *(.ivec)
61  } > IVEC
62  .opt :
63  {
64    *(.opt)
65  } > OPT
66
67  /* CubeSuite always starts at 0xd8.  */
68  .csstart : {
69    KEEP (*(.csstart))
70  } > ROM
71
72  /* For code that must be in the first 64k, or could fill unused
73     space below .rodata.  */
74  .lowtext : {
75    *(.plt)
76    *(.lowtext)
77  } > ROM
78
79  .data : {
80    . = ALIGN(2);
81    PROVIDE (__datastart = .);
82
83    KEEP (*(.jcr))
84    *(.data.rel.ro.local) *(.data.rel.ro*)
85    *(.dynamic)
86
87    *(.data D .data.* .gnu.linkonce.d.*)
88    KEEP (*(.gnu.linkonce.d.*personality*))
89    SORT(CONSTRUCTORS)
90    *(.data1)
91    *(.got.plt) *(.got)
92
93    /* We want the small data sections together, so single-instruction offsets
94       can access them all, and initialized data all before uninitialized, so
95       we can shorten the on-disk segment size.  */
96    . = ALIGN(2);
97    *(.sdata .sdata.* .gnu.linkonce.s.* D_2 D_1)
98
99    . = ALIGN(2);
100    _edata = .;
101    PROVIDE (edata = .);
102    PROVIDE (__dataend = .);
103  } > RAM AT> ROM
104
105  /* Note that crt0 assumes this is a multiple of two; all the
106     start/stop symbols are also assumed word-aligned.  */
107  PROVIDE(__romdatastart = LOADADDR(.data));
108  PROVIDE (__romdatacopysize = SIZEOF(.data));
109
110  .bss : {
111    . = ALIGN(2);
112    PROVIDE (__bssstart = .);
113    *(.dynbss)
114    *(.sbss .sbss.*)
115    *(.bss B B_2 B_1 .bss.* .gnu.linkonce.b.*)
116    . = ALIGN(2);
117    *(COMMON)
118    . = ALIGN(2);
119    PROVIDE (__bssend = .);
120    _end = .;
121    PROVIDE (end = .);
122  } > RAM
123  PROVIDE (__bsssize = SIZEOF(.bss));
124
125  /* The __stack_size value of 0x100 is just a guess, but since it is
126     PROVIDEd the user can override it on the command line.  It has to be
127     set here, rather than inside the .stack section, as symbols defined
128     inside sections are only evaluated during the final phase of the link,
129     long after the ASSERT is checked.  An ASSERT referencing a PROVIDED but
130     not yet evaluated symbol will automatically fail.
131
132     FIXME: It would be nice if this value could be automatically set via
133     gcc's -fstack-usage command line option somehow.  */
134  PROVIDE (__stack_size = 0x100);
135
136  .stack (ORIGIN (STACK)) :
137  {
138    PROVIDE (__stack = .);
139    *(.stack)
140
141    /* Linker section checking ignores empty sections like
142       this one so we have to have our own test here.  */
143    ASSERT ((__stack > (_end + __stack_size)),
144            "Error: Too much data - no room left for the stack");
145  }
146 
147  .saddr : {
148    . = ALIGN(2);
149    PROVIDE (__saddrstart = .);
150    *(.saddr)
151    . = ALIGN(2);
152  } >SADDR AT>ROM
153  PROVIDE(__romsaddrstart = LOADADDR(.saddr));
154  PROVIDE (__romsaddrcopysize = SIZEOF(.saddr));
155
156  .rodata (MAX(__romdatastart + __romdatacopysize, 0x1000)) : {
157    . = ALIGN(2);
158    *(.plt)
159    *(.rodata C C_2 C_1 .rodata.* .gnu.linkonce.r.*)
160    *(.rodata1)
161    *(.eh_frame_hdr)
162    KEEP (*(.eh_frame))
163    KEEP (*(.gcc_except_table)) *(.gcc_except_table.*)
164    PROVIDE (__preinit_array_start = .);
165    KEEP (*(.preinit_array))
166    PROVIDE (__preinit_array_end = .);
167    PROVIDE (__init_array_start = .);
168    KEEP (*(SORT(.init_array.*)))
169    KEEP (*(.init_array))
170    PROVIDE (__init_array_end = .);
171    PROVIDE (__fini_array_start = .);
172    KEEP (*(.fini_array))
173    KEEP (*(SORT(.fini_array.*)))
174    PROVIDE (__fini_array_end = .);
175    LONG(0); /* Sentinel.  */
176
177    /* gcc uses crtbegin.o to find the start of the constructors, so
178       we make sure it is first.  Because this is a wildcard, it
179       doesn't matter if the user does not actually link against
180       crtbegin.o; the linker won't look for a file to match a
181       wildcard.  The wildcard also means that it doesn't matter which
182       directory crtbegin.o is in.  */
183    KEEP (*crtbegin*.o(.ctors))
184
185    /* We don't want to include the .ctor section from from the
186       crtend.o file until after the sorted ctors.  The .ctor section
187       from the crtend file contains the end of ctors marker and it
188       must be last */
189    KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
190    KEEP (*(SORT(.ctors.*)))
191    KEEP (*(.ctors))
192
193    KEEP (*crtbegin*.o(.dtors))
194    KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
195    KEEP (*(SORT(.dtors.*)))
196    KEEP (*(.dtors))
197  } > ROM
198
199  .frodata : {
200    *(.frodata)
201  } > ROM
202
203  .text           :
204  {
205    PROVIDE (_start = .);
206    *(.text P .stub .text.* .gnu.linkonce.t.*)
207    KEEP (*(.text.*personality*))
208    /* .gnu.warning sections are handled specially by elf32.em.  */
209    *(.gnu.warning)
210    *(.interp .hash .dynsym .dynstr .gnu.version*)
211    PROVIDE (__etext = .);
212    PROVIDE (_etext = .);
213    PROVIDE (etext = .);
214    . = ALIGN(2);
215    KEEP (*(.init))
216    KEEP (*(.fini))
217  } > ROM
218
219  /* The rest are all not normally part of the runtime image.  */
220  PROVIDE (__rl78_abs__ = 0);
221
222  /* Stabs debugging sections.  */
223  .stab          0 : { *(.stab) }
224  .stabstr       0 : { *(.stabstr) }
225  .stab.excl     0 : { *(.stab.excl) }
226  .stab.exclstr  0 : { *(.stab.exclstr) }
227  .stab.index    0 : { *(.stab.index) }
228  .stab.indexstr 0 : { *(.stab.indexstr) }
229  .comment       0 : { *(.comment) }
230  /* DWARF debug sections.
231     Symbols in the DWARF debugging sections are relative to the beginning
232     of the section so we begin them at 0.  */
233  /* DWARF 1 */
234  .debug          0 : { *(.debug) }
235  .line           0 : { *(.line) }
236  /* GNU DWARF 1 extensions */
237  .debug_srcinfo  0 : { *(.debug_srcinfo) }
238  .debug_sfnames  0 : { *(.debug_sfnames) }
239  /* DWARF 1.1 and DWARF 2 */
240  .debug_aranges  0 : { *(.debug_aranges) }
241  .debug_pubnames 0 : { *(.debug_pubnames) }
242  /* DWARF 2 */
243  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
244  .debug_abbrev   0 : { *(.debug_abbrev) }
245  .debug_line     0 : { *(.debug_line .debug_line.* .debug_line_end ) }
246  .debug_frame    0 : { *(.debug_frame) }
247  .debug_str      0 : { *(.debug_str) }
248  .debug_loc      0 : { *(.debug_loc) }
249  .debug_macinfo  0 : { *(.debug_macinfo) }
250  /* SGI/MIPS DWARF 2 extensions */
251  .debug_weaknames 0 : { *(.debug_weaknames) }
252  .debug_funcnames 0 : { *(.debug_funcnames) }
253  .debug_typenames 0 : { *(.debug_typenames) }
254  .debug_varnames  0 : { *(.debug_varnames) }
255  /DISCARD/ : { *(.note.GNU-stack) }
256}
Note: See TracBrowser for help on using the repository browser.