1 |
786 |
skrzyp |
//==========================================================================
|
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) 1998, 1999, 2000, 2001, 2002, 2005, 2009 Free Software Foundation, Inc.
|
12 |
|
|
//
|
13 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
14 |
|
|
// the terms of the GNU General Public License as published by the Free
|
15 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
16 |
|
|
// version.
|
17 |
|
|
//
|
18 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
19 |
|
|
// ANY 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
|
24 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
25 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
26 |
|
|
//
|
27 |
|
|
// As a special exception, if other files instantiate templates or use
|
28 |
|
|
// macros or inline functions from this file, or you compile this file
|
29 |
|
|
// and link it with other works to produce a work based on this file,
|
30 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
31 |
|
|
// the GNU General Public License. However the source code for this file
|
32 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
33 |
|
|
// General Public License v2.
|
34 |
|
|
//
|
35 |
|
|
// This exception does not invalidate any other reasons why a work based
|
36 |
|
|
// on this file might be covered by the GNU General Public License.
|
37 |
|
|
// -------------------------------------------
|
38 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
39 |
|
|
//==========================================================================
|
40 |
|
|
//#####DESCRIPTIONBEGIN####
|
41 |
|
|
//
|
42 |
|
|
// Author(s): jskov
|
43 |
|
|
// Contributors:jskov, bartv
|
44 |
|
|
// Date: 1999-01-18
|
45 |
|
|
// Purpose: synthetic target linker script
|
46 |
|
|
//
|
47 |
|
|
//####DESCRIPTIONEND####
|
48 |
|
|
//
|
49 |
|
|
//==========================================================================
|
50 |
|
|
STARTUP(vectors.o)
|
51 |
|
|
ENTRY(_start)
|
52 |
|
|
#ifdef EXTRAS
|
53 |
|
|
INPUT(extras.o)
|
54 |
|
|
#endif
|
55 |
|
|
#if (__GNUC__ >= 3)
|
56 |
|
|
GROUP(libtarget.a libgcc.a libsupc++.a libgcc_eh.a)
|
57 |
|
|
#else
|
58 |
|
|
GROUP(libtarget.a libgcc.a)
|
59 |
|
|
#endif
|
60 |
|
|
|
61 |
|
|
#define ALIGN_LMA 8
|
62 |
|
|
#define FOLLOWING(_section_) AT ((LOADADDR (_section_) + SIZEOF (_section_) + ALIGN_LMA - 1) & ~ (ALIGN_LMA - 1))
|
63 |
|
|
#define LMA_EQ_VMA
|
64 |
|
|
#define FORCE_OUTPUT . = .
|
65 |
|
|
|
66 |
|
|
|
67 |
|
|
#define SECTIONS_BEGIN
|
68 |
|
|
|
69 |
|
|
#define SECTION_vectors(_region_, _vma_, _lma_) \
|
70 |
|
|
.vectors _vma_ : _lma_ \
|
71 |
|
|
{ FORCE_OUTPUT; KEEP(*(.vectors)) } \
|
72 |
|
|
> _region_
|
73 |
|
|
|
74 |
|
|
#define SECTION_text(_region_, _vma_, _lma_) \
|
75 |
|
|
.text _vma_ : _lma_ \
|
76 |
|
|
{ _stext = .; \
|
77 |
|
|
*(.text*) *(.gnu.warning) *(.gnu.linkonce.t.*) *(.init) \
|
78 |
|
|
*(.note.gnu.build-id) \
|
79 |
|
|
} \
|
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(.); \
|
106 |
|
|
*(.gcc_except_table) \
|
107 |
|
|
*(.gcc_except_table.*) \
|
108 |
|
|
_EXCEPT_END_ = ABSOLUTE(.);} \
|
109 |
|
|
> _region_
|
110 |
|
|
|
111 |
|
|
#define SECTION_eh_frame(_region_, _vma_, _lma_) \
|
112 |
|
|
. = _vma_ ; \
|
113 |
|
|
. = ALIGN(ALIGN_LMA) ; \
|
114 |
|
|
.eh_frame_hdr . : _lma_ \
|
115 |
|
|
{ \
|
116 |
|
|
FORCE_OUTPUT; \
|
117 |
|
|
*(.eh_frame_hdr) \
|
118 |
|
|
} > _region_ = 0 \
|
119 |
|
|
. = ALIGN(ALIGN_LMA) ; \
|
120 |
|
|
.eh_frame . : FOLLOWING(.eh_frame_hdr) \
|
121 |
|
|
{ \
|
122 |
|
|
FORCE_OUTPUT; \
|
123 |
|
|
__EH_FRAME_BEGIN__ = .; \
|
124 |
|
|
KEEP(*(.eh_frame)) \
|
125 |
|
|
KEEP(*(.eh_frame*)) \
|
126 |
|
|
__EH_FRAME_END__ = .; \
|
127 |
|
|
. = ALIGN(4) ; \
|
128 |
|
|
. = . + 8; \
|
129 |
|
|
} > _region_ = 0
|
130 |
|
|
|
131 |
|
|
#define SECTION_RELOCS(_region_, _vma_, _lma_) \
|
132 |
|
|
.rel.text : \
|
133 |
|
|
{ \
|
134 |
|
|
*(.rel.text) \
|
135 |
|
|
*(.rel.text.*) \
|
136 |
|
|
*(.rel.gnu.linkonce.t*) \
|
137 |
|
|
} > _region_ \
|
138 |
|
|
.rela.text : \
|
139 |
|
|
{ \
|
140 |
|
|
*(.rela.text) \
|
141 |
|
|
*(.rela.text.*) \
|
142 |
|
|
*(.rela.gnu.linkonce.t*) \
|
143 |
|
|
} > _region_ \
|
144 |
|
|
.rel.data : \
|
145 |
|
|
{ \
|
146 |
|
|
*(.rel.data) \
|
147 |
|
|
*(.rel.data.*) \
|
148 |
|
|
*(.rel.gnu.linkonce.d*) \
|
149 |
|
|
} > _region_ \
|
150 |
|
|
.rela.data : \
|
151 |
|
|
{ \
|
152 |
|
|
*(.rela.data) \
|
153 |
|
|
*(.rela.data.*) \
|
154 |
|
|
*(.rela.gnu.linkonce.d*) \
|
155 |
|
|
} > _region_ \
|
156 |
|
|
.rel.rodata : \
|
157 |
|
|
{ \
|
158 |
|
|
*(.rel.rodata) \
|
159 |
|
|
*(.rel.rodata.*) \
|
160 |
|
|
*(.rel.gnu.linkonce.r*) \
|
161 |
|
|
} > _region_ \
|
162 |
|
|
.rela.rodata : \
|
163 |
|
|
{ \
|
164 |
|
|
*(.rela.rodata) \
|
165 |
|
|
*(.rela.rodata.*) \
|
166 |
|
|
*(.rela.gnu.linkonce.r*) \
|
167 |
|
|
} > _region_ \
|
168 |
|
|
.rel.got : { *(.rel.got) } > _region_ \
|
169 |
|
|
.rela.got : { *(.rela.got) } > _region_ \
|
170 |
|
|
.rel.ctors : { *(.rel.ctors) } > _region_ \
|
171 |
|
|
.rela.ctors : { *(.rela.ctors) } > _region_ \
|
172 |
|
|
.rel.dtors : { *(.rel.dtors) } > _region_ \
|
173 |
|
|
.rela.dtors : { *(.rela.dtors) } > _region_ \
|
174 |
|
|
.rel.init : { *(.rel.init) } > _region_ \
|
175 |
|
|
.rela.init : { *(.rela.init) } > _region_ \
|
176 |
|
|
.rel.fini : { *(.rel.fini) } > _region_ \
|
177 |
|
|
.rela.fini : { *(.rela.fini) } > _region_ \
|
178 |
|
|
.rel.bss : { *(.rel.bss) } > _region_ \
|
179 |
|
|
.rela.bss : { *(.rela.bss) } > _region_ \
|
180 |
|
|
.rel.plt : { *(.rel.plt) } > _region_ \
|
181 |
|
|
.rela.plt : { *(.rela.plt) } > _region_ \
|
182 |
|
|
.rel.dyn : { *(.rel.dyn) } > _region_
|
183 |
|
|
|
184 |
|
|
// Note: The __ in the name is an encoding of the .
|
185 |
|
|
#define SECTION_rel__got(_region_, _vma_, _lma_) \
|
186 |
|
|
.rel.got _vma_ : _lma_ \
|
187 |
|
|
{ *(.rel.got) } \
|
188 |
|
|
> _region_
|
189 |
|
|
|
190 |
|
|
#define SECTION_data(_region_, _vma_, _lma_) \
|
191 |
|
|
.data _vma_ : _lma_ \
|
192 |
|
|
{ __ram_data_start = ABSOLUTE(.); *(.data*) *(.gnu.linkonce.d.*) \
|
193 |
|
|
_GOT1_START_ = ABSOLUTE(.); *(.got1) _GOT1_END_ = ABSOLUTE(.); \
|
194 |
|
|
/* Put .ctors and .dtors next to the .got2 section, so that */ \
|
195 |
|
|
/* the pointers get relocated with -mrelocatable. */ \
|
196 |
|
|
. = ALIGN(8); __CTOR_LIST__ = ABSOLUTE(.); \
|
197 |
|
|
KEEP(*(SORT(.ctors*))) __CTOR_END__ = ABSOLUTE(.); \
|
198 |
|
|
__DTOR_LIST__ = ABSOLUTE(.); \
|
199 |
|
|
KEEP(*(SORT(.dtors*))) __DTOR_END__ = ABSOLUTE(.); \
|
200 |
|
|
. = ALIGN(32); \
|
201 |
|
|
KEEP(*( SORT (.ecos.table.*))); \
|
202 |
|
|
_GOT2_START_ = ABSOLUTE(.); *(.got2) _GOT2_END_ = ABSOLUTE(.); \
|
203 |
|
|
_GOT_START_ = ABSOLUTE(.); _GLOBAL_OFFSET_TABLE_ = ABSOLUTE(. + 32768); \
|
204 |
|
|
_SDA_BASE_ = ABSOLUTE(.); *(.got.plt) *(.got) \
|
205 |
|
|
_GOT_END_ = ABSOLUTE(.); *(.dynamic) \
|
206 |
|
|
/* We want the small data sections together, so single-instruction */ \
|
207 |
|
|
/* offsets can access them all, and initialized data all before */ \
|
208 |
|
|
/* uninitialized, so we can shorten the on-disk segment size. */ \
|
209 |
|
|
_SDATA_START_ = ABSOLUTE(.); *(.sdata*) *(.gnu.linkonce.s.*) } \
|
210 |
|
|
> _region_ \
|
211 |
|
|
__rom_data_start = LOADADDR(.data); \
|
212 |
|
|
__ram_data_end = .; PROVIDE(__ram_data_end = .); \
|
213 |
|
|
_edata = .; PROVIDE (edata = .);
|
214 |
|
|
|
215 |
|
|
#define SECTION_sbss(_region_, _vma_, _lma_) \
|
216 |
|
|
.sbss _vma_ : _lma_ \
|
217 |
|
|
{ __bss_start = ABSOLUTE (.); \
|
218 |
|
|
_SBSS_START_ = ABSOLUTE(.); *(.sbss*) *(.gnu.linkonce.sb.*) \
|
219 |
|
|
_SBSS_END_ = ABSOLUTE(.); \
|
220 |
|
|
*(.scommon*) } \
|
221 |
|
|
> _region_
|
222 |
|
|
|
223 |
|
|
#define SECTION_bss(_region_, _vma_, _lma_) \
|
224 |
|
|
.bss _vma_ : _lma_ \
|
225 |
|
|
{ FORCE_OUTPUT; *(.dynbss*) *(.bss*) *(COMMON) *(.gnu.linkonce.b.*) } \
|
226 |
|
|
> _region_ \
|
227 |
|
|
__bss_end = .;
|
228 |
|
|
|
229 |
|
|
#define SECTIONS_HEAP(_region_, _start_, _end_) \
|
230 |
|
|
.synth_heap _start_ : \
|
231 |
|
|
{ FORCE_OUTPUT; . = _end_ - _start_ ; } \
|
232 |
|
|
> _region_
|
233 |
|
|
|
234 |
|
|
#define SECTIONS_END . = ALIGN(4); _end = .; PROVIDE (end = .);
|
235 |
|
|
|
236 |
|
|
#include
|
237 |
|
|
#include CYGHWR_MEMORY_LAYOUT_LDI
|