]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/hal/mips/tx49/v2_0/src/mips_tx49.ld
Initial revision
[karo-tx-redboot.git] / packages / hal / mips / tx49 / v2_0 / src / mips_tx49.ld
1 //===========================================================================
2 //
3 // MLT linker script for MIPS TX49
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 Red Hat, 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 version.
14 //
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
18 // for more details.
19 //
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.
23 //
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.
30 //
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.
33 //
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 //===========================================================================
39
40 #include <pkgconf/system.h>
41
42 OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips",
43               "elf32-littlemips")
44 /* The preprocessor defines mips, but we know we're mips :-) */
45 #undef mips
46 OUTPUT_ARCH(mips:4000)
47
48 STARTUP(vectors.o)
49 ENTRY(reset_vector)
50 #if defined(EXTRAS)
51 INPUT(extras.o)
52 #endif
53 #if (__GNUC__ >= 3)
54 GROUP(libtarget.a libgcc.a libsupc++.a)
55 #else
56 GROUP(libtarget.a libgcc.a)
57 #endif
58
59 /* FIXME: The MLT should pass in the required alignment since it must be
60  * the same as the VMA's alignment. As a result of this bug, all the REF4955
61  * ROM mlt files have alignment 8, when some should have alignment 4
62  * (902557-CR)
63  */
64 #define ALIGN_LMA 8
65 #define FOLLOWING(_section_) AT ((LOADADDR (_section_) + SIZEOF (_section_) + ALIGN_LMA - 1) & ~ (ALIGN_LMA - 1))
66 #define LMA_EQ_VMA
67 #define FORCE_OUTPUT . = .
68
69 #define SECTIONS_BEGIN
70
71 #if defined(CYG_HAL_STARTUP_RAM)
72
73 /* this version for RAM startup */
74 #define SECTION_rom_vectors(_region_, _vma_, _lma_) \
75     .rom_vectors _vma_ : _lma_ \
76     { KEEP (*(.utlb_vector)) \
77     . = ALIGN(0x80); KEEP(*(.other_vector)) \
78         /* debug and reset vector not used in RAM version */ \
79         KEEP(*(.debug_vector)) \
80         KEEP (*(.reset_vector)) } \
81     > _region_
82
83 #elif defined(CYG_HAL_STARTUP_ROM)
84
85 /* this version for ROM startup */
86 #define SECTION_rom_vectors(_region_, _vma_, _lma_) \
87     .rom_vectors _vma_ : _lma_ \
88     { KEEP (*(.reset_vector)) \
89     . = ALIGN(0x200); KEEP (*(.utlb_vector)) \
90     . = ALIGN(0x100); . = . + 4; \
91     . = ALIGN(0x80); KEEP(*(.other_vector)) \
92     . = ALIGN(0x100); KEEP(*(.debug_vector)) } \
93     > _region_
94
95 #endif /* ROM startup version of ROM vectors */
96
97 #define SECTION_ROMISC(_region_, _vma_, _lma_)                                 \
98   .interp _vma_  : _lma_ { *(.interp)                            } > _region_  \
99   .hash          : FOLLOWING(.interp)        { *(.hash)          } > _region_  \
100   .dynsym        : FOLLOWING(.hash)          { *(.dynsym)        } > _region_  \
101   .dynstr        : FOLLOWING(.dynsym)        { *(.dynstr)        } > _region_  \
102   .gnu.version   : FOLLOWING(.dynstr)        { *(.gnu.version)   } > _region_  \
103   .gnu.version_d : FOLLOWING(.gnu.version)   { *(.gnu.version_d) } > _region_  \
104   .gnu.version_r : FOLLOWING(.gnu.version_d) { *(.gnu.version_r) } > _region_  \
105   .plt           : FOLLOWING(.gnu.version_r) { *(.plt)           } > _region_
106
107 #define SECTION_RELOCS(_region_, _vma_, _lma_)                              \
108   .rel.text      :                                                          \
109     {                                                                       \
110       *(.rel.text)                                                          \
111       *(.rel.text.*)                                                        \
112       *(.rel.gnu.linkonce.t*)                                               \
113     } > _region_                                                            \
114   .rela.text     :                                                          \
115     {                                                                       \
116       *(.rela.text)                                                         \
117       *(.rela.text.*)                                                       \
118       *(.rela.gnu.linkonce.t*)                                              \
119     } > _region_                                                            \
120   .rel.data      :                                                          \
121     {                                                                       \
122       *(.rel.data)                                                          \
123       *(.rel.data.*)                                                        \
124       *(.rel.gnu.linkonce.d*)                                               \
125     } > _region_                                                            \
126   .rela.data     :                                                          \
127     {                                                                       \
128       *(.rela.data)                                                         \
129       *(.rela.data.*)                                                       \
130       *(.rela.gnu.linkonce.d*)                                              \
131     } > _region_                                                            \
132   .rel.rodata    :                                                          \
133     {                                                                       \
134       *(.rel.rodata)                                                        \
135       *(.rel.rodata.*)                                                      \
136       *(.rel.gnu.linkonce.r*)                                               \
137     } > _region_                                                            \
138   .rela.rodata   :                                                          \
139     {                                                                       \
140       *(.rela.rodata)                                                       \
141       *(.rela.rodata.*)                                                     \
142       *(.rela.gnu.linkonce.r*)                                              \
143     } > _region_                                                            \
144   .rel.got       :   { *(.rel.got)    } > _region_                          \
145   .rela.got      :   { *(.rela.got)   } > _region_                          \
146   .rel.ctors     :   { *(.rel.ctors)  } > _region_                          \
147   .rela.ctors    :   { *(.rela.ctors) } > _region_                          \
148   .rel.dtors     :   { *(.rel.dtors)  } > _region_                          \
149   .rela.dtors    :   { *(.rela.dtors) } > _region_                          \
150   .rel.init      :   { *(.rel.init)   } > _region_                          \
151   .rela.init     :   { *(.rela.init)  } > _region_                          \
152   .rel.fini      :   { *(.rel.fini)   } > _region_                          \
153   .rela.fini     :   { *(.rela.fini)  } > _region_                          \
154   .rel.bss       :   { *(.rel.bss)    } > _region_                          \
155   .rela.bss      :   { *(.rela.bss)   } > _region_                          \
156   .rel.plt       :   { *(.rel.plt)    } > _region_                          \
157   .rela.plt      :   { *(.rela.plt)   } > _region_                          \
158   .rel.dyn       :   { *(.rel.dyn)    } > _region_
159
160 #define SECTION_init(_region_, _vma_, _lma_)   \
161   .init _vma_ : _lma_                          \
162     {                                          \
163       FORCE_OUTPUT; KEEP (*(.init))            \
164     } > _region_ =0
165
166 #define SECTION_text(_region_, _vma_, _lma_)   \
167   .text _vma_ : _lma_                          \
168     {                                          \
169       _stext = .; _ftext = . ;                 \
170       *(.text)                                 \
171       *(.text.*)                               \
172       *(.stub)                                 \
173       *(.gnu.warning)                          \
174       *(.gnu.linkonce.t*)                      \
175       *(.mips16.fn.*) *(.mips16.call.*)        \
176     } > _region_ =0                            \
177   _etext = .; PROVIDE (etext = .);
178
179 #define SECTION_fini(_region_, _vma_, _lma_)   \
180   .fini _vma_ : _lma_                          \
181     {                                          \
182       FORCE_OUTPUT; KEEP (*(.fini))                   \
183     } > _region_ =0
184
185 #define SECTION_rodata(_region_, _vma_, _lma_)        \
186   .rodata _vma_ : _lma_                               \
187     {                                                 \
188       FORCE_OUTPUT; *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*)    \
189     } > _region_
190
191 #define SECTION_rodata1(_region_, _vma_, _lma_)       \
192   .rodata1 _vma_ : _lma_                              \
193     {                                                 \
194      FORCE_OUTPUT; *(.rodata1) *(.rodata1.*)          \
195     } > _region_
196
197 #define SECTION_vsr_table(_region_, _vma_, _lma_)     \
198   .vsr_table _vma_ : _lma_                            \
199     {                                                 \
200       FORCE_OUTPUT; *(.vsr_table)                     \
201     } > _region_
202
203 #define SECTION_data(_region_, _vma_, _lma_)          \
204   .data _vma_ : _lma_                                 \
205     {                                                 \
206       __ram_data_start = ABSOLUTE (.); _fdata = . ;   \
207       *(.data) *(.data.*) *(.gnu.linkonce.d*)         \
208       *(.2ram.*)                                      \
209     . = ALIGN (8);                                    \
210     SORT(CONSTRUCTORS)                                \
211     } > _region_                                      \
212     __rom_data_start = LOADADDR(.data);
213
214 #define SECTION_data1(_region_, _vma_, _lma_)         \
215   .data1 _vma_ : _lma_                                \
216     {                                                 \
217        FORCE_OUTPUT; *(.data1) *(.data1.*)            \
218     } > _region_
219
220 #define SECTION_eh_frame(_region_, _vma_, _lma_)      \
221   .eh_frame _vma_ : _lma_                             \
222     {                                                 \
223        FORCE_OUTPUT; *(.eh_frame)                     \
224     } > _region_
225
226 #define SECTION_gcc_except_table(_region_, _vma_, _lma_) \
227   .gcc_except_table _vma_ : _lma_                        \
228     {                                                    \
229       FORCE_OUTPUT; *(.gcc_except_table)                 \
230     } > _region_
231
232
233 /* FIXME: We shouldn't need to define __CTOR_LIST__/__CTOR_END__
234    and __DTOR_LIST__/__DTOR_END__ except by the PROVIDE lines.
235    However this doesn't work for old (99r1-era) toolchains, so
236    leave it for now. */
237
238 /* The KEEP(*_ctors.o(.ctors)) rule is included to prevent
239    constructors from libgcc.a from turning up in the image.
240    They are NULL anyway. */
241
242 #define SECTION_ctors(_region_, _vma_, _lma_)     \
243   .ctors _vma_ : _lma_                            \
244     {                                             \
245       FORCE_OUTPUT;                               \
246       KEEP (*crtbegin.o(.ctors))                  \
247       KEEP (*_ctors.o(.ctors))                  \
248       __CTOR_LIST__ = .;                \
249       PROVIDE (__CTOR_LIST__ = .);                \
250       KEEP (*(.ctors));                      \
251       KEEP (*(SORT(.ctors.*)))                    \
252       __CTOR_END__ = .;                 \
253       PROVIDE (__CTOR_END__ = .);                 \
254     } > _region_
255
256 #define SECTION_dtors(_region_, _vma_, _lma_)     \
257   .dtors _vma_ : _lma_                            \
258     {                                             \
259       FORCE_OUTPUT;                               \
260       KEEP (*crtbegin.o(.dtors))                  \
261       __DTOR_LIST__ = .;                \
262       PROVIDE (__DTOR_LIST__ = .);                \
263       KEEP (*(SORT(.dtors.*)))                    \
264       __DTOR_END__ = .;                 \
265       KEEP (*(.dtors));                      \
266       PROVIDE (__DTOR_END__ = .);                 \
267     } > _region_
268
269 #define SECTION_devtab(_region_, _vma_, _lma_)    \
270   .devtab _vma_ : _lma_                           \
271     {                                             \
272       FORCE_OUTPUT;                               \
273       KEEP(*( SORT (.ecos.table.*))) ;            \
274     } > _region_
275
276 #define SECTION_got(_region_, _vma_, _lma_)     \
277   _gp = ALIGN(16) + 0x7ff0;                     \
278   .got _vma_ : _lma_                            \
279     {                                           \
280       FORCE_OUTPUT; *(.got.plt) *(.got)         \
281     } > _region_
282
283 #define SECTION_dynamic(_region_, _vma_, _lma_) \
284   .dynamic _vma_ : _lma_                        \
285     {                                           \
286       FORCE_OUTPUT; *(.dynamic)                 \
287     } > _region_
288
289   /* We want the small data sections together, so single-instruction offsets
290      can access them all, and initialized data all before uninitialized, so
291      we can shorten the on-disk segment size.  */
292
293 #define SECTION_sdata(_region_, _vma_, _lma_)                 \
294   .sdata _vma_ : _lma_                                        \
295     {                                                         \
296       FORCE_OUTPUT; *(.sdata) *(.sdata.*) *(.gnu.linkonce.s*) \
297     } > _region_
298
299 #define SECTION_lit8(_region_, _vma_, _lma_)    \
300   .lit8 _vma_ : _lma_                           \
301     {                                           \
302       FORCE_OUTPUT; *(.lit8)                    \
303     } > _region_
304
305 #define SECTION_lit4(_region_, _vma_, _lma_)    \
306   .lit4 : FOLLOWING(.lit8)                      \
307     {                                           \
308       FORCE_OUTPUT; *(.lit4)                    \
309     } > _region_                                \
310   __ram_data_end = .; _edata = . ;              \
311   PROVIDE (edata = .);
312
313 #define SECTION_sbss(_region_, _vma_, _lma_)                    \
314   __bss_start = .; _fbss = .;                                   \
315   .sbss _vma_ : _lma_                                           \
316     {                                                           \
317       FORCE_OUTPUT; *(.dynsbss) *(.sbss) *(.sbss.*) *(.scommon) \
318     } > _region_
319
320 #define SECTION_bss(_region_, _vma_, _lma_)       \
321   .bss _vma_ : _lma_                              \
322     {                                             \
323       *(.dynbss) *(.bss) *(.bss.*) *(COMMON)      \
324     } > _region_                                  \
325   __bss_end = .;
326
327 /* The /DISCARD/ section ensures that the output will not contain a
328  * .mdebug section as it confuses GDB. This is a workaround for CR 100804.
329  */
330
331 #define SECTIONS_END . = ALIGN(4); _end = .; PROVIDE (end = .); \
332   /* Stabs debugging sections.  */                              \
333   .stab          0 : { *(.stab) }                               \
334   .stabstr       0 : { *(.stabstr) }                            \
335   .stab.excl     0 : { *(.stab.excl) }                          \
336   .stab.exclstr  0 : { *(.stab.exclstr) }                       \
337   .stab.index    0 : { *(.stab.index) }                         \
338   .stab.indexstr 0 : { *(.stab.indexstr) }                      \
339   .comment       0 : { *(.comment) }                            \
340   /* DWARF debug sections.                                      \
341      Symbols in the DWARF debugging sections are relative to    \
342      the beginning of the section so we begin them at 0.  */    \
343   /* DWARF 1 */                                                 \
344   .debug          0 : { *(.debug) }                             \
345   .line           0 : { *(.line) }                              \
346   /* GNU DWARF 1 extensions */                                  \
347   .debug_srcinfo  0 : { *(.debug_srcinfo) }                     \
348   .debug_sfnames  0 : { *(.debug_sfnames) }                     \
349   /* DWARF 1.1 and DWARF 2 */                                   \
350   .debug_aranges  0 : { *(.debug_aranges) }                     \
351   .debug_pubnames 0 : { *(.debug_pubnames) }                    \
352   /* DWARF 2 */                                                 \
353   .debug_info     0 : { *(.debug_info) }                        \
354   .debug_abbrev   0 : { *(.debug_abbrev) }                      \
355   .debug_line     0 : { *(.debug_line) }                        \
356   .debug_frame    0 : { *(.debug_frame) }                       \
357   .debug_str      0 : { *(.debug_str) }                         \
358   .debug_loc      0 : { *(.debug_loc) }                         \
359   .debug_macinfo  0 : { *(.debug_macinfo) }                     \
360   /* SGI/MIPS DWARF 2 extensions */                             \
361   .debug_weaknames 0 : { *(.debug_weaknames) }                  \
362   .debug_funcnames 0 : { *(.debug_funcnames) }                  \
363   .debug_typenames 0 : { *(.debug_typenames) }                  \
364   .debug_varnames  0 : { *(.debug_varnames) }                   \
365   /* These must appear regardless of  .  */                     \
366   .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }             \
367   .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }                \
368   /DISCARD/        0 : { *(.mdebug) }
369
370 #include CYGHWR_MEMORY_LAYOUT_LDI
371
372 // 0-0x200 reserved for vectors
373 hal_vsr_table = 0x80000200;
374 hal_virtual_vector_table = 0x80000300;