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>
46 GROUP(libtarget.a libgcc.a libsupc++.a)
48 GROUP(libtarget.a libgcc.a)
51 #if defined(__ARMEB__)
52 OUTPUT_FORMAT(elf32-bigarm)
55 #if defined(CYG_HAL_STARTUP_ROM) \
56 && defined(CYGPKG_HAL_ARM_PID) \
58 // Note: This is only needed when the PID board is used in BE mode without
59 // the proper ROM controller part.
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
67 #define MERGE_IN_RODATA *(.rodata*)
68 #define CYGPRI_PID_BE_WORKAROUND
70 // Keep RODATA in separate sections.
71 #define MERGE_IN_RODATA
72 #undef CYGPRI_PID_BE_WORKAROUND
76 #define FOLLOWING(_section_) AT ((LOADADDR (_section_) + SIZEOF (_section_) + ALIGN_LMA - 1) & ~ (ALIGN_LMA - 1))
78 #define FORCE_OUTPUT . = .
80 // Some versions of gcc define "arm" which causes problems with .note.arm.ident
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)) }
95 #define SECTION_fixed_vectors(_region_, _vma_, _lma_) \
96 .fixed_vectors _vma_ : _lma_ \
97 { FORCE_OUTPUT; KEEP (*(.fixed_vectors)) } \
100 #define SECTION_rom_vectors(_region_, _vma_, _lma_) \
101 .rom_vectors _vma_ : _lma_ \
102 { __rom_vectors_vma = ABSOLUTE(.); \
103 FORCE_OUTPUT; KEEP (*(.vectors)) } \
105 __rom_vectors_lma = LOADADDR(.rom_vectors);
107 #define SECTION_text(_region_, _vma_, _lma_) \
108 .text _vma_ : _lma_ \
109 { _stext = ABSOLUTE(.); \
110 PROVIDE (__stext = ABSOLUTE(.)); \
111 *(.text*) *(.gnu.warning) *(.gnu.linkonce.t.*) *(.init) \
112 *(.glue_7) *(.glue_7t) \
114 _etext = .; PROVIDE (__etext = .);
116 #define SECTION_fini(_region_, _vma_, _lma_) \
117 .fini _vma_ : _lma_ \
118 { FORCE_OUTPUT; *(.fini) } \
121 #if defined(CYGPRI_PID_BE_WORKAROUND)
122 #define SECTION_rodata(_region_, _vma_, _lma_)
123 #define SECTION_rodata1(_region_, _vma_, _lma_)
125 #define SECTION_rodata(_region_, _vma_, _lma_) \
126 .rodata _vma_ : _lma_ \
127 { FORCE_OUTPUT; *(.rodata*) *(.gnu.linkonce.r.*) } \
130 #define SECTION_rodata1(_region_, _vma_, _lma_) \
131 .rodata1 _vma_ : _lma_ \
132 { FORCE_OUTPUT; *(.rodata1) } \
134 #endif // CYGPRI_PID_BE_WORKAROUND
136 #define SECTION_fixup(_region_, _vma_, _lma_) \
137 .fixup _vma_ : _lma_ \
138 { FORCE_OUTPUT; *(.fixup) } \
141 #define SECTION_gcc_except_table(_region_, _vma_, _lma_) \
142 .gcc_except_table _vma_ : _lma_ \
143 { FORCE_OUTPUT; *(.gcc_except_table) } \
146 #define SECTION_eh_frame(_region_, _vma_, _lma_) \
147 .eh_frame _vma_ : _lma_ \
149 FORCE_OUTPUT; __EH_FRAME_BEGIN__ = .; \
155 #define SECTION_RELOCS(_region_, _vma_, _lma_) \
160 *(.rel.gnu.linkonce.t*) \
166 *(.rela.gnu.linkonce.t*) \
172 *(.rel.gnu.linkonce.d*) \
178 *(.rela.gnu.linkonce.d*) \
184 *(.rel.gnu.linkonce.r*) \
190 *(.rela.gnu.linkonce.r*) \
192 .rel.got : { *(.rel.got) } > _region_ \
193 .rela.got : { *(.rela.got) } > _region_ \
194 .rel.ctors : { *(.rel.ctors) } > _region_ \
195 .rela.ctors : { *(.rela.ctors) } > _region_ \
196 .rel.dtors : { *(.rel.dtors) } > _region_ \
197 .rela.dtors : { *(.rela.dtors) } > _region_ \
198 .rel.init : { *(.rel.init) } > _region_ \
199 .rela.init : { *(.rela.init) } > _region_ \
200 .rel.fini : { *(.rel.fini) } > _region_ \
201 .rela.fini : { *(.rela.fini) } > _region_ \
202 .rel.bss : { *(.rel.bss) } > _region_ \
203 .rela.bss : { *(.rela.bss) } > _region_ \
204 .rel.plt : { *(.rel.plt) } > _region_ \
205 .rela.plt : { *(.rela.plt) } > _region_ \
206 .rel.dyn : { *(.rel.dyn) } > _region_
208 #define SECTION_got(_region_, _vma_, _lma_) \
211 FORCE_OUTPUT; *(.got.plt) *(.got) \
212 _GOT1_START_ = ABSOLUTE (.); *(.got1) _GOT1_END_ = ABSOLUTE (.); \
213 _GOT2_START_ = ABSOLUTE (.); *(.got2) _GOT2_END_ = ABSOLUTE (.); \
216 #define SECTION_mmu_tables(_region_, _vma_, _lma_) \
217 .mmu_tables _vma_ : _lma_ \
218 { FORCE_OUTPUT; *(.mmu_tables) } \
221 #define SECTION_sram(_region_, _vma_, _lma_) \
222 .sram _vma_ : _lma_ \
223 { FORCE_OUTPUT; *(.sram*) } \
226 #define SECTION_data(_region_, _vma_, _lma_) \
227 .data _vma_ : _lma_ \
228 { __ram_data_start = ABSOLUTE (.); \
229 *(.data*) *(.data1) *(.gnu.linkonce.d.*) MERGE_IN_RODATA \
231 KEEP(*( SORT (.ecos.table.*))) ; \
233 __CTOR_LIST__ = ABSOLUTE (.); KEEP (*(SORT (.ctors*))) __CTOR_END__ = ABSOLUTE (.); \
234 __DTOR_LIST__ = ABSOLUTE (.); KEEP (*(SORT (.dtors*))) __DTOR_END__ = ABSOLUTE (.); \
235 *(.dynamic) *(.sdata*) *(.gnu.linkonce.s.*) \
236 . = ALIGN (4); *(.2ram.*) } \
238 __rom_data_start = LOADADDR (.data); \
239 __ram_data_end = .; PROVIDE (__ram_data_end = .); _edata = .; PROVIDE (edata = .); \
240 PROVIDE (__rom_data_end = LOADADDR (.data) + SIZEOF(.data));
242 #define SECTION_bss(_region_, _vma_, _lma_) \
244 { __bss_start = ABSOLUTE (.); \
245 *(.scommon) *(.dynsbss) *(.sbss*) *(.gnu.linkonce.sb.*) \
246 *(.dynbss) *(.bss*) *(.gnu.linkonce.b.*) *(COMMON) \
247 __bss_end = ABSOLUTE (.); } \
250 #define SECTIONS_END . = ALIGN(4); _end = .; PROVIDE (end = .);
252 #include <pkgconf/hal_arm.h>
253 #include CYGHWR_MEMORY_LAYOUT_LDI