OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [m68k/] [arch/] [current/] [src/] [m68k.ld] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
/*==========================================================================
2
//
3
//      m68k.ld
4
//
5
//      Linker script
6
//
7
//==========================================================================
8
// ####ECOSGPLCOPYRIGHTBEGIN####
9
// -------------------------------------------
10
// This file is part of eCos, the Embedded Configurable Operating System.
11
// Copyright (C) 2003, 2004, 2005, 2006, 2008 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):     bartv
43
// Date:          2003-06-04
44
//
45
//###DESCRIPTIONEND####
46
//========================================================================
47
*/
48
 
49
#include 
50
#include 
51
#define __LDI__ 1
52
#include CYGHWR_MEMORY_LAYOUT_H
53
 
54
STARTUP(vectors.o)
55
ENTRY(hal_m68k_exception_reset)
56
#ifdef EXTRAS
57
INPUT(extras.o)
58
#endif
59
GROUP(libtarget.a libgcc.a libsupc++.a)
60
 
61
#define ALIGN_LMA 4
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
#ifndef CYG_LABEL_DEFN
67
# define CYG_LABEL_DEFN(_label) _label
68
#endif
69
 
70
// Depending on the startup type and issues such as the memory map
71
// before and after any remapping, _stext should usually be defined
72
// either at the beginning of the .m68k_startup section or at the
73
// beginning of the .text section. Or conceivably somewhere else, in
74
// which case it is up to the platform-specific linker script or
75
// code to define _stext. The platform HAL can specify the desired
76
// behaviour via the LAYOUT_H file.
77
#if defined(_HAL_M68K_STEXT_AT_M68K_TEXT_)
78
# define _HAL_M68K_STARTUP_SECTION_STEXT_
79
# define _HAL_TEXT_SECTION_STEXT_           _stext = . ;
80
#elif defined(_HAL_M68K_STEXT_ELSEWHERE_)
81
# define _HAL_M68K_STARTUP_SECTION_STEXT_
82
# define _HAL_TEXT_SECTION_STEXT_
83
#else
84
# define _HAL_M68K_STARTUP_SECTION_STEXT_   _stext = . ;
85
# define _HAL_TEXT_SECTION_STEXT_
86
#endif
87
 
88
#define SECTIONS_BEGIN
89
 
90
// RAM vectors, i.e. the M68K exception table, the virtual vector table,
91
// and possibly some data that needs to be shared between eCos and
92
// RedBoot. Usually this will be located at 0 but may be at another
93
// address via e.g. %vbr. Some platforms in some configurations may
94
// have an empty ram vectors section with all the work done in
95
// .vectors instead. The section may or may not be loadable.
96
 
97
#define SECTION_ram_vectors(_region_, _vma_)                            \
98
    . = ALIGN( _vma_ , ALIGN_LMA ) ;                                    \
99
    _hal_ram_vectors_section_start = . ;                                \
100
    .ram_vectors . : { KEEP (*(.ram_vectors)) } > _region_              \
101
    . = ALIGN(ALIGN_LMA) ;                                              \
102
    _hal_ram_vectors_section_end = . ;                                  \
103
    _hal_ram_vectors_section_size    = _hal_ram_vectors_section_end -   \
104
                                       _hal_ram_vectors_section_start ;
105
 
106
// .m68k_startup usually contains only the M68K startup code. It may also
107
// contain the exception vectors if booting from flash and the exception
108
// vectors are held in flash as well. .vectors.0 is for backwards
109
// compatibility with older HALs.
110
#define SECTION_m68k_start(_region_, _vma_)                                                             \
111
    . = ALIGN( _vma_ , ALIGN_LMA ) ;                                                                    \
112
    _hal_m68k_start_section_start = . ;                                                                 \
113
    _HAL_M68K_STARTUP_SECTION_STEXT_                                                                    \
114
    .m68k_start . : { KEEP (*(.m68k_start)) KEEP (*(.m68k_start.*)) KEEP (*(.vectors.0)) } > _region_   \
115
    . = ALIGN(ALIGN_LMA) ;                                                                              \
116
    _hal_m68k_start_section_end = . ;                                                                   \
117
    _hal_m68k_start_section_size    = _hal_m68k_start_section_end - _hal_m68k_start_section_start ;
118
 
119
// Some coldfires booting from internal flash need a signature block at
120
// a magic location
121
#define SECTION_mcfxxxx_cfm_security_settings(_region_, _vma_)                                          \
122
    . = ALIGN( _vma_ , ALIGN_LMA ) ;                                                                    \
123
    _hal_mcfxxxx_cfm_security_settings_section_start = . ;                                              \
124
    .mcfxxxx_cfm_security_settings . :                                                                  \
125
    {                                                                                                   \
126
        FORCE_OUTPUT;                                                                                   \
127
        KEEP (*(.mcfxxxx_cfm_security_settings));                                                       \
128
    } > _region_                                                                                        \
129
    . = ALIGN(ALIGN_LMA) ;                                                                              \
130
    _hal_mcfxxxx_cfm_security_settings_section_end  = . ;                                               \
131
    _hal_mcfxxxx_cfm_security_settings_section_size = _hal_mcfxxxx_cfm_security_settings_section_end -  \
132
                                                      _hal_mcfxxxx_cfm_security_settings_section_start ;
133
 
134
// ----------------------------------------------------------------------------
135
// C++ support. It should always be possible to discard the global destructors
136
// since eCos applications are not expected to exit. The exception handling
137
// support is normally needed only if linking with libstdc++, otherwise
138
// there is no code in the system to use the exception frame info.
139
#if defined(CYGINT_HAL_LINKER_SCRIPT_KEEP_DTORS)
140
# define _DTORS1_                                                       \
141
        __DTOR_LIST__ = ABSOLUTE(.);                                    \
142
        KEEP(*(SORT(.dtors*)))                                          \
143
        __DTOR_END__ = ABSOLUTE(.);                                     \
144
# define _DTORS2_
145
#else
146
# define _DTORS1_
147
# define _DTORS2_           /DISCARD/ : { *(.dtors*) }
148
#endif
149
 
150
#if defined(CYGPKG_LIBSTDCXX) || defined(CYGINT_HAL_LINKER_SCRIPT_KEEP_EH_FRAME)
151
# define _EH_FRAME1_(_region_)                                          \
152
    .eh_frame . : {                                                     \
153
       FORCE_OUTPUT;  __EH_FRAME_BEGIN__ = ABSOLUTE(.);                 \
154
       KEEP(*(.eh_frame))                                               \
155
       . = ALIGN(ALIGN_LMA);                                            \
156
       __FRAME_END__ = ABSOLUTE(.);                                     \
157
       LONG(0)                                                          \
158
       LONG(0)                                                          \
159
    } > _region_ = 0
160
# define _EH_FRAME2_
161
#else
162
# define _EH_FRAME1_(_region_)
163
# define _EH_FRAME2_ /DISCARD/ : { *(.eh_frame) }
164
#endif
165
 
166
#if defined(CYGPKG_LIBSTDCXX) || defined(CYGINT_HAL_LINKER_SCRIPT_KEEP_GCC_EXCEPT_TABLE)
167
# define _GCC_EXCEPT_TABLE1_(_region_)                                  \
168
    .gcc_except_table . : {                                             \
169
        __EXCEPT_START__ = ABSOLUTE(.);                                 \
170
        KEEP(*(.gcc_except_table)) *(.gcc_except_table.*)               \
171
      __EXCEPT_END__ = ABSOLUTE(.);                                     \
172
    } > _region_
173
# define _GCC_EXCEPT_TABLE2_
174
#else
175
# define _GCC_EXCEPT_TABLE1_(_region_)
176
# define _GCC_EXCEPT_TABLE2_ /DISCARD/ : { *(.gcc_except_table) *(.gcc_except_table.*) }
177
#endif
178
 
179
#define SECTION_code(_region_, _vma_)                                                           \
180
    . = ALIGN( _vma_ , ALIGN_LMA ) ;                                                            \
181
    _hal_code_section_start = . ;                                                               \
182
    _hal_text_section_start = . ;                                                               \
183
    _HAL_TEXT_SECTION_STEXT_                                                                    \
184
    .text . : {                                                                                 \
185
        *(.text*) *(.gnu.warning) *(.gnu.linkonce.t*) *(.init)                                  \
186
        . = ALIGN (4);                                                                          \
187
        __CTOR_LIST__ = ABSOLUTE(.);                                                            \
188
        KEEP(*(SORT(.ctors*)));                                                                 \
189
        __CTOR_END__ = ABSOLUTE(.);                                                             \
190
        . = ALIGN (4);                                                                          \
191
        _DTORS1_                                                                                \
192
    } > _region_                                                                                \
193
    . = ALIGN(ALIGN_LMA) ;                                                                      \
194
    _etext = . ;  PROVIDE (etext = .) ;                                                         \
195
    _hal_text_section_end   = . ;                                                               \
196
    _hal_text_section_size  = _hal_text_section_end - _hal_text_section_start ;                 \
197
    .rodata . : { *(.rodata1) *(.rodata*) *(.gnu.linkonce.r.*) } > _region_                     \
198
    . = ALIGN(ALIGN_LMA) ;                                                                      \
199
    _EH_FRAME1_(_region_)                                                                       \
200
    . = ALIGN(ALIGN_LMA) ;                                                                      \
201
    _GCC_EXCEPT_TABLE1_(_region_)                                                               \
202
    . = ALIGN(ALIGN_LMA) ;                                                                      \
203
    .rel.text    : { *(.rel.text)    *(.rel.text.*)    *(.rel.gnu.linkonce.t*) } > _region_     \
204
    .rela.text   : { *(.rela.text)   *(.rela.text.*)   *(.rela.gnu.linkonce.t*) } > _region_    \
205
    .rel.data    : { *(.rel.data)    *(.rel.data.*)    *(.rel.gnu.linkonce.d*) } > _region_     \
206
    .rela.data   : { *(.rela.data)   *(.rela.data.*)   *(.rela.gnu.linkonce.d*) } > _region_    \
207
    .rel.rodata  : { *(.rel.rodata)  *(.rel.rodata.*)  *(.rel.gnu.linkonce.r*) } > _region_     \
208
    .rela.rodata : { *(.rela.rodata) *(.rela.rodata.*) *(.rela.gnu.linkonce.r*) } > _region_    \
209
    .rel.got       :   { *(.rel.got)    } > _region_                                            \
210
    .fixup . : {                                                                                \
211
        __FIXUP_START__ = ABSOLUTE(.);                                                          \
212
        *(.fixup)                                                                               \
213
        __FIXUP_END__ = ABSOLUTE(.);                                                            \
214
    } > _region_                                                                                \
215
    .got . : {                                                                                  \
216
        FORCE_OUTPUT; *(.got.plt) *(.got)                                                       \
217
        _GOT1_START_ = ABSOLUTE (.); *(.got1) _GOT1_END_ = ABSOLUTE (.);                        \
218
        _GOT2_START_ = ABSOLUTE (.); *(.got2) _GOT2_END_ = ABSOLUTE (.);                        \
219
    } > _region_                                                                                \
220
    . = ALIGN(ALIGN_LMA) ;                                                                      \
221
    _hal_code_section_end  = . ;                                                                \
222
    _hal_code_section_size = _hal_code_section_end - _hal_code_section_start ;                  \
223
    _DTORS2_                                                                                    \
224
    _EH_FRAME2_                                                                                 \
225
    _GCC_EXCEPT_TABLE2_
226
 
227
#define SECTION_data(_region_, _vma_, _lma_)                                                    \
228
    . = ALIGN( _vma_ , ALIGN_LMA ) ;                                                            \
229
    _hal_data_section_start_vma = . ;                                                           \
230
    .data . : _lma_ {                                                                           \
231
        *(.shdata*) *(.data*) *(.gnu.linkonce.d.*) *(.sdata) *(.gnu.linkonce.s.*)               \
232
        . = ALIGN (4);                                                                          \
233
        *(.2ram.*)                                                                              \
234
        . = ALIGN (4);                                                                          \
235
        KEEP(*( SORT (.ecos.table.*)));                                                         \
236
        . = ALIGN (4);                                                                          \
237
    } > _region_                                                                                \
238
    . = ALIGN(ALIGN_LMA);                                                                       \
239
    _hal_data_section_start_lma = LOADADDR(.data) ;                                             \
240
    _hal_data_section_end_vma = . ;                                                             \
241
    _hal_data_section_size = _hal_data_section_end_vma - _hal_data_section_start_vma ;          \
242
    _hal_data_section_end_lma = _hal_data_section_start_lma + _hal_data_section_size ;          \
243
    _hal_bss_start = . ;                                                                        \
244
    .sbss . : { *(.sbss) *(.gnu.linkonce.sb.*) *(.scommon) } > _region_                         \
245
    . = ALIGN(ALIGN_LMA) ;                                                                      \
246
    .bss  . : { *(.dynbss) *(.shbss) *(.bss*) *(.gnu.linkonce.b.*) *(COMMON) } > _region_       \
247
    . = ALIGN(ALIGN_LMA) ;                                                                      \
248
    _hal_bss_end = . ;                                                                          \
249
    _hal_bss_size = _hal_bss_end - _hal_bss_start ;
250
 
251
// Some ColdFire processors have on-chip RAM. Allocate  .iram_text, .iram_data
252
// .iram_bss in the expected fashion.
253
#define SECTION_iram(_region_, _vma_, _lma_)                                                                    \
254
    . = ALIGN( _vma_ , ALIGN_LMA ) ;                                                                            \
255
    _hal_iram_section_start_vma      = . ;                                                                      \
256
    _hal_iram_text_section_start_vma = . ;                                                                      \
257
    .iram_text . : _lma_ { *(.iram_text) *(.iram_text.*) } > _region_   =0                                      \
258
    _hal_iram_text_section_start_lma = LOADADDR(.iram_text) ;                                                   \
259
    . = ALIGN(ALIGN_LMA) ;                                                                                      \
260
    _hal_iram_text_section_end_vma = . ;                                                                        \
261
    _hal_iram_text_section_size = _hal_iram_text_section_end_vma - _hal_iram_text_section_start_vma ;           \
262
    _hal_iram_text_section_end_lma = _hal_iram_text_section_start_lma + _hal_iram_text_section_size ;           \
263
    _hal_iram_data_section_start_vma = . ;                                                                      \
264
    .iram_data . : AT(_hal_iram_text_section_end_lma) { *(.iram_data) *(.iram_data.*) } > _region_ =0       \
265
    . = ALIGN(ALIGN_LMA) ;                                                                                      \
266
    _hal_iram_data_section_start_lma = LOADADDR(.iram_data) ;                                                   \
267
    _hal_iram_data_section_end_vma = . ;                                                                        \
268
    _hal_iram_data_section_size = _hal_iram_data_section_end_vma - _hal_iram_data_section_start_vma ;           \
269
    _hal_iram_data_section_end_lma = _hal_iram_data_section_start_lma + _hal_iram_data_section_size ;           \
270
    _hal_iram_bss_section_start = . ;                                                                           \
271
    _iram_bss . (NOLOAD) : { *(.iram_bss) *(.iram_bss.*) } > _region_ =0                                        \
272
    . = ALIGN(ALIGN_LMA) ;                                                                                      \
273
    _hal_iram_bss_section_end = . ;                                                                             \
274
    _hal_iram_section_end_vma = . ;                                                                             \
275
    _hal_iram_section_size      = _hal_iram_section_end_vma - _hal_iram_section_start_vma ;                     \
276
    _hal_iram_section_start_lma = LOADADDR(.iram_text) ;                                                        \
277
    _hal_iram_section_end_lma   = _hal_iram_section_start_lma + _hal_iram_text_section_size +                   \
278
                                  _hal_iram_data_section_size ;
279
 
280
#define SECTIONS_END                            \
281
    .stab    0 (NOLOAD) : { *(.stab) }          \
282
    .stabstr 0 (NOLOAD) : { *(.stabstr) }       \
283
    .comment 0 (NOLOAD) : { *(.comment) }       \
284
    . = ALIGN(4); _end = .; PROVIDE (end = .);
285
 
286
// These macros are for backwards compatibility. Some are redundant.
287
#define SECTION_fixed_vectors(_region_, _vma_, _lma_)   SECTION_ram_vectors(_region_, _vma_)
288
#define SECTION_vectors(_region_, _vma_, _lma_)         SECTION_m68k_start(_region_, _vma_)
289
#define SECTION_text(_region_, _vma_, _lma_)            SECTION_code(_region_, _vma_)
290
#define SECTION_rodata(_region_, _vma_, _lma_)          SECTION_constants(_region_, _vma_)
291
#define SECTION_rodata1(_region_, _vma_, _lma_)
292
#define SECTION_fini(_region_, _vma_, _lma_)
293
#define SECTION_fixup(_region_, _vma_, _lma_)
294
#define SECTION_RELOCS(_region_, _vma_, _lma_)
295
#define SECTION_eh_frame(_region_, _vma_, _lma_)
296
#define SECTION_gcc_except_table(_region_, _vma_, _lma)
297
#define SECTION_got(_region_, _vma_, _lma_)
298
#define SECTION_sbss(_region_, _vma_, _lma_)
299
#define SECTION_bss(_region_, _vma_, _lma_)
300
 
301
#include 
302
#include CYGHWR_MEMORY_LAYOUT_LDI

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.