3 Copyright (c) 2005,2008,2009 Red Hat Incorporated.
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
9 Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
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.
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.
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.
33 /* Default linker script, for normal executables */
37 /* Do we need any of these for elf?
40 /* This memory layout corresponds to the smallest predicted RX600 chip. */
42 RAM (w) : ORIGIN = 0x00000000, LENGTH = 0x00020000 /* 128k */
43 STACK (w) : ORIGIN = 0x00020000, LENGTH = 16 /* top of RAM */
45 ROM (w) : ORIGIN = 0xfff40000, LENGTH = 0x000bffd0 /* 768k */
46 /* This is the largest RX6000: */
47 /* ROM (w) : ORIGIN = 0xffe00000, LENGTH = 0x001fffd0 */ /* 2Mb */
55 *(.text P .stub .text.* .gnu.linkonce.t.*)
56 KEEP (*(.text.*personality*))
57 /* .gnu.warning sections are handled specially by elf32.em. */
59 *(.interp .hash .dynsym .dynstr .gnu.version*)
60 PROVIDE (__etext = .);
71 *(.rodata C C_2 C_1 W W_2 W_1 .rodata.* .gnu.linkonce.r.*)
75 KEEP (*(.gcc_except_table)) *(.gcc_except_table.*)
77 PROVIDE(__romdatastart = .);
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.*)))
89 PROVIDE (__init_array_end = .);
90 PROVIDE (__fini_array_start = .);
92 KEEP (*(SORT(.fini_array.*)))
93 PROVIDE (__fini_array_end = .);
94 LONG(0); /* Sentinel. */
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))
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
108 KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
109 KEEP (*(SORT(.ctors.*)))
112 KEEP (*crtbegin*.o(.dtors))
113 KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
114 KEEP (*(SORT(.dtors.*)))
118 *(.data.rel.ro.local) *(.data.rel.ro*)
121 *(.data D .data.* .gnu.linkonce.d.*)
122 KEEP (*(.gnu.linkonce.d.*personality*))
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. */
131 *(.sdata .sdata.* .gnu.linkonce.s.* D_2 D_1)
136 PROVIDE (__dataend = .);
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));
149 PROVIDE (__bssstart = .);
152 *(.bss B B_2 B_1 .bss.* .gnu.linkonce.b.*)
156 PROVIDE (__bssend = .);
160 PROVIDE (__bsssize = SIZEOF(.bss) / 4);
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.
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);
173 .stack (ORIGIN (STACK)) :
175 PROVIDE (__stack = .);
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");
184 /* Providing one of these symbols in your code is sufficient to have
185 it linked in to the fixed vector table. */
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);
193 .vectors (0xFFFFFFD0) :
195 PROVIDE (__vectors = .);
196 LONG (__rx_priviledged_exception_handler);
197 LONG (__rx_access_exception_handler);
199 LONG (__rx_undefined_exception_handler);
201 LONG (__rx_floating_exception_handler);
206 LONG (__rx_nonmaskable_exception_handler);
210 /* The rest are all not normally part of the runtime image. */
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. */
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) }
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) }
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) }