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