]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/newlib-tumbl.git/blob - libgloss/rx/rx.ld
* rx/rx.ld: Add W_* sections to .rodata.
[fpga/lx-cpu1/newlib-tumbl.git] / libgloss / rx / rx.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 corresponds to the smallest predicted RX600 chip.  */
41 MEMORY {
42         RAM (w)   : ORIGIN = 0x00000000, LENGTH = 0x00020000 /* 128k */
43         STACK (w) : ORIGIN = 0x00020000, LENGTH = 16 /* top of RAM */
44
45         ROM (w)   : ORIGIN = 0xfff40000, LENGTH = 0x000bffd0 /* 768k */
46 /* This is the largest RX6000: */
47 /*      ROM (w)   : ORIGIN = 0xffe00000, LENGTH = 0x001fffd0 */ /* 2Mb */
48 }
49
50 SECTIONS
51 {
52   .text           :
53   {
54     PROVIDE (_start = .);
55     *(.text P .stub .text.* .gnu.linkonce.t.*)
56     KEEP (*(.text.*personality*))
57     /* .gnu.warning sections are handled specially by elf32.em.  */
58     *(.gnu.warning)
59     *(.interp .hash .dynsym .dynstr .gnu.version*)
60     PROVIDE (__etext = .);
61     PROVIDE (_etext = .);
62     PROVIDE (etext = .);
63     . = ALIGN(4);
64     KEEP (*(.init))
65     KEEP (*(.fini))
66   } > ROM
67
68   .rodata : {
69     . = ALIGN(4);
70     *(.plt)
71     *(.rodata C C_2 C_1 W W_2 W_1 .rodata.* .gnu.linkonce.r.*)
72     *(.rodata1)
73     *(.eh_frame_hdr)
74     KEEP (*(.eh_frame))
75     KEEP (*(.gcc_except_table)) *(.gcc_except_table.*)
76     . = ALIGN(4);
77     PROVIDE(__romdatastart = .);
78   } > ROM
79
80   .data : {
81     . = ALIGN(4);
82     PROVIDE (__datastart = .); /* IF_ROROM */
83     PROVIDE (__preinit_array_start = .);
84     KEEP (*(.preinit_array))
85     PROVIDE (__preinit_array_end = .);
86     PROVIDE (__init_array_start = .);
87     KEEP (*(SORT(.init_array.*)))
88     KEEP (*(.init_array))
89     PROVIDE (__init_array_end = .);
90     PROVIDE (__fini_array_start = .);
91     KEEP (*(.fini_array))
92     KEEP (*(SORT(.fini_array.*)))
93     PROVIDE (__fini_array_end = .);
94     LONG(0); /* Sentinel.  */
95
96     /* gcc uses crtbegin.o to find the start of the constructors, so
97        we make sure it is first.  Because this is a wildcard, it
98        doesn't matter if the user does not actually link against
99        crtbegin.o; the linker won't look for a file to match a
100        wildcard.  The wildcard also means that it doesn't matter which
101        directory crtbegin.o is in.  */
102     KEEP (*crtbegin*.o(.ctors))
103
104     /* We don't want to include the .ctor section from from the
105        crtend.o file until after the sorted ctors.  The .ctor section
106        from the crtend file contains the end of ctors marker and it
107        must be last */
108     KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
109     KEEP (*(SORT(.ctors.*)))
110     KEEP (*(.ctors))
111
112     KEEP (*crtbegin*.o(.dtors))
113     KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
114     KEEP (*(SORT(.dtors.*)))
115     KEEP (*(.dtors))
116
117     KEEP (*(.jcr))
118     *(.data.rel.ro.local) *(.data.rel.ro*)
119     *(.dynamic)
120
121     *(.data D .data.* .gnu.linkonce.d.*)
122     KEEP (*(.gnu.linkonce.d.*personality*))
123     SORT(CONSTRUCTORS)
124     *(.data1)
125     *(.got.plt) *(.got)
126
127     /* We want the small data sections together, so single-instruction offsets
128        can access them all, and initialized data all before uninitialized, so
129        we can shorten the on-disk segment size.  */
130     . = ALIGN(4);
131     *(.sdata .sdata.* .gnu.linkonce.s.* D_2 D_1)
132
133     . = ALIGN(4);
134     _edata = .;
135     PROVIDE (edata = .);
136     PROVIDE (__dataend = .);
137   } > RAM AT> ROM
138
139   /* Note that __romdatacopysize may be ZERO for the simulator, which
140      knows how to intialize RAM directly.  It should ONLY be used for
141      copying data from ROM to RAM; if you need to know the size of the
142      data section, subtract the end symbol from the start symbol.  */
143   /* Note that crt0 assumes this is a multiple of four; all the
144      start/stop symbols are also assumed long-aligned.  */
145   PROVIDE (__romdatacopysize = SIZEOF(.data));
146
147   .bss : {
148     . = ALIGN(4);
149     PROVIDE (__bssstart = .);
150     *(.dynbss)
151     *(.sbss .sbss.*)
152     *(.bss B B_2 B_1 .bss.* .gnu.linkonce.b.*)
153     . = ALIGN(4);
154     *(COMMON)
155     . = ALIGN(4);
156     PROVIDE (__bssend = .);
157     _end = .;
158     PROVIDE (end = .);
159   } > RAM
160   PROVIDE (__bsssize = SIZEOF(.bss) / 4);
161
162   .stack (ORIGIN (STACK)) :
163   {
164     PROVIDE (__stack = .);
165     *(.stack)
166   }
167
168   /* Providing one of these symbols in your code is sufficient to have
169      it linked in to the fixed vector table.  */
170
171   PROVIDE (__rx_priviledged_exception_handler = 0x00000000);
172   PROVIDE (__rx_access_exception_handler = 0x00000000);
173   PROVIDE (__rx_undefined_exception_handler = 0x00000000);
174   PROVIDE (__rx_floating_exception_handler = 0x00000000);
175   PROVIDE (__rx_nonmaskable_exception_handler = 0x00000000);
176
177   .vectors (0xFFFFFFD0) :
178   {
179     PROVIDE (__vectors = .);
180     LONG (__rx_priviledged_exception_handler);
181     LONG (__rx_access_exception_handler);
182     LONG (0);
183     LONG (__rx_undefined_exception_handler);
184     LONG (0);
185     LONG (__rx_floating_exception_handler);
186     LONG (0);
187     LONG (0);
188     LONG (0);
189     LONG (0);
190     LONG (__rx_nonmaskable_exception_handler);
191     LONG (_start);
192   }
193
194   /* The rest are all not normally part of the runtime image.  */
195
196   /* Stabs debugging sections.  */
197   .stab          0 : { *(.stab) }
198   .stabstr       0 : { *(.stabstr) }
199   .stab.excl     0 : { *(.stab.excl) }
200   .stab.exclstr  0 : { *(.stab.exclstr) }
201   .stab.index    0 : { *(.stab.index) }
202   .stab.indexstr 0 : { *(.stab.indexstr) }
203   .comment       0 : { *(.comment) }
204   /* DWARF debug sections.
205      Symbols in the DWARF debugging sections are relative to the beginning
206      of the section so we begin them at 0.  */
207   /* DWARF 1 */
208   .debug          0 : { *(.debug) }
209   .line           0 : { *(.line) }
210   /* GNU DWARF 1 extensions */
211   .debug_srcinfo  0 : { *(.debug_srcinfo) }
212   .debug_sfnames  0 : { *(.debug_sfnames) }
213   /* DWARF 1.1 and DWARF 2 */
214   .debug_aranges  0 : { *(.debug_aranges) }
215   .debug_pubnames 0 : { *(.debug_pubnames) }
216   /* DWARF 2 */
217   .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
218   .debug_abbrev   0 : { *(.debug_abbrev) }
219   .debug_line     0 : { *(.debug_line) }
220   .debug_frame    0 : { *(.debug_frame) }
221   .debug_str      0 : { *(.debug_str) }
222   .debug_loc      0 : { *(.debug_loc) }
223   .debug_macinfo  0 : { *(.debug_macinfo) }
224   /* SGI/MIPS DWARF 2 extensions */
225   .debug_weaknames 0 : { *(.debug_weaknames) }
226   .debug_funcnames 0 : { *(.debug_funcnames) }
227   .debug_typenames 0 : { *(.debug_typenames) }
228   .debug_varnames  0 : { *(.debug_varnames) }
229   /DISCARD/ : { *(.note.GNU-stack) }
230 }