]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/hal/coldfire/arch/v2_0/src/coldfire.ld
Initial revision
[karo-tx-redboot.git] / packages / hal / coldfire / arch / v2_0 / src / coldfire.ld
1 //==========================================================================
2 //
3 //  coldfire.ld
4 //
5 //  Linker script
6 //
7 //==========================================================================
8 //####ECOSGPLCOPYRIGHTBEGIN####
9 // -------------------------------------------
10 // This file is part of eCos, the Embedded Configurable Operating System.
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
12 // Copyright (C) 2006 eCosCentric Ltd.
13 //
14 // eCos is free software; you can redistribute it and/or modify it under
15 // the terms of the GNU General Public License as published by the Free
16 // Software Foundation; either version 2 or (at your option) any later version.
17 //
18 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
19 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
21 // for more details.
22 //
23 // You should have received a copy of the GNU General Public License along
24 // with eCos; if not, write to the Free Software Foundation, Inc.,
25 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
26 //
27 // As a special exception, if other files instantiate templates or use macros
28 // or inline functions from this file, or you compile this file and link it
29 // with other works to produce a work based on this file, this file does not
30 // by itself cause the resulting work to be covered by the GNU General Public
31 // License. However the source code for this file must still be made available
32 // in accordance with section (3) of the GNU General Public License.
33 //
34 // This exception does not invalidate any other reasons why a work based on
35 // this file might be covered by the GNU General Public License.
36 // -------------------------------------------
37 //####ECOSGPLCOPYRIGHTEND####
38 //==========================================================================
39 //#####DESCRIPTIONBEGIN####
40 //
41 // Author(s):     Enrico Piria
42 // Contributors:  Wade Jensen
43 // Date:          2005-25-06
44 // Purpose:       Coldfire-specific linker script definitions.
45 //
46 //####DESCRIPTIONEND####
47 //========================================================================
48
49 STARTUP(vectors.o)
50 ENTRY(_start)
51 #ifdef EXTRAS
52 INPUT(extras.o)
53 #endif
54 #if (__GNUC__ >= 3)
55 GROUP(libtarget.a libgcc.a libsupc++.a)
56 #else
57 GROUP(libtarget.a libgcc.a)
58 #endif
59
60 #define ALIGN_LMA 4
61 #define FOLLOWING(_section_) AT ((LOADADDR (_section_) + SIZEOF (_section_) + ALIGN_LMA - 1) & ~ (ALIGN_LMA - 1))
62 #define LMA_EQ_VMA
63 #define FORCE_OUTPUT . = .
64
65 #define SECTIONS_BEGIN
66
67 #define SECTION_boot(_region_, _vma_, _lma_)                            \
68     .boot _vma_ : _lma_                                                 \
69     {                                                                   \
70         FORCE_OUTPUT;                                                   \
71         *(.boot*)                                                       \
72         . = ALIGN(4);                                                   \
73     }                                                                   \
74     > _region_
75
76 #define SECTION_text(_region_, _vma_, _lma_)                            \
77     .text _vma_ : _lma_                                                 \
78     {                                                                   \
79         _stext = .;                                                     \
80         *(.text*) *(.gnu.warning) *(.gnu.linkonce*) *(.init)            \
81         . = ALIGN(4);                                                   \
82     }                                                                   \
83     > _region_                                                          \
84     _etext = .;  PROVIDE (etext = .);
85
86 #define SECTION_fini(_region_, _vma_, _lma_)                            \
87     .fini _vma_ : _lma_                                                 \
88     {                                                                   \
89         FORCE_OUTPUT;                                                   \
90         *(.fini)                                                        \
91         . = ALIGN(4);                                                   \
92     }                                                                   \
93     > _region_
94
95 #define SECTION_rodata1(_region_, _vma_, _lma_)                         \
96     .rodata1 _vma_ : _lma_                                              \
97     {                                                                   \
98         FORCE_OUTPUT;                                                   \
99         *(.rodata1*)                                                    \
100         . = ALIGN(4);                                                   \
101     }                                                                   \
102     > _region_
103
104 #define SECTION_rodata(_region_, _vma_, _lma_)                          \
105     .rodata _vma_ : _lma_                                               \
106     {                                                                   \
107         FORCE_OUTPUT;                                                   \
108         *(.rodata*)                                                     \
109         . = ALIGN(4);                                                   \
110     }                                                                   \
111     > _region_
112
113 #define SECTION_fixup(_region_, _vma_, _lma_)                           \
114     .fixup _vma_ : _lma_                                                \
115     {                                                                   \
116         __FIXUP_START__ = ABSOLUTE(.);                                  \
117         *(.fixup)                                                       \
118         . = ALIGN(4);                                                   \
119         __FIXUP_END__ = ABSOLUTE(.);                                    \
120     }                                                                   \
121     > _region_
122
123 #define SECTION_gcc_except_table(_region_, _vma_, _lma_)                \
124     .gcc_except_table _vma_ : _lma_                                     \
125     {                                                                   \
126         __EXCEPT_START__ = ABSOLUTE(.);                                 \
127         *(.gcc_except_table)                                            \
128         . = ALIGN(4);                                                   \
129         __EXCEPT_END__ = ABSOLUTE(.);                                   \
130     }                                                                   \
131     > _region_
132
133 #define SECTION_data(_region_, _vma_, _lma_)                                        \
134     .data _vma_ : _lma_                                                             \
135     {                                                                               \
136         __ram_data_start = ABSOLUTE(.);                                             \
137         *(.data*)                                                                   \
138         __GOT1_START__ = ABSOLUTE(.);                                               \
139         *(.got1)                                                                    \
140         __GOT1_END__ = ABSOLUTE(.);                                                 \
141         . = ALIGN (4);                                                              \
142           /* Put .ctors and .dtors next to the .got2 section, so that */            \
143           /* the pointers get relocated with -mrelocatable.           */            \
144         __CTOR_LIST__ = ABSOLUTE(.);                                                \
145         KEEP(*(SORT(.ctors*)));                                                     \
146         __CTOR_END__ = ABSOLUTE(.);                                                 \
147         __DTOR_LIST__ = ABSOLUTE(.);                                                \
148         KEEP(*(SORT(.dtors*)))                                                      \
149         __DTOR_END__ = ABSOLUTE(.);                                                 \
150         . = ALIGN(4);                                                               \
151         KEEP(*( SORT (.ecos.table.*)));                                             \
152         . = ALIGN (4);                                                              \
153           *( .2ram.*) ;                                                             \
154         __GOT2_START__ = ABSOLUTE(.);                                               \
155         *(.got2)                                                                    \
156         __GOT2_END__ = ABSOLUTE(.);                                                 \
157         __GOT_START = ABSOLUTE(.);                                                  \
158         _GLOBAL_OFFSET_TABLE_ = ABSOLUTE(. + 32768);                                \
159         _SDA_BASE_ = ABSOLUTE(.);                                                   \
160         *(.got.plt) *(.got)                                                         \
161         __GOT_END__ = ABSOLUTE(.);                                                  \
162         *(.dynamic)                                                                 \
163         *(.eh_frame)                                                                \
164           /* We want the small data sections together, so single-instruction */     \
165           /* offsets can access them all, and initialized data all before    */     \
166           /* uninitialized, so we can shorten the on-disk segment size.      */     \
167         __SDATA_START__ = ABSOLUTE(.);                                              \
168         *(.sdata) *(.sdata.*)                                                       \
169         __SDATA2_START__ = ABSOLUTE(.);                                             \
170         *(.sdata2*)                                                                 \
171         . = ALIGN(4);                                                               \
172         __ram_data_end = ABSOLUTE(.);                                               \
173         __ram_data_size = ABSOLUTE (.) - ABSOLUTE(__ram_data_start);                \
174     }                                                                               \
175     > _region_                                                                      \
176     __rom_data_start = LOADADDR(.data);                                             \
177     __rom_data_size = SIZEOF(.data);                                                \
178     __rom_data_end = __rom_data_start + __rom_data_size;
179
180 #define SECTION_bss(_region_, _vma_, _lma_)                                     \
181     .bss _vma_ : _lma_                                                          \
182     {                                                                           \
183         __bss_start = ABSOLUTE (.);                                             \
184         FORCE_OUTPUT;                                                           \
185         *(.dynbss*) *(.bss*) *(COMMON) *(.sbss*) *(.scommon*)                   \
186         . = ALIGN(4);                                                           \
187         __bss_end = ABSOLUTE (.);                                               \
188         __bss_size = ABSOLUTE (.) - ABSOLUTE(__bss_start);                      \
189     }                                                                           \
190     > _region_
191
192 #define SECTION_stab    \
193     .stab 0 (NOLOAD) :  \
194     {                   \
195         *(.stab)        \
196     }
197
198 #define SECTION_stabstr     \
199     .stabstr 0 (NOLOAD) :   \
200     {                       \
201         *(.stabstr)         \
202     }
203
204 #define SECTION_comment     \
205     .comment 0 (NOLOAD) :   \
206     {                       \
207         *(.comment)         \
208     }
209
210 #define SECTION_uninvar(_region_, _vma_, _lma_)                                 \
211     .uninvar _vma_ : _lma_                                                      \
212     {                                                                           \
213         __uninvar_start = ABSOLUTE (.);                                         \
214         FORCE_OUTPUT;                                                           \
215         *(.uninvar);                                                            \
216         . = ALIGN(4);                                                           \
217         __uninvar_end = ABSOLUTE (.);                                           \
218         __uninvar_size = ABSOLUTE (.) - ABSOLUTE(__uninvar_start);              \
219     }                                                                           \
220     > _region_
221
222 #define SECTION_romvec(_region_, _vma_, _lma_)                                  \
223     .romvec _vma_ : _lma_                                                       \
224     {                                                                           \
225         __romvec_start = ABSOLUTE (.);                                          \
226         FORCE_OUTPUT;                                                           \
227         KEEP(*(.romvec));                                                       \
228         . = ALIGN(4);                                                           \
229         __romvec_end = ABSOLUTE (.);                                            \
230         __romvec_size = ABSOLUTE (.) - ABSOLUTE(__romvec_start);                \
231     }                                                                           \
232     > _region_
233
234 #define SECTION_ramvec(_region_, _vma_, _lma_)                                  \
235     .ramvec _vma_ : _lma_                                                       \
236     {                                                                           \
237         __ramvec_start = ABSOLUTE (.);                                          \
238         FORCE_OUTPUT;                                                           \
239         KEEP(*(.ramvec));                                                       \
240         . = ALIGN(4);                                                           \
241         __ramvec_end = ABSOLUTE (.);                                            \
242         __ramvec_size = ABSOLUTE (.) - ABSOLUTE(__ramvec_start);                \
243     }                                                                           \
244     > _region_
245     
246 #define SECTION_virtual_vec_table(_region_, _vma_, _lma_)                                   \
247     .virtual_vec_table _vma_ : _lma_                                                        \
248     {                                                                                       \
249         __virtual_vec_table_start = ABSOLUTE (.);                                           \
250         . += 0x100;                                                                         \
251         __virtual_vec_table_end = ABSOLUTE (.);                                             \
252         __virtual_vec_table_size = ABSOLUTE (.) - ABSOLUTE(__virtual_vec_table_start);      \
253     }                                                                                       \
254     > _region_
255
256 #define SECTIONS_END                                \
257     SECTION_stab                                    \
258     SECTION_stabstr                                 \
259     SECTION_comment                                 \
260     . = ALIGN(0x4); _end = .; PROVIDE (end = .);
261
262 #include <pkgconf/system.h>
263 #include CYGHWR_MEMORY_LAYOUT_LDI
264
265 hal_virtual_vector_table = __virtual_vec_table_start;