]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/hal/arm/arch/v2_0/src/arm.ld
unified MX27, MX25, MX37 trees
[karo-tx-redboot.git] / packages / hal / arm / arch / v2_0 / src / arm.ld
1 //=============================================================================
2 //
3 // MLT linker script for ARM
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 STARTUP(vectors.o)
43 ENTRY(reset_vector)
44 INPUT(extras.o)
45 #if (__GNUC__ >= 3)
46 GROUP(libtarget.a libgcc.a libsupc++.a)
47 #else
48 GROUP(libtarget.a libgcc.a)
49 #endif
50
51 #if defined(__ARMEB__)
52 OUTPUT_FORMAT(elf32-bigarm)
53 #endif
54
55 #if defined(CYG_HAL_STARTUP_ROM)    \
56     && defined(CYGPKG_HAL_ARM_PID)  \
57     && defined(__ARMEB__)
58 // Note: This is only needed when the PID board is used in BE mode without
59 //       the proper ROM controller part.
60 //
61 // In big-endian mode, merge .RODATA sections into the .DATA section. This
62 // causes the data in these sections to be copied to RAM. When the CPU
63 // makes byte or halfword access to RAM, A0/A1 are modified correctly.
64 // This does not happen on ROM access (unless the proper ROM controller
65 // is used).
66 //
67 #define MERGE_IN_RODATA *(.rodata*)
68 #define CYGPRI_PID_BE_WORKAROUND
69 #else
70 // Keep RODATA in separate sections.
71 #define MERGE_IN_RODATA
72 #undef  CYGPRI_PID_BE_WORKAROUND
73 #endif
74
75 #define ALIGN_LMA 4
76 #define FOLLOWING(_section_) AT ((LOADADDR (_section_) + SIZEOF (_section_) + ALIGN_LMA - 1) & ~ (ALIGN_LMA - 1))
77 #define LMA_EQ_VMA
78 #define FORCE_OUTPUT . = .
79
80 // Some versions of gcc define "arm" which causes problems with .note.arm.ident
81 #undef arm
82 #define SECTIONS_BEGIN                          \
83   /* Debug information */                       \
84   .debug_aranges  0 : { *(.debug_aranges) }     \
85   .debug_pubnames 0 : { *(.debug_pubnames) }    \
86   .debug_info     0 : { *(.debug_info) }        \
87   .debug_abbrev   0 : { *(.debug_abbrev) }      \
88   .debug_line     0 : { *(.debug_line) }        \
89   .debug_frame    0 : { *(.debug_frame) }       \
90   .debug_str      0 : { *(.debug_str) }         \
91   .debug_loc      0 : { *(.debug_loc) }         \
92   .debug_macinfo  0 : { *(.debug_macinfo) }     \
93   .note.arm.ident 0 : { KEEP (*(.note.arm.ident)) }
94
95 #define SECTION_fixed_vectors(_region_, _vma_, _lma_) \
96     .fixed_vectors _vma_ : _lma_ \
97     { FORCE_OUTPUT; KEEP (*(.fixed_vectors)) } \
98     > _region_
99
100 #define SECTION_rom_vectors(_region_, _vma_, _lma_) \
101     .rom_vectors _vma_ : _lma_ \
102     { __rom_vectors_vma = ABSOLUTE(.); \
103       FORCE_OUTPUT; KEEP (*(.vectors)) } \
104     > _region_ \
105     __rom_vectors_lma = LOADADDR(.rom_vectors);
106
107 #define SECTION_text(_region_, _vma_, _lma_) \
108     .text _vma_ : _lma_ \
109     { _stext = ABSOLUTE(.); \
110     PROVIDE (__stext = ABSOLUTE(.)); \
111     *(.text*) *(i.*) *(.gnu.warning) *(.gnu.linkonce.t.*) *(.init) \
112     *(.glue_7) *(.glue_7t)  \
113     } > _region_ \
114     _etext = .; PROVIDE (__etext = .);
115
116 #define SECTION_fini(_region_, _vma_, _lma_) \
117     .fini _vma_ : _lma_ \
118     { FORCE_OUTPUT; *(.fini) } \
119     > _region_
120
121 #if defined(CYGPRI_PID_BE_WORKAROUND)
122 #define SECTION_rodata(_region_, _vma_, _lma_)
123 #define SECTION_rodata1(_region_, _vma_, _lma_)
124 #else
125 #define SECTION_rodata(_region_, _vma_, _lma_) \
126     .rodata _vma_ : _lma_ \
127     { FORCE_OUTPUT; *(.rodata*) *(.gnu.linkonce.r.*) } \
128     > _region_
129
130 #define SECTION_rodata1(_region_, _vma_, _lma_) \
131     .rodata1 _vma_ : _lma_ \
132     { FORCE_OUTPUT; *(.rodata1) } \
133     > _region_
134 #define SECTION_extab(_region_, _vma_, _lma_) \
135     .extab _vma_ : _lma_ \
136     { FORCE_OUTPUT; *(.ARM.extab*) } \
137     > _region_
138 #define SECTION_exidx(_region_, _vma_, _lma_) \
139     .exidx _vma_ : _lma_ \
140     { FORCE_OUTPUT; *(.ARM.exidx*) } \
141     > _region_
142 #endif // CYGPRI_PID_BE_WORKAROUND
143
144 #define SECTION_fixup(_region_, _vma_, _lma_) \
145     .fixup _vma_ : _lma_ \
146     { FORCE_OUTPUT; *(.fixup) } \
147     > _region_
148
149 #define SECTION_gcc_except_table(_region_, _vma_, _lma_) \
150     .gcc_except_table _vma_ : _lma_ \
151     { FORCE_OUTPUT; *(.gcc_except_table) } \
152     > _region_
153
154 #define SECTION_eh_frame(_region_, _vma_, _lma_)      \
155   .eh_frame _vma_ : _lma_                             \
156     {                                                 \
157        FORCE_OUTPUT;  __EH_FRAME_BEGIN__ = .;         \
158        KEEP(*(.eh_frame))                             \
159        __FRAME_END__ = .;                             \
160        . = . + 8;                                     \
161     } > _region_ = 0
162
163 #define SECTION_RELOCS(_region_, _vma_, _lma_)                              \
164   .rel.text      :                                                          \
165     {                                                                       \
166       *(.rel.text)                                                          \
167       *(.rel.text.*)                                                        \
168       *(.rel.gnu.linkonce.t*)                                               \
169     } > _region_                                                            \
170   .rela.text     :                                                          \
171     {                                                                       \
172       *(.rela.text)                                                         \
173       *(.rela.text.*)                                                       \
174       *(.rela.gnu.linkonce.t*)                                              \
175     } > _region_                                                            \
176   .rel.data      :                                                          \
177     {                                                                       \
178       *(.rel.data)                                                          \
179       *(.rel.data.*)                                                        \
180       *(.rel.gnu.linkonce.d*)                                               \
181     } > _region_                                                            \
182   .rela.data     :                                                          \
183     {                                                                       \
184       *(.rela.data)                                                         \
185       *(.rela.data.*)                                                       \
186       *(.rela.gnu.linkonce.d*)                                              \
187     } > _region_                                                            \
188   .rel.rodata    :                                                          \
189     {                                                                       \
190       *(.rel.rodata)                                                        \
191       *(.rel.rodata.*)                                                      \
192       *(.rel.gnu.linkonce.r*)                                               \
193     } > _region_                                                            \
194   .rela.rodata   :                                                          \
195     {                                                                       \
196       *(.rela.rodata)                                                       \
197       *(.rela.rodata.*)                                                     \
198       *(.rela.gnu.linkonce.r*)                                              \
199     } > _region_                                                            \
200   .rel.got       :   { *(.rel.got)    } > _region_                          \
201   .rela.got      :   { *(.rela.got)   } > _region_                          \
202   .rel.ctors     :   { *(.rel.ctors)  } > _region_                          \
203   .rela.ctors    :   { *(.rela.ctors) } > _region_                          \
204   .rel.dtors     :   { *(.rel.dtors)  } > _region_                          \
205   .rela.dtors    :   { *(.rela.dtors) } > _region_                          \
206   .rel.init      :   { *(.rel.init)   } > _region_                          \
207   .rela.init     :   { *(.rela.init)  } > _region_                          \
208   .rel.fini      :   { *(.rel.fini)   } > _region_                          \
209   .rela.fini     :   { *(.rela.fini)  } > _region_                          \
210   .rel.bss       :   { *(.rel.bss)    } > _region_                          \
211   .rela.bss      :   { *(.rela.bss)   } > _region_                          \
212   .rel.plt       :   { *(.rel.plt)    } > _region_                          \
213   .rela.plt      :   { *(.rela.plt)   } > _region_                          \
214   .rel.dyn       :   { *(.rel.dyn)    } > _region_
215
216 #define SECTION_got(_region_, _vma_, _lma_)                                 \
217   .got _vma_ : _lma_                                                        \
218     {                                                                       \
219       FORCE_OUTPUT; *(.got.plt) *(.got)                                     \
220       _GOT1_START_ = ABSOLUTE (.); *(.got1) _GOT1_END_ = ABSOLUTE (.);      \
221       _GOT2_START_ = ABSOLUTE (.); *(.got2) _GOT2_END_ = ABSOLUTE (.);      \
222     } > _region_
223
224 #define SECTION_mmu_tables(_region_, _vma_, _lma_) \
225     .mmu_tables _vma_ : _lma_ \
226     { FORCE_OUTPUT; *(.mmu_tables) } \
227     > _region_
228
229 #define SECTION_sram(_region_, _vma_, _lma_) \
230     .sram _vma_ : _lma_ \
231     { FORCE_OUTPUT; *(.sram*) } \
232     > _region_
233
234 #define SECTION_data(_region_,  _vma_, _lma_) \
235     .data _vma_ : _lma_ \
236     { __ram_data_start = ABSOLUTE (.); \
237     *(.data*) *(.data1) *(.constdata*) *(.gnu.linkonce.d.*) MERGE_IN_RODATA \
238     . = ALIGN (4); \
239     KEEP(*( SORT (.ecos.table.*))) ;            \
240     . = ALIGN (4); \
241     __CTOR_LIST__ = ABSOLUTE (.); KEEP (*(SORT (.ctors*))) __CTOR_END__ = ABSOLUTE (.); \
242     __DTOR_LIST__ = ABSOLUTE (.); KEEP (*(SORT (.dtors*))) __DTOR_END__ = ABSOLUTE (.); \
243     *(.dynamic) *(.sdata*) *(.gnu.linkonce.s.*) \
244     . = ALIGN (4); *(.2ram.*) } \
245     > _region_ \
246     __rom_data_start = LOADADDR (.data); \
247     __ram_data_end = .; PROVIDE (__ram_data_end = .); _edata = .; PROVIDE (edata = .); \
248     PROVIDE (__rom_data_end = LOADADDR (.data) + SIZEOF(.data));
249
250 #define SECTION_bss(_region_,  _vma_, _lma_) \
251     .bss _vma_ : _lma_ \
252     { __bss_start = ABSOLUTE (.); \
253     *(.scommon) *(.dynsbss) *(.sbss*) *(.gnu.linkonce.sb.*) \
254     *(.dynbss) *(.bss*) *(.gnu.linkonce.b.*) *(COMMON) \
255     __bss_end = ABSOLUTE (.); } \
256     > _region_
257
258 #define SECTIONS_END . = ALIGN(4); _end = .; PROVIDE (end = .);
259
260 #include <pkgconf/hal_arm.h>
261 #include CYGHWR_MEMORY_LAYOUT_LDI