1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * Derived from internal linker script of GNU ld (GNU Binutils) 2.18 for elf32ppc emulation. |
---|
5 | */ |
---|
6 | |
---|
7 | OUTPUT_FORMAT ("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") |
---|
8 | OUTPUT_ARCH (powerpc) |
---|
9 | ENTRY (start) |
---|
10 | STARTUP (start.o) |
---|
11 | |
---|
12 | bsp_ram_start = ORIGIN (RAM); |
---|
13 | bsp_ram_end = ORIGIN (RAM) + LENGTH (RAM); |
---|
14 | bsp_ram_size = LENGTH (RAM); |
---|
15 | |
---|
16 | bsp_rom_start = ORIGIN (ROM); |
---|
17 | bsp_rom_end = ORIGIN (ROM) + LENGTH (ROM); |
---|
18 | bsp_rom_size = LENGTH (ROM); |
---|
19 | |
---|
20 | bsp_dpram_start = ORIGIN (DPRAM); |
---|
21 | bsp_dpram_end = ORIGIN (DPRAM) + LENGTH (DPRAM); |
---|
22 | bsp_dpram_size = LENGTH (DPRAM); |
---|
23 | |
---|
24 | bsp_section_align = 32; |
---|
25 | |
---|
26 | RamBase = bsp_ram_start; |
---|
27 | RamSize = bsp_ram_size; |
---|
28 | HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0; |
---|
29 | |
---|
30 | /* |
---|
31 | * The upper layer linker command file may optionally define the symbol |
---|
32 | * bsp_section_small_data_area_size. By default, the small data area is |
---|
33 | * defined by the .sdata and .sbss input sections. Define |
---|
34 | * bsp_section_small_data_area_size, if you want to make space available for |
---|
35 | * dynamically loaded libraries (libdl). Small memory targets which do not use |
---|
36 | * libdl, should not define this symbol. |
---|
37 | */ |
---|
38 | |
---|
39 | MEMORY { |
---|
40 | UNEXPECTED_SECTIONS : ORIGIN = 0xffffffff, LENGTH = 0 |
---|
41 | } |
---|
42 | |
---|
43 | SECTIONS { |
---|
44 | /* |
---|
45 | * BSP: MPC5200 registers |
---|
46 | */ |
---|
47 | .regs (NOLOAD) : { |
---|
48 | MBAR = .; |
---|
49 | mpc5200 = .; |
---|
50 | } > REGS |
---|
51 | |
---|
52 | /* |
---|
53 | * BSP: Exception vectors |
---|
54 | */ |
---|
55 | .vectors 0x100 : { |
---|
56 | *(.vectors) |
---|
57 | } > RAM |
---|
58 | |
---|
59 | /* |
---|
60 | * BSP: The initial stack will live in this area - between the vectors |
---|
61 | * and the text section. |
---|
62 | */ |
---|
63 | |
---|
64 | .text 0x10000 : { |
---|
65 | /* |
---|
66 | * BSP: Start of text section |
---|
67 | */ |
---|
68 | bsp_section_text_start = .; |
---|
69 | |
---|
70 | /* |
---|
71 | * BSP: System startup entry |
---|
72 | */ |
---|
73 | KEEP (*(.entry)) |
---|
74 | |
---|
75 | /* |
---|
76 | * BSP: Moved into .text from .init |
---|
77 | */ |
---|
78 | KEEP (*(.init)) |
---|
79 | |
---|
80 | *(.text .stub .text.* .gnu.linkonce.t.*) |
---|
81 | KEEP (*(.text.*personality*)) |
---|
82 | /* .gnu.warning sections are handled specially by elf32.em. */ |
---|
83 | *(.gnu.warning) |
---|
84 | *(.glink) |
---|
85 | |
---|
86 | /* |
---|
87 | * BSP: Special FreeBSD sysctl sections |
---|
88 | */ |
---|
89 | . = ALIGN (16); |
---|
90 | __start_set_sysctl_set = .; |
---|
91 | *(set_sysctl_*); |
---|
92 | __stop_set_sysctl_set = ABSOLUTE(.); |
---|
93 | *(set_domain_*); |
---|
94 | *(set_pseudo_*); |
---|
95 | |
---|
96 | /* |
---|
97 | * BSP: Moved into .text from .* |
---|
98 | */ |
---|
99 | *(.rodata .rodata.* .gnu.linkonce.r.*) |
---|
100 | KEEP (*(SORT(.rtemsroset.*))) |
---|
101 | *(.rodata1) |
---|
102 | *(.interp) |
---|
103 | *(.note.gnu.build-id) |
---|
104 | *(.hash) |
---|
105 | *(.gnu.hash) |
---|
106 | *(.dynsym) |
---|
107 | *(.dynstr) |
---|
108 | *(.gnu.version) |
---|
109 | *(.gnu.version_d) |
---|
110 | *(.gnu.version_r) |
---|
111 | *(.eh_frame_hdr) |
---|
112 | |
---|
113 | /* |
---|
114 | * BSP: Magic PPC stuff |
---|
115 | */ |
---|
116 | *(.PPC.*) |
---|
117 | |
---|
118 | /* |
---|
119 | * BSP: Required by cpukit/score/src/threadhandler.c |
---|
120 | */ |
---|
121 | PROVIDE (_fini = .); |
---|
122 | |
---|
123 | /* |
---|
124 | * BSP: Moved into .text from .fini |
---|
125 | */ |
---|
126 | KEEP (*(.fini)) |
---|
127 | |
---|
128 | . = ALIGN (bsp_section_align); |
---|
129 | |
---|
130 | PROVIDE (__etext = .); |
---|
131 | PROVIDE (_etext = .); |
---|
132 | PROVIDE (etext = .); |
---|
133 | } > RAM |
---|
134 | |
---|
135 | .tdata : { |
---|
136 | _TLS_Data_begin = .; |
---|
137 | *(.tdata .tdata.* .gnu.linkonce.td.*) |
---|
138 | _TLS_Data_end = .; |
---|
139 | } > RAM |
---|
140 | .tbss : { |
---|
141 | _TLS_BSS_begin = .; |
---|
142 | *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) |
---|
143 | _TLS_BSS_end = .; |
---|
144 | } > RAM |
---|
145 | _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin; |
---|
146 | _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin; |
---|
147 | _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin; |
---|
148 | _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin; |
---|
149 | _TLS_Size = _TLS_BSS_end - _TLS_Data_begin; |
---|
150 | _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss)); |
---|
151 | |
---|
152 | .sdata2 : { |
---|
153 | PROVIDE (_SDA2_BASE_ = 32768); |
---|
154 | |
---|
155 | *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) |
---|
156 | |
---|
157 | . = ALIGN (bsp_section_align); |
---|
158 | } > RAM |
---|
159 | |
---|
160 | .sbss2 : { |
---|
161 | *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) |
---|
162 | |
---|
163 | . = ALIGN (bsp_section_align); |
---|
164 | |
---|
165 | /* |
---|
166 | * BSP: End of text section |
---|
167 | */ |
---|
168 | bsp_section_text_end = .; |
---|
169 | } > RAM |
---|
170 | |
---|
171 | .data : { |
---|
172 | /* |
---|
173 | * BSP: Start of data section |
---|
174 | */ |
---|
175 | bsp_section_data_start = .; |
---|
176 | |
---|
177 | /* |
---|
178 | * BSP: Moved into .data from .ctors |
---|
179 | */ |
---|
180 | KEEP (*ecrti.o(.ctors)) |
---|
181 | KEEP (*crtbegin.o(.ctors)) |
---|
182 | KEEP (*crtbegin?.o(.ctors)) |
---|
183 | KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o *ecrtn.o) .ctors)) |
---|
184 | KEEP (*(SORT(.ctors.*))) |
---|
185 | KEEP (*(.ctors)) |
---|
186 | |
---|
187 | /* |
---|
188 | * BSP: Moved into .data from .dtors |
---|
189 | */ |
---|
190 | KEEP (*ecrti.o(.dtors)) |
---|
191 | KEEP (*crtbegin.o(.dtors)) |
---|
192 | KEEP (*crtbegin?.o(.dtors)) |
---|
193 | KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o *ecrtn.o) .dtors)) |
---|
194 | KEEP (*(SORT(.dtors.*))) |
---|
195 | KEEP (*(.dtors)) |
---|
196 | |
---|
197 | /* |
---|
198 | * BSP: Moved into .data from .* |
---|
199 | */ |
---|
200 | *(.tdata .tdata.* .gnu.linkonce.td.*) |
---|
201 | *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) |
---|
202 | *(.data1) |
---|
203 | KEEP (*(.eh_frame)) |
---|
204 | *(.gcc_except_table .gcc_except_table.*) |
---|
205 | KEEP (*(.jcr)) |
---|
206 | *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) |
---|
207 | *(.fixup) |
---|
208 | *(.got1) |
---|
209 | *(.got2) |
---|
210 | *(.dynamic) |
---|
211 | *(.got) |
---|
212 | *(.plt) |
---|
213 | PROVIDE_HIDDEN (__preinit_array_start = .); |
---|
214 | KEEP (*(.preinit_array)) |
---|
215 | PROVIDE_HIDDEN (__preinit_array_end = .); |
---|
216 | PROVIDE_HIDDEN (__init_array_start = .); |
---|
217 | KEEP (*(SORT(.init_array.*))) |
---|
218 | KEEP (*(.init_array)) |
---|
219 | PROVIDE_HIDDEN (__init_array_end = .); |
---|
220 | PROVIDE_HIDDEN (__fini_array_start = .); |
---|
221 | KEEP (*(.fini_array)) |
---|
222 | KEEP (*(SORT(.fini_array.*))) |
---|
223 | PROVIDE_HIDDEN (__fini_array_end = .); |
---|
224 | |
---|
225 | *(.data .data.* .gnu.linkonce.d.*) |
---|
226 | KEEP (*(SORT(.rtemsrwset.*))) |
---|
227 | KEEP (*(.gnu.linkonce.d.*personality*)) |
---|
228 | SORT(CONSTRUCTORS) |
---|
229 | |
---|
230 | . = ALIGN (bsp_section_align); |
---|
231 | } > RAM |
---|
232 | |
---|
233 | .sdata : { |
---|
234 | bsp_section_sdata_begin = .; |
---|
235 | PROVIDE (_SDA_BASE_ = 32768); |
---|
236 | *(.sdata .sdata.* .gnu.linkonce.s.*) |
---|
237 | |
---|
238 | . = ALIGN (bsp_section_align); |
---|
239 | |
---|
240 | _edata = .; |
---|
241 | PROVIDE (edata = .); |
---|
242 | |
---|
243 | /* |
---|
244 | * BSP: End of data section |
---|
245 | */ |
---|
246 | bsp_section_data_end = .; |
---|
247 | bsp_section_sdata_end = .; |
---|
248 | } > RAM |
---|
249 | |
---|
250 | .sbss : { |
---|
251 | /* |
---|
252 | * BSP: Start of bss section |
---|
253 | */ |
---|
254 | bsp_section_sbss_begin = .; |
---|
255 | |
---|
256 | __bss_start = .; |
---|
257 | |
---|
258 | PROVIDE (__sbss_start = .); PROVIDE (___sbss_start = .); |
---|
259 | *(.scommon) |
---|
260 | *(.dynsbss) |
---|
261 | *(.sbss .sbss.* .gnu.linkonce.sb.*) |
---|
262 | PROVIDE (__sbss_end = .); PROVIDE (___sbss_end = .); |
---|
263 | bsp_section_sbss_end = .; |
---|
264 | bsp_section_sdata_libdl_begin = .; |
---|
265 | . = DEFINED(bsp_section_small_data_area_size) ? |
---|
266 | bsp_section_sdata_begin + bsp_section_small_data_area_size : .; |
---|
267 | bsp_section_sdata_libdl_end = .; |
---|
268 | |
---|
269 | . = ALIGN (bsp_section_align); |
---|
270 | } > RAM |
---|
271 | |
---|
272 | .bss : { |
---|
273 | bsp_section_bss_start = .; |
---|
274 | *(COMMON) |
---|
275 | *(.dynbss) |
---|
276 | *(.bss .bss.* .gnu.linkonce.b.*) |
---|
277 | |
---|
278 | . = ALIGN (bsp_section_align); |
---|
279 | |
---|
280 | __end = .; |
---|
281 | _end = .; |
---|
282 | PROVIDE (end = .); |
---|
283 | |
---|
284 | /* |
---|
285 | * BSP: End of bss section |
---|
286 | */ |
---|
287 | bsp_section_bss_end = .; |
---|
288 | } > RAM |
---|
289 | |
---|
290 | /* |
---|
291 | * BSP: Section sizes |
---|
292 | */ |
---|
293 | bsp_section_text_size = bsp_section_text_end - bsp_section_text_start; |
---|
294 | bsp_section_data_size = bsp_section_data_end - bsp_section_data_start; |
---|
295 | bsp_section_bss_size = bsp_section_bss_end - bsp_section_bss_start; |
---|
296 | |
---|
297 | .rtemsstack (NOLOAD) : { |
---|
298 | *(SORT(.rtemsstack.*)) |
---|
299 | } > RAM |
---|
300 | |
---|
301 | /* |
---|
302 | * BSP: Work area start |
---|
303 | */ |
---|
304 | bsp_work_area_start = .; |
---|
305 | WorkAreaBase = bsp_work_area_start; |
---|
306 | |
---|
307 | /* Stabs debugging sections. */ |
---|
308 | .stab 0 : { *(.stab) } |
---|
309 | .stabstr 0 : { *(.stabstr) } |
---|
310 | .stab.excl 0 : { *(.stab.excl) } |
---|
311 | .stab.exclstr 0 : { *(.stab.exclstr) } |
---|
312 | .stab.index 0 : { *(.stab.index) } |
---|
313 | .stab.indexstr 0 : { *(.stab.indexstr) } |
---|
314 | .comment 0 : { *(.comment) } |
---|
315 | /* DWARF debug sections. |
---|
316 | Symbols in the DWARF debugging sections are relative to the beginning |
---|
317 | of the section so we begin them at 0. */ |
---|
318 | /* DWARF 1 */ |
---|
319 | .debug 0 : { *(.debug) } |
---|
320 | .line 0 : { *(.line) } |
---|
321 | /* GNU DWARF 1 extensions */ |
---|
322 | .debug_srcinfo 0 : { *(.debug_srcinfo) } |
---|
323 | .debug_sfnames 0 : { *(.debug_sfnames) } |
---|
324 | /* DWARF 1.1 and DWARF 2 */ |
---|
325 | .debug_aranges 0 : { *(.debug_aranges) } |
---|
326 | .debug_pubnames 0 : { *(.debug_pubnames) } |
---|
327 | /* DWARF 2 */ |
---|
328 | .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } |
---|
329 | .debug_abbrev 0 : { *(.debug_abbrev) } |
---|
330 | .debug_line 0 : { *(.debug_line) } |
---|
331 | .debug_frame 0 : { *(.debug_frame) } |
---|
332 | .debug_str 0 : { *(.debug_str) } |
---|
333 | .debug_loc 0 : { *(.debug_loc) } |
---|
334 | .debug_macinfo 0 : { *(.debug_macinfo) } |
---|
335 | /* SGI/MIPS DWARF 2 extensions */ |
---|
336 | .debug_weaknames 0 : { *(.debug_weaknames) } |
---|
337 | .debug_funcnames 0 : { *(.debug_funcnames) } |
---|
338 | .debug_typenames 0 : { *(.debug_typenames) } |
---|
339 | .debug_varnames 0 : { *(.debug_varnames) } |
---|
340 | /* DWARF 3 */ |
---|
341 | .debug_pubtypes 0 : { *(.debug_pubtypes) } |
---|
342 | .debug_ranges 0 : { *(.debug_ranges) } |
---|
343 | /* DWARF extension */ |
---|
344 | .debug_macro 0 : { *(.debug_macro) } |
---|
345 | .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } |
---|
346 | |
---|
347 | /DISCARD/ : { |
---|
348 | *(.note.GNU-stack) *(.gnu_debuglink) |
---|
349 | } |
---|
350 | |
---|
351 | /* |
---|
352 | * This is a RTEMS specific section to catch all unexpected input |
---|
353 | * sections. In case you get an error like |
---|
354 | * "section `.unexpected_sections' will not fit in region |
---|
355 | * `UNEXPECTED_SECTIONS'" |
---|
356 | * you have to figure out the offending input section and add it to the |
---|
357 | * appropriate output section definition above. |
---|
358 | */ |
---|
359 | .unexpected_sections : { *(*) } > UNEXPECTED_SECTIONS |
---|
360 | } |
---|