1 |
27 |
unneback |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// openrisc.ld
|
4 |
|
|
//
|
5 |
|
|
// Linker script for OpenRISC architecture
|
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): sfurman
|
44 |
|
|
// Contributors:jskov
|
45 |
|
|
// Date: 2002-02-28
|
46 |
|
|
// Purpose: OpenRISC Linker script
|
47 |
|
|
//
|
48 |
|
|
//####DESCRIPTIONEND####
|
49 |
|
|
//
|
50 |
|
|
//==========================================================================
|
51 |
|
|
STARTUP(vectors.o)
|
52 |
|
|
ENTRY(__exception_reset)
|
53 |
|
|
#ifdef EXTRAS
|
54 |
|
|
INPUT(extras.o)
|
55 |
|
|
#endif
|
56 |
|
|
GROUP(libtarget.a libgcc.a)
|
57 |
|
|
|
58 |
|
|
#define ALIGN_LMA 8
|
59 |
|
|
#define FOLLOWING(_section_) AT ((LOADADDR (_section_) + SIZEOF (_section_) + ALIGN_LMA - 1) & ~ (ALIGN_LMA - 1))
|
60 |
|
|
#define LMA_EQ_VMA
|
61 |
|
|
#define FORCE_OUTPUT . = .
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
#define SECTIONS_BEGIN
|
65 |
|
|
|
66 |
|
|
#define SECTION_vectors(_region_, _vma_, _lma_) \
|
67 |
|
|
.vectors _vma_ : _lma_ \
|
68 |
|
|
{ FORCE_OUTPUT; KEEP(*(.vectors)) } \
|
69 |
|
|
> _region_
|
70 |
|
|
|
71 |
|
|
// Code that might be executed out of either RAM or ROM
|
72 |
|
|
#define SECTION_text(_region_, _vma_, _lma_) \
|
73 |
|
|
.text _vma_ : _lma_ \
|
74 |
|
|
{ __stext = .; \
|
75 |
|
|
*(.text*) *(.gnu.warning) *(.gnu.linkonce*) *(.init) } \
|
76 |
|
|
> _region_ \
|
77 |
|
|
__etext = .; PROVIDE (etext = .);
|
78 |
|
|
|
79 |
|
|
// The .text.ram section is for performance-sensitive code that is
|
80 |
|
|
// always executed from RAM. (If the code is loaded into ROM, it will
|
81 |
|
|
// be copied into RAM prior to execution.)
|
82 |
|
|
//
|
83 |
|
|
// Note: The SECTION_text_ram() macro must be listed in the linker
|
84 |
|
|
// include script (*.ldi file) prior to SECTION_text().
|
85 |
|
|
//
|
86 |
|
|
// All eCos code is put in the .text section unless explicitly placed
|
87 |
|
|
// into a section named section .text.ram*.
|
88 |
|
|
|
89 |
|
|
#define SECTION_text_ram(_region_, _vma_, _lma_) \
|
90 |
|
|
.text.ram _vma_ : _lma_ \
|
91 |
|
|
{ __stext_ram = .; \
|
92 |
|
|
__ram_text_start = ABSOLUTE(.); \
|
93 |
|
|
*(.text.ram*) \
|
94 |
|
|
} > _region_ \
|
95 |
|
|
__load_addr_text_ram = LOADADDR(.text.ram); \
|
96 |
|
|
__ram_text_end = .; PROVIDE(__ram_text_end = .); \
|
97 |
|
|
__etext_ram = .; PROVIDE (etext_ram = .);
|
98 |
|
|
|
99 |
|
|
#define SECTION_fini(_region_, _vma_, _lma_) \
|
100 |
|
|
.fini _vma_ : _lma_ \
|
101 |
|
|
{ FORCE_OUTPUT; *(.fini) } \
|
102 |
|
|
> _region_
|
103 |
|
|
|
104 |
|
|
#define SECTION_rodata1(_region_, _vma_, _lma_) \
|
105 |
|
|
.rodata1 _vma_ : _lma_ \
|
106 |
|
|
{ FORCE_OUTPUT; *(.rodata1*) } \
|
107 |
|
|
> _region_
|
108 |
|
|
|
109 |
|
|
#define SECTION_rodata(_region_, _vma_, _lma_) \
|
110 |
|
|
.rodata _vma_ : _lma_ \
|
111 |
|
|
{ FORCE_OUTPUT; *(.rodata*) } \
|
112 |
|
|
> _region_
|
113 |
|
|
|
114 |
|
|
#define SECTION_fixup(_region_, _vma_, _lma_) \
|
115 |
|
|
.fixup _vma_ : _lma_ \
|
116 |
|
|
{ __FIXUP_START__ = ABSOLUTE(.); *(.fixup) __FIXUP_END__ = ABSOLUTE(.);}\
|
117 |
|
|
> _region_
|
118 |
|
|
|
119 |
|
|
#define SECTION_gcc_except_table(_region_, _vma_, _lma_) \
|
120 |
|
|
.gcc_except_table _vma_ : _lma_ \
|
121 |
|
|
{ __EXCEPT_START__ = ABSOLUTE(.); *(.gcc_except_table) \
|
122 |
|
|
__EXCEPT_END__ = ABSOLUTE(.);} \
|
123 |
|
|
> _region_
|
124 |
|
|
|
125 |
|
|
#define SECTION_data(_region_, _vma_, _lma_) \
|
126 |
|
|
.data _vma_ : _lma_ \
|
127 |
|
|
{ __ram_data_start = ABSOLUTE(.); *(.data*) \
|
128 |
|
|
__GOT1_START__ = ABSOLUTE(.); *(.got1) __GOT1_END__ = ABSOLUTE(.); \
|
129 |
|
|
/* Put .ctors and .dtors next to the .got2 section, so that */ \
|
130 |
|
|
/* the pointers get relocated with -mrelocatable. */ \
|
131 |
|
|
. = ALIGN(8); ___CTOR_LIST__ = ABSOLUTE(.); \
|
132 |
|
|
KEEP(*(SORT(.ctors*))) ___CTOR_END__ = ABSOLUTE(.); \
|
133 |
|
|
___DTOR_LIST__ = ABSOLUTE(.); \
|
134 |
|
|
KEEP(*(SORT(.dtors*))) ___DTOR_END__ = ABSOLUTE(.); \
|
135 |
|
|
. = ALIGN(8); \
|
136 |
|
|
KEEP(*( SORT (.ecos.table.*))) ; \
|
137 |
|
|
. = ALIGN(4); \
|
138 |
|
|
*( .2ram.*) ; \
|
139 |
|
|
__GOT2_START__ = ABSOLUTE(.); *(.got2) __GOT2_END__ = ABSOLUTE(.); \
|
140 |
|
|
__GOT_START = ABSOLUTE(.); _GLOBAL_OFFSET_TABLE_ = ABSOLUTE(. + 32768); \
|
141 |
|
|
_SDA_BASE_ = ABSOLUTE(.); *(.got.plt) *(.got) \
|
142 |
|
|
__GOT_END__ = ABSOLUTE(.); *(.dynamic) \
|
143 |
|
|
/* We want the small data sections together, so single-instruction */ \
|
144 |
|
|
/* offsets can access them all, and initialized data all before */ \
|
145 |
|
|
/* uninitialized, so we can shorten the on-disk segment size. */ \
|
146 |
|
|
__SDATA_START__ = ABSOLUTE(.); *(.sdata) *(.sdata.*) \
|
147 |
|
|
__SDATA2_START__ = ABSOLUTE(.); *(.sdata2*) } \
|
148 |
|
|
> _region_ \
|
149 |
|
|
__rom_data_start = LOADADDR(.data); \
|
150 |
|
|
__ram_data_end = .; PROVIDE(__ram_data_end = .); \
|
151 |
|
|
_edata = .; PROVIDE (edata = .);
|
152 |
|
|
|
153 |
|
|
#define SECTION_sbss(_region_, _vma_, _lma_) \
|
154 |
|
|
.sbss _vma_ : _lma_ \
|
155 |
|
|
{ __sbss_start = ABSOLUTE (.); \
|
156 |
|
|
__SBSS_START__ = ABSOLUTE(.); *(.sbss.*) __SBSS_END__ = ABSOLUTE(.); \
|
157 |
|
|
__SBSSx_START__ = ABSOLUTE(.); *(.sbss*) __SBSSx_END__ = ABSOLUTE(.);\
|
158 |
|
|
*(.scommon*) \
|
159 |
|
|
__sbss_end = ABSOLUTE (.); } \
|
160 |
|
|
> _region_
|
161 |
|
|
|
162 |
|
|
#define SECTION_bss(_region_, _vma_, _lma_) \
|
163 |
|
|
.bss _vma_ : _lma_ \
|
164 |
|
|
{ __bss_start = ABSOLUTE (.); \
|
165 |
|
|
FORCE_OUTPUT; *(.dynbss*) *(.bss*) *(COMMON) \
|
166 |
|
|
__bss_end = ABSOLUTE (.); } \
|
167 |
|
|
> _region_
|
168 |
|
|
|
169 |
|
|
#define SECTIONS_END . = ALIGN(4); _end = .; PROVIDE (end = .);
|
170 |
|
|
|
171 |
|
|
#include
|
172 |
|
|
#include CYGHWR_MEMORY_LAYOUT_LDI
|
173 |
|
|
|
174 |
|
|
// Define VSR and virtual tables to reside at fixed addresses.
|
175 |
|
|
#include CYGBLD_HAL_TARGET_H
|
176 |
|
|
_hal_vsr_table = CYGHWR_HAL_VSR_TABLE;
|
177 |
|
|
_hal_virtual_vector_table = CYGHWR_HAL_VIRTUAL_VECTOR_TABLE;
|