]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/newlib-tumbl.git/blob - libgloss/rx/rx-sim.ld
e029e046968aba3544070d4b43b2a7e3cb11eea7
[fpga/lx-cpu1/newlib-tumbl.git] / libgloss / rx / rx-sim.ld
1 /*
2
3 Copyright (c) 2005,2008,2009 Red Hat Incorporated.
4 All rights reserved.
5
6 Redistribution and use in source and binary forms, with or without 
7 modification, 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
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
21 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
22 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 DISCLAIMED.  IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
24 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 
27 ON 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
29 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
30
31 */
32
33 /* Default linker script, for normal executables */
34 OUTPUT_ARCH(rx)
35 ENTRY(_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
43 MEMORY {
44         RAM (w)   : ORIGIN = 0x01000000, LENGTH = 0x07000000 /* 112 Mb "external" address space.  */
45         STACK (w) : ORIGIN = 0x08000000, LENGTH = 16         /* Top of RAM.  */
46 }
47
48 SECTIONS
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 .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   .stack (ORIGIN (STACK)) :
159   {
160     PROVIDE (__stack = .);
161     *(.stack)
162   } > STACK
163
164   /* Providing one of these symbols in your code is sufficient to have
165      it linked in to the fixed vector table.  */
166
167   PROVIDE (__rx_priviledged_exception_handler = 0x00000000);
168   PROVIDE (__rx_access_exception_handler = 0x00000000);
169   PROVIDE (__rx_undefined_exception_handler = 0x00000000);
170   PROVIDE (__rx_floating_exception_handler = 0x00000000);
171   PROVIDE (__rx_nonmaskable_exception_handler = 0x00000000);
172
173   .vectors (0xFFFFFFD0) :
174   {
175     PROVIDE (__vectors = .);
176     LONG (__rx_priviledged_exception_handler);
177     LONG (__rx_access_exception_handler);
178     LONG (0);
179     LONG (__rx_undefined_exception_handler);
180     LONG (0);
181     LONG (__rx_floating_exception_handler);
182     LONG (0);
183     LONG (0);
184     LONG (0);
185     LONG (0);
186     LONG (__rx_nonmaskable_exception_handler);
187     LONG (_start);
188   }
189
190   /* The rest are all not normally part of the runtime image.  */
191
192   /* Stabs debugging sections.  */
193   .stab          0 : { *(.stab) }
194   .stabstr       0 : { *(.stabstr) }
195   .stab.excl     0 : { *(.stab.excl) }
196   .stab.exclstr  0 : { *(.stab.exclstr) }
197   .stab.index    0 : { *(.stab.index) }
198   .stab.indexstr 0 : { *(.stab.indexstr) }
199   .comment       0 : { *(.comment) }
200   /* DWARF debug sections.
201      Symbols in the DWARF debugging sections are relative to the beginning
202      of the section so we begin them at 0.  */
203   /* DWARF 1 */
204   .debug          0 : { *(.debug) }
205   .line           0 : { *(.line) }
206   /* GNU DWARF 1 extensions */
207   .debug_srcinfo  0 : { *(.debug_srcinfo) }
208   .debug_sfnames  0 : { *(.debug_sfnames) }
209   /* DWARF 1.1 and DWARF 2 */
210   .debug_aranges  0 : { *(.debug_aranges) }
211   .debug_pubnames 0 : { *(.debug_pubnames) }
212   /* DWARF 2 */
213   .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
214   .debug_abbrev   0 : { *(.debug_abbrev) }
215   .debug_line     0 : { *(.debug_line) }
216   .debug_frame    0 : { *(.debug_frame) }
217   .debug_str      0 : { *(.debug_str) }
218   .debug_loc      0 : { *(.debug_loc) }
219   .debug_macinfo  0 : { *(.debug_macinfo) }
220   /* SGI/MIPS DWARF 2 extensions */
221   .debug_weaknames 0 : { *(.debug_weaknames) }
222   .debug_funcnames 0 : { *(.debug_funcnames) }
223   .debug_typenames 0 : { *(.debug_typenames) }
224   .debug_varnames  0 : { *(.debug_varnames) }
225   /DISCARD/ : { *(.note.GNU-stack) }
226 }