1 //===========================================================================
\r
3 // MLT linker script for Nios II
\r
5 //===========================================================================
\r
6 //####ECOSGPLCOPYRIGHTBEGIN####
\r
7 // -------------------------------------------
\r
8 // This file is part of eCos, the Embedded Configurable Operating System.
\r
10 // eCos is free software; you can redistribute it and/or modify it under
\r
11 // the terms of the GNU General Public License as published by the Free
\r
12 // Software Foundation; either version 2 or (at your option) any later version.
\r
14 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
\r
15 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
\r
16 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
\r
17 // for more details.
\r
19 // You should have received a copy of the GNU General Public License along
\r
20 // with eCos; if not, write to the Free Software Foundation, Inc.,
\r
21 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
\r
23 // As a special exception, if other files instantiate templates or use macros
\r
24 // or inline functions from this file, or you compile this file and link it
\r
25 // with other works to produce a work based on this file, this file does not
\r
26 // by itself cause the resulting work to be covered by the GNU General Public
\r
27 // License. However the source code for this file must still be made available
\r
28 // in accordance with section (3) of the GNU General Public License.
\r
30 // This exception does not invalidate any other reasons why a work based on
\r
31 // this file might be covered by the GNU General Public License.
\r
33 // -------------------------------------------
\r
34 //####ECOSGPLCOPYRIGHTEND####
\r
35 //===========================================================================
\r
37 #include <pkgconf/system.h>
\r
38 #include <pkgconf/hal_nios2.h>
\r
39 #define __ASSEMBLER__
\r
40 #include <pkgconf/mlt_nios2.h>
\r
41 #undef __ASSEMBLER__
\r
48 GROUP(libtarget.a libgcc.a libsupc++.a)
\r
50 GROUP(libtarget.a libgcc.a)
\r
53 OUTPUT_FORMAT( "elf32-littlenios2",
\r
54 "elf32-littlenios2",
\r
55 "elf32-littlenios2" )
\r
60 #define FOLLOWING(_section_) AT ((LOADADDR (_section_) + SIZEOF (_section_) + ALIGN_LMA - 1) & ~ (ALIGN_LMA - 1))
\r
63 #define FORCE_OUTPUT . = .
\r
65 #define SECTIONS_BEGIN
\r
67 #define SECTIONS_entry(_region_, _vma_, _lma_) \
\r
68 .entry _vma_ : _lma_ \
\r
73 #ifdef CYGSEM_HAL_USE_ROM_MONITOR
\r
75 #define SECTIONS_exceptions(_region_,_vma_, _lma_) \
\r
76 .rom_monitor_exceptions _vma_ (NOLOAD) : _lma_ \
\r
79 . += CYGNUM_ROM_MONITOR_EXCEPTIONS_LEN; \
\r
80 . = ALIGN(32 / 8); \
\r
83 #else /* !CYGSEM_HAL_USE_ROM_MONITOR */
\r
85 #define SECTIONS_exceptions(_region_,_vma_, _lma_) \
\r
86 .exceptions _vma_ : _lma_ \
\r
88 PROVIDE (__ram_exc_start = ABSOLUTE(.)); \
\r
91 KEEP (*(.exceptions)); \
\r
92 PROVIDE (__ram_exc_end = ABSOLUTE(.)); \
\r
94 PROVIDE (__rom_exc_start = LOADADDR(.exceptions));
\r
96 #endif /* CYGSEM_HAL_USE_ROM_MONITOR */
\r
98 #define SECTIONS_text(_vma_, _lma_) \
\r
99 .text _vma_ : _lma_ \
\r
101 PROVIDE (stext = ABSOLUTE(.)); \
\r
102 PROVIDE (_stext = ABSOLUTE(.)); \
\r
109 *(.gnu.version_d); \
\r
110 *(.gnu.version_r); \
\r
113 *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*); \
\r
114 *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*); \
\r
117 *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*); \
\r
118 *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*); \
\r
119 *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*); \
\r
120 *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*); \
\r
121 *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*); \
\r
122 *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*); \
\r
123 *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*); \
\r
124 *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*); \
\r
131 *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*); \
\r
132 *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*); \
\r
133 *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*); \
\r
134 *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*); \
\r
135 *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*); \
\r
136 *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*); \
\r
137 *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*); \
\r
138 *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*); \
\r
139 *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*); \
\r
140 *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*); \
\r
146 *(.text .stub .text.* .gnu.linkonce.t.*); \
\r
147 *(.gnu.warning.*); \
\r
149 PROVIDE (__etext = ABSOLUTE(.)); \
\r
150 PROVIDE (_etext = ABSOLUTE(.)); \
\r
151 PROVIDE (etext = ABSOLUTE(.)); \
\r
153 *(.eh_frame_hdr); \
\r
154 . = ALIGN(32 / 8); \
\r
155 PROVIDE (__preinit_array_start = ABSOLUTE(.)); \
\r
156 *(.preinit_array); \
\r
157 PROVIDE (__preinit_array_end = ABSOLUTE(.)); \
\r
158 PROVIDE (__init_array_start = ABSOLUTE(.)); \
\r
160 PROVIDE (__init_array_end = ABSOLUTE(.)); \
\r
161 PROVIDE (__fini_array_start = ABSOLUTE(.)); \
\r
163 PROVIDE (__fini_array_end = ABSOLUTE(.)); \
\r
164 SORT(CONSTRUCTORS) \
\r
165 KEEP (*(.eh_frame)); \
\r
166 *(.gcc_except_table); \
\r
168 PROVIDE (__CTOR_LIST__ = ABSOLUTE(.)); \
\r
170 KEEP (*(SORT(.ctors.*))); \
\r
171 PROVIDE (__CTOR_END__ = ABSOLUTE(.)); \
\r
172 PROVIDE (__DTOR_LIST__ = ABSOLUTE(.)); \
\r
174 KEEP (*(SORT(.dtors.*))); \
\r
175 PROVIDE (__DTOR_END__ = ABSOLUTE(.)); \
\r
177 } > CYGHWR_HAL_NIOS2_TEXT_REGION =0x0001883a
\r
179 #define SECTIONS_rodata(_vma_, _lma_) \
\r
180 .rodata _vma_ : _lma_ \
\r
182 . = ALIGN(32 / 8); \
\r
183 *(.rodata .rodata.* .gnu.linkonce.r.*); \
\r
185 } > CYGHWR_HAL_NIOS2_RODATA_REGION
\r
187 #define SECTIONS_rwdata(_vma_, _lma_) \
\r
188 .rwdata _vma_ : _lma_ \
\r
190 PROVIDE (__ram_data_start = ABSOLUTE(.)); \
\r
191 . = ALIGN(32 / 8); \
\r
192 *(.got.plt) *(.got); \
\r
195 *(.data .data.* .gnu.linkonce.d.*); \
\r
197 KEEP(*( SORT (.ecos.table.*))); \
\r
200 _gp = ABSOLUTE(. + 0x7ff0); \
\r
201 PROVIDE(gp = _gp); \
\r
203 *(.sdata .sdata.* .gnu.linkonce.s.*); \
\r
204 *(.sdata2 .sdata2.* .gnu.linkonce.s2.*); \
\r
205 . = ALIGN(32 / 8); \
\r
206 _edata = ABSOLUTE(.); \
\r
207 PROVIDE (edata = ABSOLUTE(.)); \
\r
208 PROVIDE (__ram_data_end = ABSOLUTE(.)); \
\r
209 } > CYGHWR_HAL_NIOS2_RWDATA_REGION \
\r
210 PROVIDE (__rom_data_start = LOADADDR(.rwdata));
\r
212 #define SECTIONS_bss(_vma_, _lma_) \
\r
213 .bss _vma_ : _lma_ \
\r
215 __bss_start = ABSOLUTE(.); \
\r
216 PROVIDE (__sbss_start = ABSOLUTE(.)); \
\r
217 PROVIDE (___sbss_start = ABSOLUTE(.)); \
\r
220 *(.sbss .sbss.* .gnu.linkonce.sb.*); \
\r
221 *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*); \
\r
224 PROVIDE (__sbss_end = ABSOLUTE(.)); \
\r
225 PROVIDE (___sbss_end = ABSOLUTE(.)); \
\r
228 *(.bss .bss.* .gnu.linkonce.b.*); \
\r
231 . = ALIGN(32 / 8); \
\r
232 PROVIDE (__bss_end = ABSOLUTE(.)); \
\r
233 PROVIDE (__end = ABSOLUTE(.)); \
\r
234 PROVIDE (end = ABSOLUTE(.)); \
\r
235 } > CYGHWR_HAL_NIOS2_RWDATA_REGION
\r
237 #define SECTIONS_END \
\r
238 .stab 0 : { *(.stab) } \
\r
239 .stabstr 0 : { *(.stabstr) } \
\r
240 .stab.excl 0 : { *(.stab.excl) } \
\r
241 .stab.exclstr 0 : { *(.stab.exclstr) } \
\r
242 .stab.index 0 : { *(.stab.index) } \
\r
243 .stab.indexstr 0 : { *(.stab.indexstr) } \
\r
244 .comment 0 : { *(.comment) } \
\r
245 .debug 0 : { *(.debug) } \
\r
246 .line 0 : { *(.line) } \
\r
247 .debug_srcinfo 0 : { *(.debug_srcinfo) } \
\r
248 .debug_sfnames 0 : { *(.debug_sfnames) } \
\r
249 .debug_aranges 0 : { *(.debug_aranges) } \
\r
250 .debug_pubnames 0 : { *(.debug_pubnames) } \
\r
251 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } \
\r
252 .debug_abbrev 0 : { *(.debug_abbrev) } \
\r
253 .debug_line 0 : { *(.debug_line) } \
\r
254 .debug_frame 0 : { *(.debug_frame) } \
\r
255 .debug_str 0 : { *(.debug_str) } \
\r
256 .debug_loc 0 : { *(.debug_loc) } \
\r
257 .debug_macinfo 0 : { *(.debug_macinfo) } \
\r
258 .debug_weaknames 0 : { *(.debug_weaknames) } \
\r
259 .debug_funcnames 0 : { *(.debug_funcnames) } \
\r
260 .debug_typenames 0 : { *(.debug_typenames) } \
\r
261 .debug_varnames 0 : { *(.debug_varnames) }
\r
263 #ifdef CYGSEM_HAL_USE_ROM_MONITOR
\r
265 #define SECTIONS_rom_monitor_text(_vma_, _lma_) \
\r
266 .rom_monitor_text _vma_ (NOLOAD) : _lma_ \
\r
268 . += CYGNUM_ROM_MONITOR_TEXT_LEN; \
\r
269 . = ALIGN(32 / 8); \
\r
270 } > CYGSEM_ROM_MONITOR_TEXT_REGION
\r
272 #define SECTIONS_rom_monitor_rodata(_vma_, _lma_) \
\r
273 .rom_monitor_rodata _vma_ (NOLOAD) : _lma_ \
\r
275 . += CYGNUM_ROM_MONITOR_RODATA_LEN; \
\r
276 . = ALIGN(32 / 8); \
\r
277 } > CYGSEM_ROM_MONITOR_RODATA_REGION
\r
279 #define SECTIONS_rom_monitor_rwdata(_vma_, _lma_) \
\r
280 .rom_monitor_rwdata _vma_ (NOLOAD) : _lma_ \
\r
282 . = ALIGN(32 / 8); \
\r
283 PROVIDE (hal_virtual_vector_table = ABSOLUTE(.)); \
\r
285 PROVIDE (hal_vsr_table = ABSOLUTE(.)); \
\r
286 . += CYGNUM_ROM_MONITOR_RWDATA_LEN; \
\r
287 . = ALIGN(32 / 8); \
\r
288 } > CYGSEM_ROM_MONITOR_RWDATA_REGION
\r
290 #else /* !CYGSEM_HAL_USE_ROM_MONITOR */
\r
292 #define SECTIONS_rom_monitor_text(_vma_, _lma_)
\r
293 #define SECTIONS_rom_monitor_rodata(_vma_, _lma_)
\r
294 #define SECTIONS_rom_monitor_rwdata(_vma_, _lma_) \
\r
295 .rom_monitor_rwdata _vma_ : _lma_ \
\r
297 . = ALIGN(32 / 8); \
\r
298 PROVIDE (hal_virtual_vector_table = ABSOLUTE(.)); \
\r
300 PROVIDE (hal_vsr_table = ABSOLUTE(.)); \
\r
302 } > CYGHWR_HAL_NIOS2_RWDATA_REGION
\r
304 #endif /* CYGSEM_HAL_USE_ROM_MONITOR */
\r
306 #include CYGHWR_MEMORY_LAYOUT_LDI
\r