]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/hal/synth/arch/v2_0/src/synth.ld
unified MX27, MX25, MX37 trees
[karo-tx-redboot.git] / packages / hal / synth / arch / v2_0 / src / synth.ld
1 //==========================================================================
2 //
3 //      synth.ld
4 //
5 //      Linker script for the synthetic target
6 //
7 //==========================================================================
8 //####ECOSGPLCOPYRIGHTBEGIN####
9 // -------------------------------------------
10 // This file is part of eCos, the Embedded Configurable Operating System.
11 // Copyright (C) 2005 Bart Veer
12 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
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 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
38 // at http://sources.redhat.com/ecos/ecos-license/
39 // -------------------------------------------
40 //####ECOSGPLCOPYRIGHTEND####
41 //==========================================================================
42 //#####DESCRIPTIONBEGIN####
43 //
44 // Author(s):   jskov
45 // Contributors:jskov, bartv
46 // Date:        1999-01-18
47 // Purpose:     synthetic target linker script
48 //
49 //####DESCRIPTIONEND####
50 //
51 //==========================================================================
52 STARTUP(vectors.o)
53 ENTRY(_start)
54 #ifdef EXTRAS
55 INPUT(extras.o)
56 #endif
57 #if (__GNUC__ >= 3)
58 GROUP(libtarget.a libgcc.a libsupc++.a libgcc_eh.a)
59 #else
60 GROUP(libtarget.a libgcc.a)
61 #endif
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
69 #define SECTIONS_BEGIN
70
71 #define SECTION_vectors(_region_, _vma_, _lma_)         \
72   .vectors _vma_ : _lma_                                \
73   { FORCE_OUTPUT; KEEP(*(.vectors)) }                   \
74   > _region_
75
76 #define SECTION_text(_region_, _vma_, _lma_)                    \
77   .text _vma_ : _lma_                                           \
78   { _stext = .;                                                 \
79     *(.text*) *(.gnu.warning) *(.gnu.linkonce.t.*) *(.init) }   \
80   > _region_                                                    \
81   _etext = .;  PROVIDE (etext = .);
82
83 #define SECTION_fini(_region_, _vma_, _lma_)                    \
84     .fini _vma_ : _lma_                                         \
85     { FORCE_OUTPUT; *(.fini) }                                  \
86     > _region_
87
88 #define SECTION_rodata1(_region_, _vma_, _lma_)                 \
89     .rodata1 _vma_ : _lma_                                      \
90     { FORCE_OUTPUT; *(.rodata1) }                               \
91     > _region_
92
93 #define SECTION_rodata(_region_, _vma_, _lma_)                  \
94     .rodata _vma_ : _lma_                                       \
95     { FORCE_OUTPUT; *(.rodata*) *(.gnu.linkonce.r.*) }          \
96     > _region_
97
98 #define SECTION_fixup(_region_, _vma_, _lma_)                                   \
99     .fixup _vma_ : _lma_                                                        \
100     { _FIXUP_START_ = ABSOLUTE(.); *(.fixup) _FIXUP_END_ = ABSOLUTE(.);}        \
101     > _region_
102
103 #define SECTION_gcc_except_table(_region_, _vma_, _lma_)                        \
104     .gcc_except_table _vma_ : _lma_                                             \
105     { _EXCEPT_START_ = ABSOLUTE(.); *(.gcc_except_table)                        \
106       _EXCEPT_END_ = ABSOLUTE(.);}                                              \
107     > _region_
108
109 #define SECTION_eh_frame(_region_, _vma_, _lma_)      \
110   .eh_frame _vma_ : _lma_                             \
111     {                                                 \
112        FORCE_OUTPUT;  __EH_FRAME_BEGIN__ = .;         \
113        KEEP(*(.eh_frame*))                             \
114        __FRAME_END__ = .;                             \
115        . = . + 8;                                     \
116     } > _region_ = 0
117
118 #define SECTION_RELOCS(_region_, _vma_, _lma_)                              \
119   .rel.text      :                                                          \
120     {                                                                       \
121       *(.rel.text)                                                          \
122       *(.rel.text.*)                                                        \
123       *(.rel.gnu.linkonce.t*)                                               \
124     } > _region_                                                            \
125   .rela.text     :                                                          \
126     {                                                                       \
127       *(.rela.text)                                                         \
128       *(.rela.text.*)                                                       \
129       *(.rela.gnu.linkonce.t*)                                              \
130     } > _region_                                                            \
131   .rel.data      :                                                          \
132     {                                                                       \
133       *(.rel.data)                                                          \
134       *(.rel.data.*)                                                        \
135       *(.rel.gnu.linkonce.d*)                                               \
136     } > _region_                                                            \
137   .rela.data     :                                                          \
138     {                                                                       \
139       *(.rela.data)                                                         \
140       *(.rela.data.*)                                                       \
141       *(.rela.gnu.linkonce.d*)                                              \
142     } > _region_                                                            \
143   .rel.rodata    :                                                          \
144     {                                                                       \
145       *(.rel.rodata)                                                        \
146       *(.rel.rodata.*)                                                      \
147       *(.rel.gnu.linkonce.r*)                                               \
148     } > _region_                                                            \
149   .rela.rodata   :                                                          \
150     {                                                                       \
151       *(.rela.rodata)                                                       \
152       *(.rela.rodata.*)                                                     \
153       *(.rela.gnu.linkonce.r*)                                              \
154     } > _region_                                                            \
155   .rel.got       :   { *(.rel.got)    } > _region_                          \
156   .rela.got      :   { *(.rela.got)   } > _region_                          \
157   .rel.ctors     :   { *(.rel.ctors)  } > _region_                          \
158   .rela.ctors    :   { *(.rela.ctors) } > _region_                          \
159   .rel.dtors     :   { *(.rel.dtors)  } > _region_                          \
160   .rela.dtors    :   { *(.rela.dtors) } > _region_                          \
161   .rel.init      :   { *(.rel.init)   } > _region_                          \
162   .rela.init     :   { *(.rela.init)  } > _region_                          \
163   .rel.fini      :   { *(.rel.fini)   } > _region_                          \
164   .rela.fini     :   { *(.rela.fini)  } > _region_                          \
165   .rel.bss       :   { *(.rel.bss)    } > _region_                          \
166   .rela.bss      :   { *(.rela.bss)   } > _region_                          \
167   .rel.plt       :   { *(.rel.plt)    } > _region_                          \
168   .rela.plt      :   { *(.rela.plt)   } > _region_                          \
169   .rel.dyn       :   { *(.rel.dyn)    } > _region_
170
171 // Note: The __ in the name is an encoding of the .
172 #define SECTION_rel__got(_region_, _vma_, _lma_)                                \
173     .rel.got _vma_ : _lma_                                                      \
174     { *(.rel.got)      }                                                        \
175     > _region_
176
177 #define SECTION_data(_region_, _vma_, _lma_)                                    \
178     .data _vma_ : _lma_                                                         \
179     { __ram_data_start = ABSOLUTE(.); *(.data*) *(.gnu.linkonce.d.*)            \
180     _GOT1_START_ = ABSOLUTE(.); *(.got1) _GOT1_END_ = ABSOLUTE(.);              \
181       /* Put .ctors and .dtors next to the .got2 section, so that */            \
182       /* the pointers get relocated with -mrelocatable.           */            \
183      . = ALIGN(8); __CTOR_LIST__ = ABSOLUTE(.);                                 \
184       KEEP(*(SORT(.ctors*))) __CTOR_END__ = ABSOLUTE(.);                        \
185      __DTOR_LIST__ = ABSOLUTE(.);                                               \
186        KEEP(*(SORT(.dtors*))) __DTOR_END__ = ABSOLUTE(.);                       \
187     . = ALIGN(32);                                                              \
188     KEEP(*( SORT (.ecos.table.*)));                                             \
189     _GOT2_START_ = ABSOLUTE(.); *(.got2) _GOT2_END_ = ABSOLUTE(.);              \
190     _GOT_START_ = ABSOLUTE(.); _GLOBAL_OFFSET_TABLE_ = ABSOLUTE(. + 32768);     \
191     _SDA_BASE_ = ABSOLUTE(.); *(.got.plt) *(.got)                               \
192     _GOT_END_ = ABSOLUTE(.);  *(.dynamic)                                       \
193       /* We want the small data sections together, so single-instruction */     \
194       /* offsets can access them all, and initialized data all before    */     \
195       /* uninitialized, so we can shorten the on-disk segment size.      */     \
196     _SDATA_START_ = ABSOLUTE(.); *(.sdata*) *(.gnu.linkonce.s.*) }              \
197     > _region_                                                                  \
198     __rom_data_start = LOADADDR(.data);                                         \
199     __ram_data_end = .; PROVIDE(__ram_data_end = .);                            \
200     _edata = .; PROVIDE (edata = .);
201
202 #define SECTION_sbss(_region_, _vma_, _lma_)                                    \
203     .sbss _vma_ : _lma_                                                         \
204     { __bss_start = ABSOLUTE (.);                                               \
205     _SBSS_START_ = ABSOLUTE(.); *(.sbss*) *(.gnu.linkonce.sb.*)                 \
206     _SBSS_END_ = ABSOLUTE(.);                                                   \
207     *(.scommon*) }                                                              \
208     > _region_
209
210 #define SECTION_bss(_region_, _vma_, _lma_)                                     \
211     .bss _vma_ : _lma_                                                          \
212     { FORCE_OUTPUT; *(.dynbss*) *(.bss*) *(COMMON) *(.gnu.linkonce.b.*) }       \
213     > _region_                                                                  \
214     __bss_end = .;
215
216 #define SECTIONS_HEAP(_region_, _start_, _end_)                                 \
217     .synth_heap _start_ :                                                       \
218     { FORCE_OUTPUT; . = _end_ - _start_ ; }                                     \
219     > _region_
220
221 #define SECTIONS_END . = ALIGN(4); _end = .; PROVIDE (end = .);
222
223 #include <pkgconf/system.h>
224 #include CYGHWR_MEMORY_LAYOUT_LDI