source: trunk/libs/newlib/src/libgloss/rx/rx.ld @ 684

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

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

File size: 8.6 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 corresponds to the smallest predicted RX600 chip.  */
41MEMORY {
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
50SECTIONS
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  /* The __stack_size value of 0x100 is just a guess, but since it is
163     PROVIDEd the user can override it on the command line.  It has to be
164     set here, rather than inside the .stack section, as symbols defined
165     inside sections are only evaluated during the final phase of the link,
166     long after the ASSERT is checked.  An ASSERT referencing a PROVIDED but
167     not yet evaluated symbol will automatically fail.
168
169     FIXME: It would be nice if this value could be automatically set via
170     gcc's -fstack-usage command line option somehow.  */
171  PROVIDE (__stack_size = 0x100);
172
173  .stack (ORIGIN (STACK)) :
174  {
175    PROVIDE (__stack = .);
176    *(.stack)
177
178    /* Linker section checking ignores empty sections like
179       this one so we have to have our own test here.  */
180    ASSERT ((__stack > (_end + __stack_size)),
181            "Error: Too much data - no room left for the stack");
182  }
183
184  /* Providing one of these symbols in your code is sufficient to have
185     it linked in to the fixed vector table.  */
186
187  PROVIDE (__rx_priviledged_exception_handler = 0x00000000);
188  PROVIDE (__rx_access_exception_handler = 0x00000000);
189  PROVIDE (__rx_undefined_exception_handler = 0x00000000);
190  PROVIDE (__rx_floating_exception_handler = 0x00000000);
191  PROVIDE (__rx_nonmaskable_exception_handler = 0x00000000);
192
193  .vectors (0xFFFFFFD0) :
194  {
195    PROVIDE (__vectors = .);
196    LONG (__rx_priviledged_exception_handler);
197    LONG (__rx_access_exception_handler);
198    LONG (0);
199    LONG (__rx_undefined_exception_handler);
200    LONG (0);
201    LONG (__rx_floating_exception_handler);
202    LONG (0);
203    LONG (0);
204    LONG (0);
205    LONG (0);
206    LONG (__rx_nonmaskable_exception_handler);
207    LONG (_start);
208  }
209
210  /* The rest are all not normally part of the runtime image.  */
211  .note : { *(.note) }
212
213  /* Stabs debugging sections.  */
214  .stab          0 : { *(.stab) }
215  .stabstr       0 : { *(.stabstr) }
216  .stab.excl     0 : { *(.stab.excl) }
217  .stab.exclstr  0 : { *(.stab.exclstr) }
218  .stab.index    0 : { *(.stab.index) }
219  .stab.indexstr 0 : { *(.stab.indexstr) }
220  .comment       0 : { *(.comment) }
221  /* DWARF debug sections.
222     Symbols in the DWARF debugging sections are relative to the beginning
223     of the section so we begin them at 0.  */
224  /* DWARF 1 */
225  .debug          0 : { *(.debug) }
226  .line           0 : { *(.line) }
227  /* GNU DWARF 1 extensions */
228  .debug_srcinfo  0 : { *(.debug_srcinfo) }
229  .debug_sfnames  0 : { *(.debug_sfnames) }
230  /* DWARF 1.1 and DWARF 2 */
231  .debug_aranges  0 : { *(.debug_aranges) }
232  .debug_pubnames 0 : { *(.debug_pubnames) }
233  /* DWARF 2 */
234  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
235  .debug_abbrev   0 : { *(.debug_abbrev) }
236  .debug_line     0 : { *(.debug_line .debug_line.* .debug_line_end ) }
237  .debug_frame    0 : { *(.debug_frame) }
238  .debug_str      0 : { *(.debug_str) }
239  .debug_loc      0 : { *(.debug_loc) }
240  .debug_macinfo  0 : { *(.debug_macinfo) }
241  /* SGI/MIPS DWARF 2 extensions */
242  .debug_weaknames 0 : { *(.debug_weaknames) }
243  .debug_funcnames 0 : { *(.debug_funcnames) }
244  .debug_typenames 0 : { *(.debug_typenames) }
245  .debug_varnames  0 : { *(.debug_varnames) }
246  /* DWARF 3 */
247  .debug_pubtypes 0 : { *(.debug_pubtypes) }
248  .debug_ranges   0 : { *(.debug_ranges) }
249  /* DWARF Extension.  */
250  .debug_macro    0 : { *(.debug_macro) }
251  /DISCARD/ : { *(.note.GNU-stack) }
252}
Note: See TracBrowser for help on using the repository browser.