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