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