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