1 //=============================================================================
3 // MLT linker script for ARM
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.
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.
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
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.
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.
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.
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 //=============================================================================
40 #include <pkgconf/system.h>
41 #include <pkgconf/hal_arm.h>
47 GROUP(libtarget.a libgcc.a libsupc++.a)
49 GROUP(libtarget.a libgcc.a)
52 #if defined(__ARMEB__)
53 OUTPUT_FORMAT(elf32-bigarm)
56 #if defined(CYG_HAL_STARTUP_ROM) \
57 && defined(CYGPKG_HAL_ARM_PID) \
59 // Note: This is only needed when the PID board is used in BE mode without
60 // the proper ROM controller part.
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
68 #define MERGE_IN_RODATA *(.rodata*)
69 #define CYGPRI_PID_BE_WORKAROUND
71 // Keep RODATA in separate sections.
72 #define MERGE_IN_RODATA
73 #undef CYGPRI_PID_BE_WORKAROUND
77 #define FOLLOWING(_section_) AT ((LOADADDR (_section_) + SIZEOF (_section_) + ALIGN_LMA - 1) & ~ (ALIGN_LMA - 1))
79 #define FORCE_OUTPUT . = .
81 // Some versions of gcc define "arm" which causes problems with .note.arm.ident
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)) }
96 #define SECTION_fixed_vectors(_region_, _vma_, _lma_) \
97 .fixed_vectors _vma_ : _lma_ \
98 { FORCE_OUTPUT; KEEP (*(.fixed_vectors)) } \
101 #define SECTION_rom_vectors(_region_, _vma_, _lma_) \
102 .rom_vectors _vma_ : _lma_ \
103 { __rom_vectors_vma = ABSOLUTE(.); \
104 FORCE_OUTPUT; KEEP (*(.vectors)) } \
106 __rom_vectors_lma = LOADADDR(.rom_vectors);
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) \
115 _etext = .; PROVIDE (__etext = .);
117 #define SECTION_fini(_region_, _vma_, _lma_) \
118 .fini _vma_ : _lma_ \
119 { FORCE_OUTPUT; *(.fini) } \
122 #if defined(CYGPRI_PID_BE_WORKAROUND)
123 #define SECTION_rodata(_region_, _vma_, _lma_)
124 #define SECTION_rodata1(_region_, _vma_, _lma_)
126 #define SECTION_rodata(_region_, _vma_, _lma_) \
127 .rodata _vma_ : _lma_ \
128 { FORCE_OUTPUT; *(.rodata*) *(.gnu.linkonce.r.*) } \
131 #define SECTION_rodata1(_region_, _vma_, _lma_) \
132 .rodata1 _vma_ : _lma_ \
133 { FORCE_OUTPUT; *(.rodata1) } \
135 #define SECTION_extab(_region_, _vma_, _lma_) \
136 .extab _vma_ : _lma_ \
137 { FORCE_OUTPUT; *(.ARM.extab*) } \
139 #define SECTION_exidx(_region_, _vma_, _lma_) \
140 .exidx _vma_ : _lma_ \
141 { FORCE_OUTPUT; *(.ARM.exidx*) } \
143 #endif // CYGPRI_PID_BE_WORKAROUND
145 #define SECTION_fixup(_region_, _vma_, _lma_) \
146 .fixup _vma_ : _lma_ \
147 { FORCE_OUTPUT; *(.fixup) } \
150 #define SECTION_gcc_except_table(_region_, _vma_, _lma_) \
151 .gcc_except_table _vma_ : _lma_ \
152 { FORCE_OUTPUT; *(.gcc_except_table) } \
155 #define SECTION_eh_frame(_region_, _vma_, _lma_) \
156 .eh_frame _vma_ : _lma_ \
158 FORCE_OUTPUT; __EH_FRAME_BEGIN__ = .; \
164 #ifdef CYGBLD_ARM_EABI
165 #define __CTORS init_array
166 #define __DTORS fini_array
168 #define __CTORS ctors
169 #define __DTORS dtors
172 #define SECTION_RELOCS(_region_, _vma_, _lma_) \
177 *(.rel.gnu.linkonce.t*) \
183 *(.rela.gnu.linkonce.t*) \
189 *(.rel.gnu.linkonce.d*) \
195 *(.rela.gnu.linkonce.d*) \
201 *(.rel.gnu.linkonce.r*) \
207 *(.rela.gnu.linkonce.r*) \
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_
225 #define SECTION_got(_region_, _vma_, _lma_) \
228 FORCE_OUTPUT; *(.got.plt) *(.got) \
229 _GOT1_START_ = ABSOLUTE (.); *(.got1) _GOT1_END_ = ABSOLUTE (.); \
230 _GOT2_START_ = ABSOLUTE (.); *(.got2) _GOT2_END_ = ABSOLUTE (.); \
233 #define SECTION_mmu_tables(_region_, _vma_, _lma_) \
234 .mmu_tables _vma_ : _lma_ \
235 { FORCE_OUTPUT; *(.mmu_tables) } \
238 #define SECTION_sram(_region_, _vma_, _lma_) \
239 .sram _vma_ : _lma_ \
240 { FORCE_OUTPUT; *(.sram*) } \
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 \
248 KEEP(*( SORT (.ecos.table.*))) ; \
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.*) } \
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));
259 #define SECTION_bss(_region_, _vma_, _lma_) \
261 { __bss_start = ABSOLUTE (.); \
262 *(.scommon) *(.dynsbss) *(.sbss*) *(.gnu.linkonce.sb.*) \
263 *(.dynbss) *(.bss*) *(.gnu.linkonce.b.*) *(COMMON) \
264 __bss_end = ABSOLUTE (.); } \
267 #define SECTIONS_END . = ALIGN(4); _end = .; PROVIDE (end = .);
269 #include <pkgconf/hal_arm.h>
270 #include CYGHWR_MEMORY_LAYOUT_LDI