source: trunk/libs/newlib/src/libgloss/rx/rx-sim.ld @ 506

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

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

File size: 8.3 KB
Line 
1/*
2
3Copyright (c) 2005,2008,2009 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(rx)
35ENTRY(_start)
36
37/* Do we need any of these for elf?
38   __DYNAMIC = 0;    */
39
40/* This memory layout is larger than the largest predicted RX600 chip,
41   but gives us more memory for benchmarks.    */
42
43MEMORY {
44        RAM (w)   : ORIGIN = 0x01000000, LENGTH = 0x07000000 /* 112 Mb "external" address space.  */
45        STACK (w) : ORIGIN = 0x08000000, LENGTH = 16         /* Top of RAM.  */
46}
47
48SECTIONS
49{
50  .text           :
51  {
52    PROVIDE (_start = .);
53    *(.text P .stub .text.* .gnu.linkonce.t.*)
54    KEEP (*(.text.*personality*))
55    /* .gnu.warning sections are handled specially by elf32.em.  */
56    *(.gnu.warning)
57    *(.interp .hash .dynsym .dynstr .gnu.version*)
58    PROVIDE (__etext = .);
59    PROVIDE (_etext = .);
60    PROVIDE (etext = .);
61    . = ALIGN(4);
62    KEEP (*(.init))
63    KEEP (*(.fini))
64  } > RAM
65
66  .rodata : {
67    . = ALIGN(4);
68    *(.plt)
69    *(.rodata C C_2 C_1 W W_2 W_1 .rodata.* .gnu.linkonce.r.*)
70    *(.rodata1)
71    *(.eh_frame_hdr)
72    KEEP (*(.eh_frame))
73    KEEP (*(.gcc_except_table)) *(.gcc_except_table.*)
74    . = ALIGN(4);
75    PROVIDE(__romdatastart = .);
76  } > RAM
77
78  .data : {
79    . = ALIGN(4);
80    PROVIDE (__datastart = .);
81    PROVIDE (__preinit_array_start = .);
82    KEEP (*(.preinit_array))
83    PROVIDE (__preinit_array_end = .);
84    PROVIDE (__init_array_start = .);
85    KEEP (*(SORT(.init_array.*)))
86    KEEP (*(.init_array))
87    PROVIDE (__init_array_end = .);
88    PROVIDE (__fini_array_start = .);
89    KEEP (*(.fini_array))
90    KEEP (*(SORT(.fini_array.*)))
91    PROVIDE (__fini_array_end = .);
92    LONG(0); /* Sentinel.  */
93
94    /* gcc uses crtbegin.o to find the start of the constructors, so
95       we make sure it is first.  Because this is a wildcard, it
96       doesn't matter if the user does not actually link against
97       crtbegin.o; the linker won't look for a file to match a
98       wildcard.  The wildcard also means that it doesn't matter which
99       directory crtbegin.o is in.  */
100    KEEP (*crtbegin*.o(.ctors))
101
102    /* We don't want to include the .ctor section from from the
103       crtend.o file until after the sorted ctors.  The .ctor section
104       from the crtend file contains the end of ctors marker and it
105       must be last */
106    KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
107    KEEP (*(SORT(.ctors.*)))
108    KEEP (*(.ctors))
109
110    KEEP (*crtbegin*.o(.dtors))
111    KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
112    KEEP (*(SORT(.dtors.*)))
113    KEEP (*(.dtors))
114
115    KEEP (*(.jcr))
116    *(.data.rel.ro.local) *(.data.rel.ro*)
117    *(.dynamic)
118
119    *(.data D .data.* .gnu.linkonce.d.*)
120    KEEP (*(.gnu.linkonce.d.*personality*))
121    SORT(CONSTRUCTORS)
122    *(.data1)
123    *(.got.plt) *(.got)
124
125    /* We want the small data sections together, so single-instruction offsets
126       can access them all, and initialized data all before uninitialized, so
127       we can shorten the on-disk segment size.  */
128    . = ALIGN(4);
129    *(.sdata .sdata.* .gnu.linkonce.s.* D_2 D_1)
130
131    . = ALIGN(4);
132    _edata = .;
133    PROVIDE (edata = .);
134    PROVIDE (__dataend = .);
135  } > RAM
136
137  /* Note that crt0 assumes this is a multiple of four; all the
138     start/stop symbols are also assumed long-aligned.  */
139  /* PROVIDE (__romdatacopysize = __dataend - __datastart); */
140  /* We're loading into simulator ram, no need to copy */
141  PROVIDE (__romdatacopysize = 0);
142
143  .bss : {
144    . = ALIGN(4);
145    PROVIDE (__bssstart = .);
146    *(.dynbss)
147    *(.sbss .sbss.*)
148    *(.bss B B_2 B_1 .bss.* .gnu.linkonce.b.*)
149    . = ALIGN(4);
150    *(COMMON)
151    . = ALIGN(4);
152    PROVIDE (__bssend = .);
153    _end = .;
154    PROVIDE (end = .);
155  } > RAM
156  PROVIDE (__bsssize = SIZEOF(.bss) / 4);
157
158  /* The __stack_size value of 0x100 is just a guess, but since it is
159     PROVIDEd the user can override it on the command line.  It has to be
160     set here, rather than inside the .stack section, as symbols defined
161     inside sections are only evaluated during the final phase of the link,
162     long after the ASSERT is checked.  An ASSERT referencing a PROVIDED but
163     not yet evaluated symbol will automatically fail.
164
165     FIXME: It would be nice if this value could be automatically set via
166     gcc's -fstack-usage command line option somehow.  */
167  PROVIDE (__stack_size = 0x100);
168
169  .stack (ORIGIN (STACK)) :
170  {
171    PROVIDE (__stack = .);
172    *(.stack)
173
174    /* Linker section checking ignores empty sections like
175       this one so we have to have our own test here.  */
176    ASSERT ((__stack > (_end + __stack_size)),
177            "Error: Too much data - no room left for the stack");
178  } > STACK
179
180  /* Providing one of these symbols in your code is sufficient to have
181     it linked in to the fixed vector table.  */
182
183  PROVIDE (__rx_priviledged_exception_handler = 0x00000000);
184  PROVIDE (__rx_access_exception_handler = 0x00000000);
185  PROVIDE (__rx_undefined_exception_handler = 0x00000000);
186  PROVIDE (__rx_floating_exception_handler = 0x00000000);
187  PROVIDE (__rx_nonmaskable_exception_handler = 0x00000000);
188
189  .vectors (0xFFFFFFD0) :
190  {
191    PROVIDE (__vectors = .);
192    LONG (__rx_priviledged_exception_handler);
193    LONG (__rx_access_exception_handler);
194    LONG (0);
195    LONG (__rx_undefined_exception_handler);
196    LONG (0);
197    LONG (__rx_floating_exception_handler);
198    LONG (0);
199    LONG (0);
200    LONG (0);
201    LONG (0);
202    LONG (__rx_nonmaskable_exception_handler);
203    LONG (_start);
204  }
205
206  /* The rest are all not normally part of the runtime image.  */
207  .note : { *(.note) }
208
209  /* Stabs debugging sections.  */
210  .stab          0 : { *(.stab) }
211  .stabstr       0 : { *(.stabstr) }
212  .stab.excl     0 : { *(.stab.excl) }
213  .stab.exclstr  0 : { *(.stab.exclstr) }
214  .stab.index    0 : { *(.stab.index) }
215  .stab.indexstr 0 : { *(.stab.indexstr) }
216  .comment       0 : { *(.comment) }
217  /* DWARF debug sections.
218     Symbols in the DWARF debugging sections are relative to the beginning
219     of the section so we begin them at 0.  */
220  /* DWARF 1 */
221  .debug          0 : { *(.debug) }
222  .line           0 : { *(.line) }
223  /* GNU DWARF 1 extensions */
224  .debug_srcinfo  0 : { *(.debug_srcinfo) }
225  .debug_sfnames  0 : { *(.debug_sfnames) }
226  /* DWARF 1.1 and DWARF 2 */
227  .debug_aranges  0 : { *(.debug_aranges) }
228  .debug_pubnames 0 : { *(.debug_pubnames) }
229  /* DWARF 2 */
230  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
231  .debug_abbrev   0 : { *(.debug_abbrev) }
232  .debug_line     0 : { *(.debug_line .debug_line.* .debug_line_end ) }
233  .debug_frame    0 : { *(.debug_frame) }
234  .debug_str      0 : { *(.debug_str) }
235  .debug_loc      0 : { *(.debug_loc) }
236  .debug_macinfo  0 : { *(.debug_macinfo) }
237  /* SGI/MIPS DWARF 2 extensions */
238  .debug_weaknames 0 : { *(.debug_weaknames) }
239  .debug_funcnames 0 : { *(.debug_funcnames) }
240  .debug_typenames 0 : { *(.debug_typenames) }
241  .debug_varnames  0 : { *(.debug_varnames) }
242  /* DWARF 3 */
243  .debug_pubtypes 0 : { *(.debug_pubtypes) }
244  .debug_ranges   0 : { *(.debug_ranges) }
245  /* DWARF Extension.  */
246  .debug_macro    0 : { *(.debug_macro) }
247  /DISCARD/ : { *(.note.GNU-stack) }
248}
Note: See TracBrowser for help on using the repository browser.