1 | /* |
---|
2 | * GP32 Linker script |
---|
3 | * |
---|
4 | * Written by Philippe Simons <loki_666@fastmail.fm> |
---|
5 | * |
---|
6 | * The license and distribution terms for this file may be |
---|
7 | * found in the file LICENSE in this distribution or at |
---|
8 | * |
---|
9 | * http://www.rtems.com/license/LICENSE. |
---|
10 | * |
---|
11 | * $Id$ |
---|
12 | */ |
---|
13 | OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm","elf32-littlearm") |
---|
14 | OUTPUT_ARCH(arm) |
---|
15 | ENTRY(_start) |
---|
16 | /* SEARCH_DIR(/usr/local/rtems-arm-dev-tools/arm-rtems/lib); */ |
---|
17 | |
---|
18 | |
---|
19 | MEMORY { |
---|
20 | sdram : ORIGIN = 0x30000000, LENGTH = 64M |
---|
21 | } |
---|
22 | |
---|
23 | /* |
---|
24 | * Declare some sizes. |
---|
25 | */ |
---|
26 | |
---|
27 | /* The base for SDRAM is set to umon's APPRAMBASE */ |
---|
28 | _sdram_base = DEFINED(_sdram_base) ? _sdram_base : 0x30000000; |
---|
29 | _sdram_size = DEFINED(_sdram_size) ? _sdram_size : 64M; |
---|
30 | |
---|
31 | RamBase = _sdram_base; |
---|
32 | RamSize = _sdram_size; |
---|
33 | HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0; |
---|
34 | |
---|
35 | _irq_stack_size = DEFINED(_irq_stack_size) ? _irq_stack_size : 0x1000; |
---|
36 | _fiq_stack_size = DEFINED(_fiq_stack_size) ? _fiq_stack_size : 0x400; |
---|
37 | _abt_stack_size = DEFINED(_abt_stack_size) ? _abt_stack_size : 0x100; |
---|
38 | _svc_stack_size = DEFINED(_svc_stack_size) ? _svc_stack_size : 0x1000; |
---|
39 | |
---|
40 | |
---|
41 | |
---|
42 | /* Do we need any of these for elf? |
---|
43 | __DYNAMIC = 0; */ |
---|
44 | |
---|
45 | SECTIONS |
---|
46 | { |
---|
47 | .base : |
---|
48 | { |
---|
49 | arm_exception_table = .; |
---|
50 | |
---|
51 | arm_reset_vect = .; /* 0x00 */ |
---|
52 | . += 4; |
---|
53 | |
---|
54 | arm_undef_vect = .; /* 0x04 */ |
---|
55 | . += 4; |
---|
56 | |
---|
57 | arm_swi_vect = .; /* 0x08 */ |
---|
58 | . += 4; |
---|
59 | |
---|
60 | arm_iabrt_vect = .; /* 0x0c */ |
---|
61 | . += 4; |
---|
62 | |
---|
63 | arm_dabrt_vect = .; /* 0x10 */ |
---|
64 | . += 4; |
---|
65 | |
---|
66 | /* no vector here */ |
---|
67 | . += 4; |
---|
68 | |
---|
69 | arm_irq_vect = .; /* 0x18 */ |
---|
70 | . += 4; |
---|
71 | |
---|
72 | arm_fiq_vect = .; /* 0x1c */ |
---|
73 | . += 4; |
---|
74 | /* FIXME: */ |
---|
75 | |
---|
76 | rtems_vector_table = .; |
---|
77 | . += (8 * 4); /* 8 ARM interrupts */ |
---|
78 | |
---|
79 | bsp_vector_table = .; |
---|
80 | . += (32 * 4); /* 32 S3C2400 interrupts */ |
---|
81 | |
---|
82 | . = ALIGN (0x100); |
---|
83 | |
---|
84 | |
---|
85 | } > sdram |
---|
86 | |
---|
87 | |
---|
88 | .text : |
---|
89 | { |
---|
90 | _axf_text_start = . ; |
---|
91 | *(EXCLUDE_FILE (*text.iwram*) .text) |
---|
92 | *(.text.*) |
---|
93 | *(.stub) |
---|
94 | |
---|
95 | /* |
---|
96 | * Special FreeBSD sysctl sections. |
---|
97 | */ |
---|
98 | . = ALIGN (16); |
---|
99 | __start_set_sysctl_set = .; |
---|
100 | *(set_sysctl_*); |
---|
101 | __stop_set_sysctl_set = ABSOLUTE(.); |
---|
102 | *(set_domain_*); |
---|
103 | *(set_pseudo_*); |
---|
104 | |
---|
105 | /* .gnu.warning sections are handled specially by elf32.em. */ |
---|
106 | *(.gnu.warning) |
---|
107 | *(.gnu.linkonce.t*) |
---|
108 | *(.glue_7) |
---|
109 | *(.glue_7t) |
---|
110 | |
---|
111 | . = ALIGN(4); /* REQUIRED. LD is flaky without it. */ |
---|
112 | } > sdram |
---|
113 | |
---|
114 | __text_end = . ; |
---|
115 | |
---|
116 | .init : |
---|
117 | { |
---|
118 | *(.init) |
---|
119 | } > sdram /*=0*/ |
---|
120 | |
---|
121 | .jcr : |
---|
122 | { |
---|
123 | *(.jcr) |
---|
124 | } > sdram |
---|
125 | |
---|
126 | |
---|
127 | .fini : |
---|
128 | { |
---|
129 | *(.fini) |
---|
130 | } > sdram /*=0*/ |
---|
131 | |
---|
132 | .rodata : |
---|
133 | { |
---|
134 | *(.rodata) |
---|
135 | *all.rodata*(*) |
---|
136 | *(.roda) |
---|
137 | *(.rodata.*) |
---|
138 | *(.gnu.linkonce.r*) |
---|
139 | SORT(CONSTRUCTORS) |
---|
140 | . = ALIGN(4); /* REQUIRED. LD is flaky without it. */ |
---|
141 | } > sdram = 0xff |
---|
142 | |
---|
143 | .ctors : |
---|
144 | { |
---|
145 | /* gcc uses crtbegin.o to find the start of the constructors, so |
---|
146 | we make sure it is first. Because this is a wildcard, it |
---|
147 | doesn't matter if the user does not actually link against |
---|
148 | crtbegin.o; the linker won't look for a file to match a |
---|
149 | wildcard. The wildcard also means that it doesn't matter which |
---|
150 | directory crtbegin.o is in. */ |
---|
151 | KEEP (*crtbegin.o(.ctors)) |
---|
152 | KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) |
---|
153 | KEEP (*(SORT(.ctors.*))) |
---|
154 | KEEP (*(.ctors)) |
---|
155 | . = ALIGN(4); /* REQUIRED. LD is flaky without it. */ |
---|
156 | } >sdram = 0 |
---|
157 | |
---|
158 | .dtors : |
---|
159 | { |
---|
160 | KEEP (*crtbegin.o(.dtors)) |
---|
161 | KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) |
---|
162 | KEEP (*(SORT(.dtors.*))) |
---|
163 | KEEP (*(.dtors)) |
---|
164 | . = ALIGN(4); /* REQUIRED. LD is flaky without it. */ |
---|
165 | } >sdram = 0 |
---|
166 | |
---|
167 | |
---|
168 | .eh_frame : |
---|
169 | { |
---|
170 | KEEP (*(.eh_frame)) |
---|
171 | . = ALIGN(4); /* REQUIRED. LD is flaky without it. */ |
---|
172 | } >sdram = 0 |
---|
173 | |
---|
174 | .gcc_except_table : |
---|
175 | { |
---|
176 | *(.gcc_except_table) |
---|
177 | . = ALIGN(4); /* REQUIRED. LD is flaky without it. */ |
---|
178 | } >sdram = 0 |
---|
179 | _axf_ro_end = . ; |
---|
180 | |
---|
181 | .data ALIGN(4) : |
---|
182 | { |
---|
183 | _axf_data_start = ABSOLUTE(.); |
---|
184 | *(.data) |
---|
185 | *(.data.*) |
---|
186 | *(.gnu.linkonce.d*) |
---|
187 | CONSTRUCTORS |
---|
188 | . = ALIGN(4); /* REQUIRED. LD is flaky without it. */ |
---|
189 | } >sdram = 0xff |
---|
190 | |
---|
191 | __data_end = . ; |
---|
192 | |
---|
193 | .bss ALIGN(4): |
---|
194 | { |
---|
195 | _axf_bss_start = ABSOLUTE(.); |
---|
196 | _clear_start = .; |
---|
197 | *(.bss) |
---|
198 | *(.bss.*) |
---|
199 | *(.gnu.linkonce.b.*) |
---|
200 | *(COMMON) |
---|
201 | . = ALIGN(64); |
---|
202 | _clear_end = .; |
---|
203 | |
---|
204 | . = ALIGN (256); |
---|
205 | _abt_stack = .; |
---|
206 | . += _abt_stack_size; |
---|
207 | |
---|
208 | . = ALIGN (256); |
---|
209 | _irq_stack = .; |
---|
210 | . += _irq_stack_size; |
---|
211 | |
---|
212 | . = ALIGN (256); |
---|
213 | _fiq_stack = .; |
---|
214 | . += _fiq_stack_size; |
---|
215 | |
---|
216 | . = ALIGN (256); |
---|
217 | _svc_stack = .; |
---|
218 | . += _svc_stack_size; |
---|
219 | |
---|
220 | /* |
---|
221 | * Ideally, the MMU's translation table would be in SRAM. But we |
---|
222 | * don't have any. If we don't use more regions than TLB entries (64), |
---|
223 | * the lookup will only happen once for each region. |
---|
224 | */ |
---|
225 | . = ALIGN (16 * 1024); |
---|
226 | _ttbl_base = .; |
---|
227 | . += (16 * 1024); |
---|
228 | |
---|
229 | . = ALIGN (1024); |
---|
230 | _bss_free_start = .; |
---|
231 | _bss_free_start = .; |
---|
232 | |
---|
233 | } > sdram |
---|
234 | _axf_bss_end = . ; |
---|
235 | |
---|
236 | _end = . ; |
---|
237 | __end__ = . ; |
---|
238 | PROVIDE (end = _end); |
---|
239 | |
---|
240 | |
---|
241 | /* Debugging stuff follows? */ |
---|
242 | |
---|
243 | /* Stabs debugging sections. */ |
---|
244 | .stab 0 : { *(.stab) } |
---|
245 | .stabstr 0 : { *(.stabstr) } |
---|
246 | .stab.excl 0 : { *(.stab.excl) } |
---|
247 | .stab.exclstr 0 : { *(.stab.exclstr) } |
---|
248 | .stab.index 0 : { *(.stab.index) } |
---|
249 | .stab.indexstr 0 : { *(.stab.indexstr) } |
---|
250 | .comment 0 : { *(.comment) } |
---|
251 | /* DWARF debug sections. |
---|
252 | Symbols in the DWARF debugging sections are relative to the beginning |
---|
253 | of the section so we begin them at 0. */ |
---|
254 | /* DWARF 1 */ |
---|
255 | .debug 0 : { *(.debug) } |
---|
256 | .line 0 : { *(.line) } |
---|
257 | /* GNU DWARF 1 extensions */ |
---|
258 | .debug_srcinfo 0 : { *(.debug_srcinfo) } |
---|
259 | .debug_sfnames 0 : { *(.debug_sfnames) } |
---|
260 | /* DWARF 1.1 and DWARF 2 */ |
---|
261 | .debug_aranges 0 : { *(.debug_aranges) } |
---|
262 | .debug_pubnames 0 : { *(.debug_pubnames) } |
---|
263 | /* DWARF 2 */ |
---|
264 | .debug_info 0 : { *(.debug_info) } |
---|
265 | .debug_abbrev 0 : { *(.debug_abbrev) } |
---|
266 | .debug_line 0 : { *(.debug_line) } |
---|
267 | .debug_frame 0 : { *(.debug_frame) } |
---|
268 | .debug_str 0 : { *(.debug_str) } |
---|
269 | .debug_loc 0 : { *(.debug_loc) } |
---|
270 | .debug_macinfo 0 : { *(.debug_macinfo) } |
---|
271 | /* SGI/MIPS DWARF 2 extensions */ |
---|
272 | .debug_weaknames 0 : { *(.debug_weaknames) } |
---|
273 | .debug_funcnames 0 : { *(.debug_funcnames) } |
---|
274 | .debug_typenames 0 : { *(.debug_typenames) } |
---|
275 | .debug_varnames 0 : { *(.debug_varnames) } |
---|
276 | /*.stack 0x80000 : { _stack = .; *(.stack) }*/ |
---|
277 | /* These must appear regardless of . */ |
---|
278 | } |
---|
279 | |
---|