1 |
27 |
unneback |
/*==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// sh.ld
|
4 |
|
|
//
|
5 |
|
|
// Linker script for SH
|
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 Red Hat, 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 version.
|
16 |
|
|
//
|
17 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
18 |
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
19 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
20 |
|
|
// for more details.
|
21 |
|
|
//
|
22 |
|
|
// You should have received a copy of the GNU General Public License along
|
23 |
|
|
// with eCos; if not, write to the Free Software Foundation, Inc.,
|
24 |
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
25 |
|
|
//
|
26 |
|
|
// As a special exception, if other files instantiate templates or use macros
|
27 |
|
|
// or inline functions from this file, or you compile this file and link it
|
28 |
|
|
// with other works to produce a work based on this file, this file does not
|
29 |
|
|
// by itself cause the resulting work to be covered by the GNU General Public
|
30 |
|
|
// License. However the source code for this file must still be made available
|
31 |
|
|
// in accordance with section (3) of the GNU General Public License.
|
32 |
|
|
//
|
33 |
|
|
// This exception does not invalidate any other reasons why a work based on
|
34 |
|
|
// this file might be covered by the GNU General Public License.
|
35 |
|
|
//
|
36 |
|
|
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
37 |
|
|
// at http://sources.redhat.com/ecos/ecos-license/
|
38 |
|
|
// -------------------------------------------
|
39 |
|
|
//####ECOSGPLCOPYRIGHTEND####
|
40 |
|
|
//==========================================================================
|
41 |
|
|
//#####DESCRIPTIONBEGIN####
|
42 |
|
|
//
|
43 |
|
|
// Author(s): jskov
|
44 |
|
|
// Contributors:jskov
|
45 |
|
|
// Date: 1999-04-24
|
46 |
|
|
// Purpose: SH Linker script
|
47 |
|
|
//
|
48 |
|
|
//####DESCRIPTIONEND####
|
49 |
|
|
//
|
50 |
|
|
//========================================================================*/
|
51 |
|
|
|
52 |
|
|
#include
|
53 |
|
|
#include
|
54 |
|
|
|
55 |
|
|
STARTUP(vectors.o)
|
56 |
|
|
ENTRY(CYG_LABEL_DEFN(_reset))
|
57 |
|
|
INPUT(extras.o)
|
58 |
|
|
#if (__GNUC__ >= 3)
|
59 |
|
|
GROUP(libtarget.a libgcc.a libsupc++.a)
|
60 |
|
|
#else
|
61 |
|
|
GROUP(libtarget.a libgcc.a)
|
62 |
|
|
#endif
|
63 |
|
|
|
64 |
|
|
#define ALIGN_LMA 16
|
65 |
|
|
#define FOLLOWING(_section_) AT ((LOADADDR (_section_) + SIZEOF (_section_) + ALIGN_LMA - 1) & ~ (ALIGN_LMA - 1))
|
66 |
|
|
#define LMA_EQ_VMA
|
67 |
|
|
#define FORCE_OUTPUT . = .
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
# define SECTIONS_BEGIN
|
71 |
|
|
|
72 |
|
|
# define SECTION_vectors(_region_, _vma_, _lma_) \
|
73 |
|
|
.vectors _vma_ : _lma_ \
|
74 |
|
|
{ FORCE_OUTPUT; KEEP(*(.vectors)) \
|
75 |
|
|
} \
|
76 |
|
|
> _region_ \
|
77 |
|
|
CYG_LABEL_DEFN(_vector_code_lma) = LOADADDR(.vectors);
|
78 |
|
|
|
79 |
|
|
# define SECTION_text(_region_, _vma_, _lma_) \
|
80 |
|
|
.text _vma_ : _lma_ \
|
81 |
|
|
{ CYG_LABEL_DEFN(_stext) = .; \
|
82 |
|
|
*(.text*) *(.gnu.warning) *(.gnu.linkonce*) *(.init) } \
|
83 |
|
|
> _region_ \
|
84 |
|
|
CYG_LABEL_DEFN(_etext) = .; PROVIDE (__etext = .);
|
85 |
|
|
|
86 |
|
|
# define SECTION_data(_region_, _vma_, _lma_) \
|
87 |
|
|
.data _vma_ : _lma_ \
|
88 |
|
|
{ CYG_LABEL_DEFN(_ram_data_start) = ABSOLUTE(.); *(.data*) \
|
89 |
|
|
*( .2ram.*) ; \
|
90 |
|
|
. = ALIGN(8); CYG_LABEL_DEFN(__CTOR_LIST__) = ABSOLUTE(.); \
|
91 |
|
|
KEEP(*(SORT(.ctors*))) CYG_LABEL_DEFN(__CTOR_END__) = ABSOLUTE(.); \
|
92 |
|
|
CYG_LABEL_DEFN(__DTOR_LIST__) = ABSOLUTE(.); \
|
93 |
|
|
KEEP(*(SORT(.dtors*))) CYG_LABEL_DEFN(__DTOR_END__) = ABSOLUTE(.); \
|
94 |
|
|
. = ALIGN(8); \
|
95 |
|
|
KEEP(*( SORT (.ecos.table.*))) ; \
|
96 |
|
|
. = ALIGN(4); \
|
97 |
|
|
*(.stack) \
|
98 |
|
|
} > _region_ \
|
99 |
|
|
CYG_LABEL_DEFN(_rom_data_start) = LOADADDR(.data); \
|
100 |
|
|
CYG_LABEL_DEFN(_ram_data_end) = .; PROVIDE(_ram_data_end = .); \
|
101 |
|
|
CYG_LABEL_DEFN(edata) = .; PROVIDE (edata = .);
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
#define SECTION_eh_frame(_region_, _vma_, _lma_) \
|
105 |
|
|
.eh_frame _vma_ : _lma_ \
|
106 |
|
|
{ \
|
107 |
|
|
FORCE_OUTPUT; __EH_FRAME_BEGIN__ = .; \
|
108 |
|
|
KEEP(*(.eh_frame)) \
|
109 |
|
|
__FRAME_END__ = .; \
|
110 |
|
|
. = . + 8; \
|
111 |
|
|
} > _region_ = 0
|
112 |
|
|
|
113 |
|
|
#define SECTION_RELOCS(_region_, _vma_, _lma_) \
|
114 |
|
|
.rel.text : \
|
115 |
|
|
{ \
|
116 |
|
|
*(.rel.text) \
|
117 |
|
|
*(.rel.text.*) \
|
118 |
|
|
*(.rel.gnu.linkonce.t*) \
|
119 |
|
|
} > _region_ \
|
120 |
|
|
.rela.text : \
|
121 |
|
|
{ \
|
122 |
|
|
*(.rela.text) \
|
123 |
|
|
*(.rela.text.*) \
|
124 |
|
|
*(.rela.gnu.linkonce.t*) \
|
125 |
|
|
} > _region_ \
|
126 |
|
|
.rel.data : \
|
127 |
|
|
{ \
|
128 |
|
|
*(.rel.data) \
|
129 |
|
|
*(.rel.data.*) \
|
130 |
|
|
*(.rel.gnu.linkonce.d*) \
|
131 |
|
|
} > _region_ \
|
132 |
|
|
.rela.data : \
|
133 |
|
|
{ \
|
134 |
|
|
*(.rela.data) \
|
135 |
|
|
*(.rela.data.*) \
|
136 |
|
|
*(.rela.gnu.linkonce.d*) \
|
137 |
|
|
} > _region_ \
|
138 |
|
|
.rel.rodata : \
|
139 |
|
|
{ \
|
140 |
|
|
*(.rel.rodata) \
|
141 |
|
|
*(.rel.rodata.*) \
|
142 |
|
|
*(.rel.gnu.linkonce.r*) \
|
143 |
|
|
} > _region_ \
|
144 |
|
|
.rela.rodata : \
|
145 |
|
|
{ \
|
146 |
|
|
*(.rela.rodata) \
|
147 |
|
|
*(.rela.rodata.*) \
|
148 |
|
|
*(.rela.gnu.linkonce.r*) \
|
149 |
|
|
} > _region_ \
|
150 |
|
|
.rel.got : { *(.rel.got) } > _region_ \
|
151 |
|
|
.rela.got : { *(.rela.got) } > _region_ \
|
152 |
|
|
.rel.ctors : { *(.rel.ctors) } > _region_ \
|
153 |
|
|
.rela.ctors : { *(.rela.ctors) } > _region_ \
|
154 |
|
|
.rel.dtors : { *(.rel.dtors) } > _region_ \
|
155 |
|
|
.rela.dtors : { *(.rela.dtors) } > _region_ \
|
156 |
|
|
.rel.init : { *(.rel.init) } > _region_ \
|
157 |
|
|
.rela.init : { *(.rela.init) } > _region_ \
|
158 |
|
|
.rel.fini : { *(.rel.fini) } > _region_ \
|
159 |
|
|
.rela.fini : { *(.rela.fini) } > _region_ \
|
160 |
|
|
.rel.bss : { *(.rel.bss) } > _region_ \
|
161 |
|
|
.rela.bss : { *(.rela.bss) } > _region_ \
|
162 |
|
|
.rel.plt : { *(.rel.plt) } > _region_ \
|
163 |
|
|
.rela.plt : { *(.rela.plt) } > _region_ \
|
164 |
|
|
.rel.dyn : { *(.rel.dyn) } > _region_
|
165 |
|
|
|
166 |
|
|
#define SECTION_got(_region_, _vma_, _lma_) \
|
167 |
|
|
.got _vma_ : _lma_ \
|
168 |
|
|
{ \
|
169 |
|
|
FORCE_OUTPUT; *(.got.plt) *(.got) \
|
170 |
|
|
} > _region_
|
171 |
|
|
|
172 |
|
|
#define SECTION_fini(_region_, _vma_, _lma_) \
|
173 |
|
|
.fini _vma_ : _lma_ \
|
174 |
|
|
{ FORCE_OUTPUT; *(.fini) } \
|
175 |
|
|
> _region_
|
176 |
|
|
|
177 |
|
|
#define SECTION_rodata1(_region_, _vma_, _lma_) \
|
178 |
|
|
.rodata1 _vma_ : _lma_ \
|
179 |
|
|
{ FORCE_OUTPUT; *(.rodata1) } \
|
180 |
|
|
> _region_
|
181 |
|
|
|
182 |
|
|
#define SECTION_rodata(_region_, _vma_, _lma_) \
|
183 |
|
|
.rodata _vma_ : _lma_ \
|
184 |
|
|
{ FORCE_OUTPUT; *(.rodata*) } \
|
185 |
|
|
> _region_
|
186 |
|
|
|
187 |
|
|
#define SECTION_fixup(_region_, _vma_, _lma_) \
|
188 |
|
|
.fixup _vma_ : _lma_ \
|
189 |
|
|
{ __FIXUP_START__ = ABSOLUTE(.); *(.fixup) __FIXUP_END__ = ABSOLUTE(.);} \
|
190 |
|
|
> _region_
|
191 |
|
|
|
192 |
|
|
#define SECTION_gcc_except_table(_region_, _vma_, _lma_) \
|
193 |
|
|
.gcc_except_table _vma_ : _lma_ \
|
194 |
|
|
{ __EXCEPT_START__ = ABSOLUTE(.); *(.gcc_except_table) \
|
195 |
|
|
__EXCEPT_END__ = ABSOLUTE(.);} \
|
196 |
|
|
> _region_
|
197 |
|
|
|
198 |
|
|
#define SECTION_bss(_region_, _vma_, _lma_) \
|
199 |
|
|
.bss _vma_ : _lma_ \
|
200 |
|
|
{ CYG_LABEL_DEFN(_bss_start) = ABSOLUTE (.); \
|
201 |
|
|
FORCE_OUTPUT; *(.dynbss) *(.bss) *(COMMON) \
|
202 |
|
|
. = ALIGN(4); \
|
203 |
|
|
CYG_LABEL_DEFN(_bss_end) = ABSOLUTE (.); } \
|
204 |
|
|
> _region_
|
205 |
|
|
|
206 |
|
|
#define SECTIONS_END . = ALIGN(4); CYG_LABEL_DEFN(end) = .; PROVIDE (end = .);
|
207 |
|
|
|
208 |
|
|
#include
|
209 |
|
|
#include CYGHWR_MEMORY_LAYOUT_LDI
|
210 |
|
|
#include CYGBLD_HAL_PLATFORM_H
|
211 |
|
|
|
212 |
|
|
// Define VSR and vector tables to reside at fixed address.
|
213 |
|
|
CYG_LABEL_DEFN(hal_vsr_table) = CYGHWR_HAL_VSR_TABLE;
|
214 |
|
|
CYG_LABEL_DEFN(hal_virtual_vector_table) = CYGHWR_HAL_VECTOR_TABLE;
|