1 //===========================================================================
3 // MLT linker script for CalmRISC32 Core
5 //===========================================================================
6 //####ECOSGPLCOPYRIGHTBEGIN####
7 // -------------------------------------------
8 // This file is part of eCos, the Embedded Configurable Operating System.
9 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
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 version.
15 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
16 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 // You should have received a copy of the GNU General Public License along
21 // with eCos; if not, write to the Free Software Foundation, Inc.,
22 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
24 // As a special exception, if other files instantiate templates or use macros
25 // or inline functions from this file, or you compile this file and link it
26 // with other works to produce a work based on this file, this file does not
27 // by itself cause the resulting work to be covered by the GNU General Public
28 // License. However the source code for this file must still be made available
29 // in accordance with section (3) of the GNU General Public License.
31 // This exception does not invalidate any other reasons why a work based on
32 // this file might be covered by the GNU General Public License.
34 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
35 // at http://sources.redhat.com/ecos/ecos-license/
36 // -------------------------------------------
37 //####ECOSGPLCOPYRIGHTEND####
38 //===========================================================================
40 #include <pkgconf/system.h>
42 OUTPUT_FORMAT("elf64-calmrisc32", "elf64-calmrisc32",
45 OUTPUT_ARCH(calmrisc32)
53 GROUP(libtarget.a libgcc.a libsupc++.a)
55 GROUP(libtarget.a libgcc.a)
58 #define ALIGN_LMA 0x40
59 #define FOLLOWING(_section_) AT ((LOADADDR (_section_) + SIZEOF (_section_) + ALIGN_LMA - 1) & ~ (ALIGN_LMA - 1))
61 #define FORCE_OUTPUT . = .
63 #define SECTIONS_BEGIN
65 #if defined(CYG_HAL_STARTUP_RAM)
67 /* this version for RAM startup */
68 #define SECTION_vectors(_region_, _vma_, _lma_) \
69 .vectors _vma_ : _lma_ \
70 { KEEP (*(.vectors)) } \
73 #elif defined(CYG_HAL_STARTUP_ROM)
75 /* this version for ROM startup */
76 #define SECTION_vectors(_region_, _vma_, _lma_) \
77 .vectors _vma_ : _lma_ \
78 { KEEP (*(.vectors)) } > _region_
80 #endif /* ROM startup version of ROM vectors */
82 #define SECTION_ROMISC(_region_, _vma_, _lma_) \
83 .interp _vma_ : _lma_ { *(.interp) } > _region_ \
84 .hash : FOLLOWING(.interp) { *(.hash) } > _region_ \
85 .dynsym : FOLLOWING(.hash) { *(.dynsym) } > _region_ \
86 .dynstr : FOLLOWING(.dynsym) { *(.dynstr) } > _region_ \
87 .gnu.version : FOLLOWING(.dynstr) { *(.gnu.version) } > _region_ \
88 .gnu.version_d : FOLLOWING(.gnu.version) { *(.gnu.version_d) } > _region_ \
89 .gnu.version_r : FOLLOWING(.gnu.version_d) { *(.gnu.version_r) } > _region_
91 #define SECTION_RELOCS(_region_, _vma_, _lma_) \
96 *(.rel.gnu.linkonce.t*) \
102 *(.rela.gnu.linkonce.t*) \
108 *(.rel.gnu.linkonce.d*) \
114 *(.rela.gnu.linkonce.d*) \
120 *(.rel.gnu.linkonce.r*) \
126 *(.rela.gnu.linkonce.r*) \
128 .rel.got : { *(.rel.got) } > _region_ \
129 .rela.got : { *(.rela.got) } > _region_ \
130 .rel.ctors : { *(.rel.ctors) } > _region_ \
131 .rela.ctors : { *(.rela.ctors) } > _region_ \
132 .rel.dtors : { *(.rel.dtors) } > _region_ \
133 .rela.dtors : { *(.rela.dtors) } > _region_ \
134 .rel.init : { *(.rel.init) } > _region_ \
135 .rela.init : { *(.rela.init) } > _region_ \
136 .rel.fini : { *(.rel.fini) } > _region_ \
137 .rela.fini : { *(.rela.fini) } > _region_ \
138 .rel.bss : { *(.rel.bss) } > _region_ \
139 .rela.bss : { *(.rela.bss) } > _region_ \
140 .rel.plt : { *(.rel.plt) } > _region_ \
141 .rela.plt : { *(.rela.plt) } > _region_ \
142 .rel.dyn : { *(.rel.dyn) } > _region_
144 #define SECTION_init(_region_, _vma_, _lma_) \
145 .init _vma_ : _lma_ \
147 FORCE_OUTPUT; KEEP (*(.init)) \
150 #define SECTION_text(_region_, _vma_, _lma_) \
151 .text _vma_ : _lma_ \
153 _stext = .; _ftext = . ; \
158 *(.gnu.linkonce.t*) \
159 } > _region_ =0x9e90 \
160 _etext = .; PROVIDE (etext = .);
162 #define SECTION_fini(_region_, _vma_, _lma_) \
163 .fini _vma_ : _lma_ \
165 FORCE_OUTPUT; KEEP (*(.fini)) \
168 #define SECTION_rodata(_region_, _vma_, _lma_) \
169 .rodata _vma_ : _lma_ \
171 FORCE_OUTPUT; *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) \
174 #define SECTION_rodata1(_region_, _vma_, _lma_) \
175 .rodata1 _vma_ : _lma_ \
177 FORCE_OUTPUT; *(.rodata1) *(.rodata1.*) \
180 #define SECTION_vsr_table(_region_, _vma_, _lma_) \
181 .vsr_table _vma_ : _lma_ \
183 FORCE_OUTPUT; *(.vsr_table) \
186 #define SECTION_data(_region_, _vma_, _lma_) \
187 .data _vma_ : _lma_ \
189 __ram_data_start = ABSOLUTE (.); _fdata = . ; \
190 *(.data) *(.data.*) *(.gnu.linkonce.d*) \
194 __rom_data_start = LOADADDR(.data);
196 #define SECTION_data1(_region_, _vma_, _lma_) \
197 .data1 _vma_ : _lma_ \
199 FORCE_OUTPUT; *(.data1) *(.data1.*) \
202 #define SECTION_eh_frame(_region_, _vma_, _lma_) \
203 .eh_frame _vma_ : _lma_ \
205 FORCE_OUTPUT; *(.eh_frame) \
208 #define SECTION_gcc_except_table(_region_, _vma_, _lma_) \
209 .gcc_except_table _vma_ : _lma_ \
211 FORCE_OUTPUT; *(.gcc_except_table) \
215 /* gcc uses crtbegin.o to find the start of
216 the constructors, so we make sure it is
217 first. Because this is a wildcard, it
218 doesn't matter if the user does not
219 actually link against crtbegin.o; the
220 linker won't look for a file to match a
221 wildcard. The wildcard also means that it
222 doesn't matter which directory crtbegin.o
225 /* We don't want to include the .ctors section from
226 the crtend.o file until after the sorted ctors.
227 The .ctor section from the crtend file contains the
228 end of ctors marker and it must be last */
230 /* FIXME: We shouldn't need to define __CTOR_LIST__/__CTOR_END__
231 and __DTOR_LIST__/__DTOR_END__ except by the PROVIDE lines.
232 However this doesn't work for old (99r1-era) toolchains, so
235 #define SECTION_ctors(_region_, _vma_, _lma_) \
236 .ctors _vma_ : _lma_ \
239 KEEP (*crtbegin.o(.ctors)) \
241 PROVIDE (__CTOR_LIST__ = .); \
242 KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) \
243 KEEP (*(SORT(.ctors.*))) \
246 PROVIDE (__CTOR_END__ = .); \
249 #define SECTION_dtors(_region_, _vma_, _lma_) \
250 .dtors _vma_ : _lma_ \
253 KEEP (*crtbegin.o(.dtors)) \
255 PROVIDE (__DTOR_LIST__ = .); \
256 KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) \
257 KEEP (*(SORT(.dtors.*))) \
260 PROVIDE (__DTOR_END__ = .); \
263 #define SECTION_devtab(_region_, _vma_, _lma_) \
264 .devtab _vma_ : _lma_ \
267 KEEP(*( SORT (.ecos.table.*))) ; \
270 #define SECTION_got(_region_, _vma_, _lma_) \
271 _gp = ALIGN(16) + 0x7ff0; \
274 FORCE_OUTPUT; *(.got.plt) *(.got) \
277 #define SECTION_dynamic(_region_, _vma_, _lma_) \
278 .dynamic _vma_ : _lma_ \
280 FORCE_OUTPUT; *(.dynamic) \
283 /* We want the small data sections together, so single-instruction offsets
284 can access them all, and initialized data all before uninitialized, so
285 we can shorten the on-disk segment size. */
287 #define SECTION_sdata(_region_, _vma_, _lma_) \
288 .sdata _vma_ : _lma_ \
290 FORCE_OUTPUT; *(.sdata) *(.sdata.*) *(.gnu.linkonce.s*) \
293 #define SECTION_lit8(_region_, _vma_, _lma_) \
294 .lit8 _vma_ : _lma_ \
296 FORCE_OUTPUT; *(.lit8) \
299 #define SECTION_lit4(_region_, _vma_, _lma_) \
300 .lit4 : FOLLOWING(.lit8) \
302 FORCE_OUTPUT; *(.lit4) \
304 __ram_data_end = .; _edata = . ; \
307 #define SECTION_sbss(_region_, _vma_, _lma_) \
308 __bss_start = .; _fbss = .; \
309 .sbss _vma_ : _lma_ \
311 FORCE_OUTPUT; *(.dynsbss) *(.sbss) *(.sbss.*) *(.gnu.linkonce.sb.*) *(.scommon) \
314 #define SECTION_bss(_region_, _vma_, _lma_) \
317 *(.dynbss) *(.bss) *(.bss.*) *(.gnu.linkonce.b.*) *(COMMON) \
321 /* The /DISCARD/ section ensures that the output will not contain a
322 * .mdebug section as it confuses GDB. This is a workaround for CR 100804.
325 #define SECTIONS_END . = ALIGN(4); _end = .; PROVIDE (end = .); \
326 /* Stabs debugging sections. */ \
327 .stab 0 : { *(.stab) } \
328 .stabstr 0 : { *(.stabstr) } \
329 .stab.excl 0 : { *(.stab.excl) } \
330 .stab.exclstr 0 : { *(.stab.exclstr) } \
331 .stab.index 0 : { *(.stab.index) } \
332 .stab.indexstr 0 : { *(.stab.indexstr) } \
333 .comment 0 : { *(.comment) } \
334 /* DWARF debug sections. \
335 Symbols in the DWARF debugging sections are relative to \
336 the beginning of the section so we begin them at 0. */ \
338 .debug 0 : { *(.debug) } \
339 .line 0 : { *(.line) } \
340 /* GNU DWARF 1 extensions */ \
341 .debug_srcinfo 0 : { *(.debug_srcinfo) } \
342 .debug_sfnames 0 : { *(.debug_sfnames) } \
343 /* DWARF 1.1 and DWARF 2 */ \
344 .debug_aranges 0 : { *(.debug_aranges) } \
345 .debug_pubnames 0 : { *(.debug_pubnames) } \
347 .debug_info 0 : { *(.debug_info) } \
348 .debug_abbrev 0 : { *(.debug_abbrev) } \
349 .debug_line 0 : { *(.debug_line) } \
350 .debug_frame 0 : { *(.debug_frame) } \
351 .debug_str 0 : { *(.debug_str) } \
352 .debug_loc 0 : { *(.debug_loc) } \
353 .debug_macinfo 0 : { *(.debug_macinfo) } \
354 /* SGI/MIPS DWARF 2 extensions */ \
355 .debug_weaknames 0 : { *(.debug_weaknames) } \
356 .debug_funcnames 0 : { *(.debug_funcnames) } \
357 .debug_typenames 0 : { *(.debug_typenames) } \
358 .debug_varnames 0 : { *(.debug_varnames) } \
359 /* These must appear regardless of . */ \
360 .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } \
361 .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } \
362 /DISCARD/ 0 : { *(.mdebug) }
364 #include CYGHWR_MEMORY_LAYOUT_LDI
366 _hal_vsr_table = 0x0;
367 _hal_virtual_vector_table = 0x100;