1 |
786 |
skrzyp |
//===========================================================================
|
2 |
|
|
//
|
3 |
|
|
// MLT linker script for MIPS TX39
|
4 |
|
|
//
|
5 |
|
|
//===========================================================================
|
6 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
7 |
|
|
// -------------------------------------------
|
8 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
9 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
10 |
|
|
//
|
11 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
12 |
|
|
// the terms of the GNU General Public License as published by the Free
|
13 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
14 |
|
|
// version.
|
15 |
|
|
//
|
16 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
17 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
18 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
19 |
|
|
// for more details.
|
20 |
|
|
//
|
21 |
|
|
// You should have received a copy of the GNU General Public License
|
22 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
23 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
24 |
|
|
//
|
25 |
|
|
// As a special exception, if other files instantiate templates or use
|
26 |
|
|
// macros or inline functions from this file, or you compile this file
|
27 |
|
|
// and link it with other works to produce a work based on this file,
|
28 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
29 |
|
|
// the GNU General Public License. However the source code for this file
|
30 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
31 |
|
|
// General Public License v2.
|
32 |
|
|
//
|
33 |
|
|
// This exception does not invalidate any other reasons why a work based
|
34 |
|
|
// on this file might be covered by the GNU General Public License.
|
35 |
|
|
// -------------------------------------------
|
36 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
37 |
|
|
//===========================================================================
|
38 |
|
|
|
39 |
|
|
#include
|
40 |
|
|
|
41 |
|
|
OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips",
|
42 |
|
|
"elf32-littlemips")
|
43 |
|
|
/* The preprocessor defines mips, but we know we're mips :-) */
|
44 |
|
|
#undef mips
|
45 |
|
|
OUTPUT_ARCH(mips:3000)
|
46 |
|
|
|
47 |
|
|
STARTUP(vectors.o)
|
48 |
|
|
ENTRY(reset_vector)
|
49 |
|
|
#ifdef EXTRAS
|
50 |
|
|
INPUT(extras.o)
|
51 |
|
|
#endif
|
52 |
|
|
#if (__GNUC__ >= 3)
|
53 |
|
|
GROUP(libtarget.a libgcc.a libsupc++.a)
|
54 |
|
|
#else
|
55 |
|
|
GROUP(libtarget.a libgcc.a)
|
56 |
|
|
#endif
|
57 |
|
|
|
58 |
|
|
/* FIXME: The MLT should pass in the required alignment since it must be
|
59 |
|
|
* the same as the VMA's alignment. As a result of this bug, all the JMR3904
|
60 |
|
|
* ROM mlt files have alignment 8, when some should have alignment 4
|
61 |
|
|
* (902557-CR)
|
62 |
|
|
*/
|
63 |
|
|
#define ALIGN_LMA 8
|
64 |
|
|
#define FOLLOWING(_section_) AT ((LOADADDR (_section_) + SIZEOF (_section_) + ALIGN_LMA - 1) & ~ (ALIGN_LMA - 1))
|
65 |
|
|
#define LMA_EQ_VMA
|
66 |
|
|
#define FORCE_OUTPUT . = .
|
67 |
|
|
|
68 |
|
|
#define SECTIONS_BEGIN
|
69 |
|
|
|
70 |
|
|
#if defined(CYG_HAL_STARTUP_RAM)
|
71 |
|
|
|
72 |
|
|
/* this version for RAM startup */
|
73 |
|
|
#define SECTION_rom_vectors(_region_, _vma_, _lma_) \
|
74 |
|
|
.rom_vectors _vma_ : _lma_ \
|
75 |
|
|
{ KEEP (*(.utlb_vector)) \
|
76 |
|
|
. = ALIGN(0x80); KEEP(*(.other_vector)) \
|
77 |
|
|
/* debug and reset vector not used in RAM version */ \
|
78 |
|
|
KEEP(*(.debug_vector)) \
|
79 |
|
|
KEEP (*(.reset_vector)) } \
|
80 |
|
|
> _region_
|
81 |
|
|
|
82 |
|
|
#elif defined(CYG_HAL_STARTUP_ROM)
|
83 |
|
|
|
84 |
|
|
/* this version for ROM startup */
|
85 |
|
|
#define SECTION_rom_vectors(_region_, _vma_, _lma_) \
|
86 |
|
|
.rom_vectors _vma_ : _lma_ \
|
87 |
|
|
{ KEEP (*(.reset_vector)) \
|
88 |
|
|
. = ALIGN(0x100); KEEP (*(.utlb_vector)) \
|
89 |
|
|
. = ALIGN(0x80); KEEP(*(.other_vector)) \
|
90 |
|
|
. = ALIGN(0x100); KEEP(*(.debug_vector)) } \
|
91 |
|
|
> _region_
|
92 |
|
|
|
93 |
|
|
#endif /* ROM startup version of ROM vectors */
|
94 |
|
|
|
95 |
|
|
#define SECTION_ROMISC(_region_, _vma_, _lma_) \
|
96 |
|
|
.interp _vma_ : _lma_ { *(.interp) } > _region_ \
|
97 |
|
|
.hash : FOLLOWING(.interp) { *(.hash) } > _region_ \
|
98 |
|
|
.dynsym : FOLLOWING(.hash) { *(.dynsym) } > _region_ \
|
99 |
|
|
.dynstr : FOLLOWING(.dynsym) { *(.dynstr) } > _region_ \
|
100 |
|
|
.gnu.version : FOLLOWING(.dynstr) { *(.gnu.version) } > _region_ \
|
101 |
|
|
.gnu.version_d : FOLLOWING(.gnu.version) { *(.gnu.version_d) } > _region_ \
|
102 |
|
|
.gnu.version_r : FOLLOWING(.gnu.version_d) { *(.gnu.version_r) } > _region_ \
|
103 |
|
|
.plt : FOLLOWING(.gnu.version_r) { *(.plt) } > _region_
|
104 |
|
|
|
105 |
|
|
#define SECTION_RELOCS(_region_, _vma_, _lma_) \
|
106 |
|
|
.rel.text : \
|
107 |
|
|
{ \
|
108 |
|
|
*(.rel.text) \
|
109 |
|
|
*(.rel.text.*) \
|
110 |
|
|
*(.rel.gnu.linkonce.t*) \
|
111 |
|
|
} > _region_ \
|
112 |
|
|
.rela.text : \
|
113 |
|
|
{ \
|
114 |
|
|
*(.rela.text) \
|
115 |
|
|
*(.rela.text.*) \
|
116 |
|
|
*(.rela.gnu.linkonce.t*) \
|
117 |
|
|
} > _region_ \
|
118 |
|
|
.rel.data : \
|
119 |
|
|
{ \
|
120 |
|
|
*(.rel.data) \
|
121 |
|
|
*(.rel.data.*) \
|
122 |
|
|
*(.rel.gnu.linkonce.d*) \
|
123 |
|
|
} > _region_ \
|
124 |
|
|
.rela.data : \
|
125 |
|
|
{ \
|
126 |
|
|
*(.rela.data) \
|
127 |
|
|
*(.rela.data.*) \
|
128 |
|
|
*(.rela.gnu.linkonce.d*) \
|
129 |
|
|
} > _region_ \
|
130 |
|
|
.rel.rodata : \
|
131 |
|
|
{ \
|
132 |
|
|
*(.rel.rodata) \
|
133 |
|
|
*(.rel.rodata.*) \
|
134 |
|
|
*(.rel.gnu.linkonce.r*) \
|
135 |
|
|
} > _region_ \
|
136 |
|
|
.rela.rodata : \
|
137 |
|
|
{ \
|
138 |
|
|
*(.rela.rodata) \
|
139 |
|
|
*(.rela.rodata.*) \
|
140 |
|
|
*(.rela.gnu.linkonce.r*) \
|
141 |
|
|
} > _region_ \
|
142 |
|
|
.rel.got : { *(.rel.got) } > _region_ \
|
143 |
|
|
.rela.got : { *(.rela.got) } > _region_ \
|
144 |
|
|
.rel.ctors : { *(.rel.ctors) } > _region_ \
|
145 |
|
|
.rela.ctors : { *(.rela.ctors) } > _region_ \
|
146 |
|
|
.rel.dtors : { *(.rel.dtors) } > _region_ \
|
147 |
|
|
.rela.dtors : { *(.rela.dtors) } > _region_ \
|
148 |
|
|
.rel.init : { *(.rel.init) } > _region_ \
|
149 |
|
|
.rela.init : { *(.rela.init) } > _region_ \
|
150 |
|
|
.rel.fini : { *(.rel.fini) } > _region_ \
|
151 |
|
|
.rela.fini : { *(.rela.fini) } > _region_ \
|
152 |
|
|
.rel.bss : { *(.rel.bss) } > _region_ \
|
153 |
|
|
.rela.bss : { *(.rela.bss) } > _region_ \
|
154 |
|
|
.rel.plt : { *(.rel.plt) } > _region_ \
|
155 |
|
|
.rela.plt : { *(.rela.plt) } > _region_ \
|
156 |
|
|
.rel.dyn : { *(.rel.dyn) } > _region_
|
157 |
|
|
|
158 |
|
|
#define SECTION_init(_region_, _vma_, _lma_) \
|
159 |
|
|
.init _vma_ : _lma_ \
|
160 |
|
|
{ \
|
161 |
|
|
FORCE_OUTPUT; KEEP (*(.init)) \
|
162 |
|
|
} > _region_ =0
|
163 |
|
|
|
164 |
|
|
#define SECTION_text(_region_, _vma_, _lma_) \
|
165 |
|
|
.text _vma_ : _lma_ \
|
166 |
|
|
{ \
|
167 |
|
|
_stext = .; _ftext = . ; \
|
168 |
|
|
*(.text) \
|
169 |
|
|
*(.text.*) \
|
170 |
|
|
*(.stub) \
|
171 |
|
|
*(.gnu.warning) \
|
172 |
|
|
*(.gnu.linkonce.t*) \
|
173 |
|
|
*(.mips16.fn.*) *(.mips16.call.*) \
|
174 |
|
|
} > _region_ =0 \
|
175 |
|
|
_etext = .; PROVIDE (etext = .);
|
176 |
|
|
|
177 |
|
|
#define SECTION_fini(_region_, _vma_, _lma_) \
|
178 |
|
|
.fini _vma_ : _lma_ \
|
179 |
|
|
{ \
|
180 |
|
|
FORCE_OUTPUT; KEEP (*(.fini)) \
|
181 |
|
|
} > _region_ =0
|
182 |
|
|
|
183 |
|
|
#define SECTION_rodata(_region_, _vma_, _lma_) \
|
184 |
|
|
.rodata _vma_ : _lma_ \
|
185 |
|
|
{ \
|
186 |
|
|
FORCE_OUTPUT; *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) \
|
187 |
|
|
} > _region_
|
188 |
|
|
|
189 |
|
|
#define SECTION_rodata1(_region_, _vma_, _lma_) \
|
190 |
|
|
.rodata1 _vma_ : _lma_ \
|
191 |
|
|
{ \
|
192 |
|
|
FORCE_OUTPUT; *(.rodata1) *(.rodata1.*) \
|
193 |
|
|
} > _region_
|
194 |
|
|
|
195 |
|
|
#define SECTION_vsr_table(_region_, _vma_, _lma_) \
|
196 |
|
|
.vsr_table _vma_ : _lma_ \
|
197 |
|
|
{ \
|
198 |
|
|
FORCE_OUTPUT; *(.vsr_table) \
|
199 |
|
|
} > _region_
|
200 |
|
|
|
201 |
|
|
#define SECTION_data(_region_, _vma_, _lma_) \
|
202 |
|
|
.data _vma_ : _lma_ \
|
203 |
|
|
{ \
|
204 |
|
|
__ram_data_start = ABSOLUTE (.); _fdata = . ; \
|
205 |
|
|
*(.data) *(.data.*) *(.gnu.linkonce.d*) \
|
206 |
|
|
. = ALIGN (8); \
|
207 |
|
|
SORT(CONSTRUCTORS) \
|
208 |
|
|
} > _region_ \
|
209 |
|
|
__rom_data_start = LOADADDR(.data);
|
210 |
|
|
|
211 |
|
|
#define SECTION_data1(_region_, _vma_, _lma_) \
|
212 |
|
|
.data1 _vma_ : _lma_ \
|
213 |
|
|
{ \
|
214 |
|
|
FORCE_OUTPUT; *(.data1) *(.data1.*) \
|
215 |
|
|
} > _region_
|
216 |
|
|
|
217 |
|
|
#define SECTION_eh_frame(_region_, _vma_, _lma_) \
|
218 |
|
|
.eh_frame _vma_ : _lma_ \
|
219 |
|
|
{ \
|
220 |
|
|
FORCE_OUTPUT; *(.eh_frame) \
|
221 |
|
|
} > _region_
|
222 |
|
|
|
223 |
|
|
#define SECTION_gcc_except_table(_region_, _vma_, _lma_) \
|
224 |
|
|
.gcc_except_table _vma_ : _lma_ \
|
225 |
|
|
{ \
|
226 |
|
|
FORCE_OUTPUT; *(.gcc_except_table) \
|
227 |
|
|
} > _region_
|
228 |
|
|
|
229 |
|
|
|
230 |
|
|
/* gcc uses crtbegin.o to find the start of
|
231 |
|
|
the constructors, so we make sure it is
|
232 |
|
|
first. Because this is a wildcard, it
|
233 |
|
|
doesn't matter if the user does not
|
234 |
|
|
actually link against crtbegin.o; the
|
235 |
|
|
linker won't look for a file to match a
|
236 |
|
|
wildcard. The wildcard also means that it
|
237 |
|
|
doesn't matter which directory crtbegin.o
|
238 |
|
|
is in. */
|
239 |
|
|
|
240 |
|
|
/* We don't want to include the .ctors section from
|
241 |
|
|
the crtend.o file until after the sorted ctors.
|
242 |
|
|
The .ctor section from the crtend file contains the
|
243 |
|
|
end of ctors marker and it must be last */
|
244 |
|
|
|
245 |
|
|
/* FIXME: We shouldn't need to define __CTOR_LIST__/__CTOR_END__
|
246 |
|
|
and __DTOR_LIST__/__DTOR_END__ except by the PROVIDE lines.
|
247 |
|
|
However this doesn't work for old (99r1-era) toolchains, so
|
248 |
|
|
leave it for now. */
|
249 |
|
|
|
250 |
|
|
#define SECTION_ctors(_region_, _vma_, _lma_) \
|
251 |
|
|
.ctors _vma_ : _lma_ \
|
252 |
|
|
{ \
|
253 |
|
|
FORCE_OUTPUT; \
|
254 |
|
|
KEEP (*crtbegin.o(.ctors)) \
|
255 |
|
|
__CTOR_LIST__ = .; \
|
256 |
|
|
PROVIDE (__CTOR_LIST__ = .); \
|
257 |
|
|
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) \
|
258 |
|
|
KEEP (*(SORT(.ctors.*))) \
|
259 |
|
|
KEEP (*(.ctors)) \
|
260 |
|
|
__CTOR_END__ = .; \
|
261 |
|
|
PROVIDE (__CTOR_END__ = .); \
|
262 |
|
|
} > _region_
|
263 |
|
|
|
264 |
|
|
#define SECTION_dtors(_region_, _vma_, _lma_) \
|
265 |
|
|
.dtors _vma_ : _lma_ \
|
266 |
|
|
{ \
|
267 |
|
|
FORCE_OUTPUT; \
|
268 |
|
|
KEEP (*crtbegin.o(.dtors)) \
|
269 |
|
|
__DTOR_LIST__ = .; \
|
270 |
|
|
PROVIDE (__DTOR_LIST__ = .); \
|
271 |
|
|
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) \
|
272 |
|
|
KEEP (*(SORT(.dtors.*))) \
|
273 |
|
|
KEEP (*(.dtors)) \
|
274 |
|
|
__DTOR_END__ = .; \
|
275 |
|
|
PROVIDE (__DTOR_END__ = .); \
|
276 |
|
|
} > _region_
|
277 |
|
|
|
278 |
|
|
#define SECTION_devtab(_region_, _vma_, _lma_) \
|
279 |
|
|
.devtab _vma_ : _lma_ \
|
280 |
|
|
{ \
|
281 |
|
|
FORCE_OUTPUT; \
|
282 |
|
|
KEEP(*( SORT (.ecos.table.*))) ; \
|
283 |
|
|
} > _region_
|
284 |
|
|
|
285 |
|
|
#define SECTION_got(_region_, _vma_, _lma_) \
|
286 |
|
|
_gp = ALIGN(16) + 0x7ff0; \
|
287 |
|
|
.got _vma_ : _lma_ \
|
288 |
|
|
{ \
|
289 |
|
|
FORCE_OUTPUT; *(.got.plt) *(.got) \
|
290 |
|
|
} > _region_
|
291 |
|
|
|
292 |
|
|
#define SECTION_dynamic(_region_, _vma_, _lma_) \
|
293 |
|
|
.dynamic _vma_ : _lma_ \
|
294 |
|
|
{ \
|
295 |
|
|
FORCE_OUTPUT; *(.dynamic) \
|
296 |
|
|
} > _region_
|
297 |
|
|
|
298 |
|
|
/* We want the small data sections together, so single-instruction offsets
|
299 |
|
|
can access them all, and initialized data all before uninitialized, so
|
300 |
|
|
we can shorten the on-disk segment size. */
|
301 |
|
|
|
302 |
|
|
#define SECTION_sdata(_region_, _vma_, _lma_) \
|
303 |
|
|
.sdata _vma_ : _lma_ \
|
304 |
|
|
{ \
|
305 |
|
|
FORCE_OUTPUT; *(.sdata) *(.sdata.*) *(.gnu.linkonce.s*) \
|
306 |
|
|
} > _region_
|
307 |
|
|
|
308 |
|
|
#define SECTION_lit8(_region_, _vma_, _lma_) \
|
309 |
|
|
.lit8 _vma_ : _lma_ \
|
310 |
|
|
{ \
|
311 |
|
|
FORCE_OUTPUT; *(.lit8) \
|
312 |
|
|
} > _region_
|
313 |
|
|
|
314 |
|
|
#define SECTION_lit4(_region_, _vma_, _lma_) \
|
315 |
|
|
.lit4 : FOLLOWING(.lit8) \
|
316 |
|
|
{ \
|
317 |
|
|
FORCE_OUTPUT; *(.lit4) \
|
318 |
|
|
} > _region_ \
|
319 |
|
|
__ram_data_end = .; _edata = . ; \
|
320 |
|
|
PROVIDE (edata = .);
|
321 |
|
|
|
322 |
|
|
#define SECTION_sbss(_region_, _vma_, _lma_) \
|
323 |
|
|
__bss_start = .; _fbss = .; \
|
324 |
|
|
.sbss _vma_ : _lma_ \
|
325 |
|
|
{ \
|
326 |
|
|
FORCE_OUTPUT; *(.dynsbss) *(.sbss) *(.sbss.*) *(.scommon) \
|
327 |
|
|
} > _region_
|
328 |
|
|
|
329 |
|
|
#define SECTION_bss(_region_, _vma_, _lma_) \
|
330 |
|
|
.bss _vma_ : _lma_ \
|
331 |
|
|
{ \
|
332 |
|
|
*(.dynbss) *(.bss) *(.bss.*) *(COMMON) \
|
333 |
|
|
} > _region_ \
|
334 |
|
|
__bss_end = .;
|
335 |
|
|
|
336 |
|
|
/* The /DISCARD/ section ensures that the output will not contain a
|
337 |
|
|
* .mdebug section as it confuses GDB. This is a workaround for CR 100804.
|
338 |
|
|
*/
|
339 |
|
|
|
340 |
|
|
#define SECTIONS_END . = ALIGN(4); _end = .; PROVIDE (end = .); \
|
341 |
|
|
/* Stabs debugging sections. */ \
|
342 |
|
|
.stab 0 : { *(.stab) } \
|
343 |
|
|
.stabstr 0 : { *(.stabstr) } \
|
344 |
|
|
.stab.excl 0 : { *(.stab.excl) } \
|
345 |
|
|
.stab.exclstr 0 : { *(.stab.exclstr) } \
|
346 |
|
|
.stab.index 0 : { *(.stab.index) } \
|
347 |
|
|
.stab.indexstr 0 : { *(.stab.indexstr) } \
|
348 |
|
|
.comment 0 : { *(.comment) } \
|
349 |
|
|
/* DWARF debug sections. \
|
350 |
|
|
Symbols in the DWARF debugging sections are relative to \
|
351 |
|
|
the beginning of the section so we begin them at 0. */ \
|
352 |
|
|
/* DWARF 1 */ \
|
353 |
|
|
.debug 0 : { *(.debug) } \
|
354 |
|
|
.line 0 : { *(.line) } \
|
355 |
|
|
/* GNU DWARF 1 extensions */ \
|
356 |
|
|
.debug_srcinfo 0 : { *(.debug_srcinfo) } \
|
357 |
|
|
.debug_sfnames 0 : { *(.debug_sfnames) } \
|
358 |
|
|
/* DWARF 1.1 and DWARF 2 */ \
|
359 |
|
|
.debug_aranges 0 : { *(.debug_aranges) } \
|
360 |
|
|
.debug_pubnames 0 : { *(.debug_pubnames) } \
|
361 |
|
|
/* DWARF 2 */ \
|
362 |
|
|
.debug_info 0 : { *(.debug_info) } \
|
363 |
|
|
.debug_abbrev 0 : { *(.debug_abbrev) } \
|
364 |
|
|
.debug_line 0 : { *(.debug_line) } \
|
365 |
|
|
.debug_frame 0 : { *(.debug_frame) } \
|
366 |
|
|
.debug_str 0 : { *(.debug_str) } \
|
367 |
|
|
.debug_loc 0 : { *(.debug_loc) } \
|
368 |
|
|
.debug_macinfo 0 : { *(.debug_macinfo) } \
|
369 |
|
|
/* SGI/MIPS DWARF 2 extensions */ \
|
370 |
|
|
.debug_weaknames 0 : { *(.debug_weaknames) } \
|
371 |
|
|
.debug_funcnames 0 : { *(.debug_funcnames) } \
|
372 |
|
|
.debug_typenames 0 : { *(.debug_typenames) } \
|
373 |
|
|
.debug_varnames 0 : { *(.debug_varnames) } \
|
374 |
|
|
/* These must appear regardless of . */ \
|
375 |
|
|
.gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } \
|
376 |
|
|
.gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } \
|
377 |
|
|
/DISCARD/ 0 : { *(.mdebug) }
|
378 |
|
|
|
379 |
|
|
#include CYGHWR_MEMORY_LAYOUT_LDI
|
380 |
|
|
|
381 |
|
|
#ifndef CYGPKG_HAL_MIPS_SIM
|
382 |
|
|
hal_vsr_table = 0x80000100;
|
383 |
|
|
#endif
|