[b6394ae] | 1 | /* |
---|
[39cc10a] | 2 | * COPYRIGHT (c) 1989-2008. |
---|
[b6394ae] | 3 | * On-Line Applications Research Corporation (OAR). |
---|
| 4 | * |
---|
| 5 | * The license and distribution terms for this file may be |
---|
[0c875c6a] | 6 | * found in the file LICENSE in this distribution or at |
---|
[9d2bdb5] | 7 | * http://www.rtems.com/license/LICENSE. |
---|
[b6394ae] | 8 | */ |
---|
| 9 | |
---|
[39cc10a] | 10 | OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") |
---|
[8961188] | 11 | OUTPUT_ARCH(powerpc) |
---|
| 12 | ENTRY(_start) |
---|
| 13 | /* Do we need any of these for elf? |
---|
| 14 | __DYNAMIC = 0; */ |
---|
[39cc10a] | 15 | PROVIDE (PSIM_INSTRUCTIONS_PER_MICROSECOND = 10000); |
---|
[af2eb77] | 16 | |
---|
| 17 | RamBase = DEFINED(RamBase) ? RamBase : 0x0; |
---|
[b094233] | 18 | /* |
---|
| 19 | * make sure device tree (property /openprom/options/oea-memory-size) |
---|
| 20 | * provides at least 'RamSize'. |
---|
| 21 | * Also, the BATs must at map at least 'RamSize' (currently, they |
---|
| 22 | * map 32M -- see startup/bspstart.c). |
---|
| 23 | * Furthermore, the RAM region must be large enough (there is no |
---|
| 24 | * disadvantage in making that one very large as long as it doesn't |
---|
| 25 | * overlap another memory area). |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | RamSize = DEFINED(RamSize) ? RamSize : 16M; |
---|
[af2eb77] | 29 | |
---|
[8961188] | 30 | MEMORY |
---|
| 31 | { |
---|
[b094233] | 32 | RAM : ORIGIN = 0, LENGTH = 32M |
---|
[39cc10a] | 33 | PSIM_REGS : ORIGIN = 0x0c000000, LENGTH = 16M |
---|
| 34 | VECTORS : ORIGIN = 0xFFF00000, LENGTH = 0x20000 |
---|
[8961188] | 35 | } |
---|
| 36 | |
---|
| 37 | SECTIONS |
---|
| 38 | { |
---|
[270ce1ff] | 39 | .entry_point_section : |
---|
[8961188] | 40 | { |
---|
[270ce1ff] | 41 | *(.entry_point_section) |
---|
[39cc10a] | 42 | } > VECTORS |
---|
| 43 | |
---|
| 44 | /* |
---|
| 45 | * BSP: PSIM Register Block |
---|
| 46 | */ |
---|
| 47 | .psim_regs (NOLOAD) : { |
---|
| 48 | psim_reg*(.text) |
---|
| 49 | psim_reg*(.data) |
---|
| 50 | psim_reg*(.bss) |
---|
| 51 | psim_reg*(COMMON) |
---|
| 52 | } > PSIM_REGS |
---|
[8961188] | 53 | |
---|
| 54 | /* Read-only sections, merged into text segment: */ |
---|
| 55 | /* . = 0x40000 + SIZEOF_HEADERS; */ |
---|
| 56 | . = 0x4000; |
---|
[270ce1ff] | 57 | .interp : { *(.interp) } |
---|
| 58 | .hash : { *(.hash) } |
---|
| 59 | .dynsym : { *(.dynsym) } |
---|
| 60 | .dynstr : { *(.dynstr) } |
---|
| 61 | .gnu.version : { *(.gnu.version) } |
---|
| 62 | .gnu.version_d : { *(.gnu.version_d) } |
---|
| 63 | .gnu.version_r : { *(.gnu.version_r) } |
---|
[8961188] | 64 | .text : |
---|
| 65 | { |
---|
[4217b96] | 66 | *(.text*) |
---|
[7a42b0ca] | 67 | *(.gnu.linkonce.t.*) |
---|
[8961188] | 68 | *(.descriptors) |
---|
[addd698] | 69 | *(.eh_frame_hdr*) |
---|
| 70 | *(.eh_frame*) |
---|
[9c1133e] | 71 | |
---|
[8961188] | 72 | /* .gnu.warning sections are handled specially by elf32.em. */ |
---|
| 73 | *(.gnu.warning) |
---|
[a524c00] | 74 | } >RAM |
---|
[0bda8b4] | 75 | .robsdsets : { |
---|
| 76 | /* Special FreeBSD linker set sections */ |
---|
| 77 | __start_set_sysctl_set = .; |
---|
| 78 | *(set_sysctl_*); |
---|
| 79 | __stop_set_sysctl_set = .; |
---|
| 80 | *(set_domain_*); |
---|
| 81 | *(set_pseudo_*); |
---|
| 82 | _bsd__start_set_modmetadata_set = .; |
---|
| 83 | *(_bsd_set_modmetadata_set); |
---|
| 84 | _bsd__stop_set_modmetadata_set = .; |
---|
| 85 | _bsd__start_set_sysctl_set = .; |
---|
| 86 | *(_bsd_set_sysctl_set); |
---|
| 87 | _bsd__stop_set_sysctl_set = .; |
---|
[97f82fc] | 88 | _bsd__start_set_sysinit_set = .; |
---|
| 89 | *(_bsd_set_sysinit_*); |
---|
| 90 | _bsd__stop_set_sysinit_set = .; |
---|
[0bda8b4] | 91 | |
---|
| 92 | bsp_section_rodata_end = .; |
---|
| 93 | } > RAM |
---|
[270ce1ff] | 94 | .init : |
---|
| 95 | { |
---|
| 96 | KEEP (*(.init)) |
---|
| 97 | } >RAM =0 |
---|
[417fca76] | 98 | |
---|
| 99 | .rel.dyn : |
---|
| 100 | { |
---|
| 101 | *(.rel.init) |
---|
| 102 | *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) |
---|
| 103 | *(.rel.fini) |
---|
| 104 | *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) |
---|
| 105 | *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) |
---|
| 106 | *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) |
---|
| 107 | *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) |
---|
| 108 | *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) |
---|
| 109 | *(.rel.ctors) |
---|
| 110 | *(.rel.dtors) |
---|
| 111 | *(.rel.got) |
---|
| 112 | *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) |
---|
| 113 | *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) |
---|
| 114 | *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) |
---|
| 115 | *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) |
---|
| 116 | *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) |
---|
| 117 | } >RAM |
---|
| 118 | .rela.dyn : |
---|
| 119 | { |
---|
| 120 | *(.rela.init) |
---|
| 121 | *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) |
---|
| 122 | *(.rela.fini) |
---|
| 123 | *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) |
---|
| 124 | *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) |
---|
| 125 | *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) |
---|
| 126 | *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) |
---|
| 127 | *(.rela.ctors) |
---|
| 128 | *(.rela.dtors) |
---|
| 129 | *(.rela.got) |
---|
| 130 | *(.rela.got1) |
---|
| 131 | *(.rela.got2) |
---|
| 132 | *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) |
---|
| 133 | *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) |
---|
| 134 | *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) |
---|
| 135 | *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) |
---|
| 136 | *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) |
---|
| 137 | } >RAM |
---|
| 138 | .rel.plt : { *(.rel.plt) } |
---|
| 139 | .rela.plt : { *(.rela.plt) } |
---|
| 140 | |
---|
[270ce1ff] | 141 | .fini : |
---|
| 142 | { |
---|
| 143 | _fini = .; |
---|
| 144 | KEEP (*(.fini)) |
---|
| 145 | } >RAM =0 |
---|
[85c92574] | 146 | .rodata : { *(.rodata*) *(.gnu.linkonce.r*) } >RAM |
---|
[a524c00] | 147 | .rodata1 : { *(.rodata1) } >RAM |
---|
[270ce1ff] | 148 | PROVIDE (__FRAME_BEGIN__ = .); |
---|
| 149 | PROVIDE (__FRAME_END__ = .); |
---|
[847375f] | 150 | PROVIDE (_etext = .); |
---|
[8961188] | 151 | PROVIDE (etext = .); |
---|
[431bcd75] | 152 | _SDA2_BASE_ = __SDATA2_START__ + 0x8000; |
---|
[85c92574] | 153 | .sdata2 : { *(.sdata2) *(.gnu.linkonce.s2.*) } >RAM |
---|
| 154 | .sbss2 : { *(.sbss2) *(.gnu.linkonce.sb2.*) } >RAM |
---|
[8961188] | 155 | PROVIDE (__SBSS2_END__ = .); |
---|
| 156 | /* Adjust the address for the data segment. We want to adjust up to |
---|
| 157 | the same address within the page on the next page up. It would |
---|
| 158 | be more correct to do this: |
---|
| 159 | . = ALIGN(0x40000) + (ALIGN(8) & (0x40000 - 1)); |
---|
| 160 | The current expression does not correctly handle the case of a |
---|
| 161 | text segment ending precisely at the end of a page; it causes the |
---|
| 162 | data segment to skip a page. The above expression does not have |
---|
| 163 | this problem, but it will currently (2/95) cause BFD to allocate |
---|
| 164 | a single segment, combining both text and data, for this case. |
---|
| 165 | This will prevent the text segment from being shared among |
---|
| 166 | multiple executions of the program; I think that is more |
---|
| 167 | important than losing a page of the virtual address space (note |
---|
| 168 | that no actual memory is lost; the page which is skipped can not |
---|
| 169 | be referenced). */ |
---|
[3c87bb9c] | 170 | /* . = ALIGN(8) + 0x40000; */ |
---|
[8961188] | 171 | .data : |
---|
| 172 | { |
---|
[4b27d816] | 173 | *(.data .data.* .gnu.linkonce.d.*) |
---|
| 174 | SORT(CONSTRUCTORS) |
---|
[a524c00] | 175 | } >RAM |
---|
[8961188] | 176 | PROVIDE (__EXCEPT_START__ = .); |
---|
[d1f57b5] | 177 | .gcc_except_table : { *(.gcc_except_table*) } >RAM |
---|
[8961188] | 178 | PROVIDE (__EXCEPT_END__ = .); |
---|
| 179 | |
---|
[a524c00] | 180 | .data1 : { *(.data1) } >RAM |
---|
| 181 | .got1 : { *(.got1) } >RAM |
---|
| 182 | .dynamic : { *(.dynamic) } >RAM |
---|
[8961188] | 183 | /* Put .ctors and .dtors next to the .got2 section, so that the pointers |
---|
| 184 | get relocated with -mrelocatable. Also put in the .fixup pointers. |
---|
| 185 | The current compiler no longer needs this, but keep it around for 2.7.2 */ |
---|
[a524c00] | 186 | PROVIDE (__GOT2_START__ = .); |
---|
| 187 | PROVIDE (_GOT2_START_ = .); |
---|
| 188 | .got2 : { *(.got2) } >RAM |
---|
| 189 | PROVIDE (__GOT2_END__ = .); |
---|
[f35abd4] | 190 | PROVIDE (_GOT2_END_ = .); |
---|
[a524c00] | 191 | |
---|
| 192 | PROVIDE (__CTOR_LIST__ = .); |
---|
| 193 | .ctors : { *(.ctors) } >RAM |
---|
| 194 | PROVIDE (__CTOR_END__ = .); |
---|
| 195 | |
---|
| 196 | PROVIDE (__DTOR_LIST__ = .); |
---|
| 197 | .dtors : { *(.dtors) } >RAM |
---|
| 198 | PROVIDE (__DTOR_END__ = .); |
---|
| 199 | |
---|
| 200 | PROVIDE (__FIXUP_START__ = .); |
---|
| 201 | PROVIDE (_FIXUP_START_ = .); |
---|
| 202 | .fixup : { *(.fixup) } >RAM |
---|
| 203 | PROVIDE (_FIXUP_END_ = .); |
---|
| 204 | PROVIDE (__FIXUP_END__ = .); |
---|
| 205 | |
---|
[270ce1ff] | 206 | .jcr : { KEEP (*(.jcr)) } > RAM |
---|
| 207 | |
---|
[a524c00] | 208 | PROVIDE (__GOT_START__ = .); |
---|
| 209 | PROVIDE (_GOT_START_ = .); |
---|
[8961188] | 210 | s.got = .; |
---|
[a524c00] | 211 | .got : { *(.got) } >RAM |
---|
| 212 | .got.plt : { *(.got.plt) } >RAM |
---|
| 213 | PROVIDE (_GOT_END_ = .); |
---|
| 214 | PROVIDE (__GOT_END__ = .); |
---|
| 215 | |
---|
[8961188] | 216 | /* We want the small data sections together, so single-instruction offsets |
---|
| 217 | can access them all, and initialized data all before uninitialized, so |
---|
| 218 | we can shorten the on-disk segment size. */ |
---|
[431bcd75] | 219 | _SDA_BASE_ = __SDATA_START__ + 0x8000; |
---|
[4217b96] | 220 | .sdata : { *(.sdata*) *(.gnu.linkonce.s.*) } >RAM |
---|
[8961188] | 221 | _edata = .; |
---|
| 222 | PROVIDE (edata = .); |
---|
[a524c00] | 223 | |
---|
[1a1c3fb] | 224 | PROVIDE (RAM_END = 32M); |
---|
[8961188] | 225 | .sbss : |
---|
| 226 | { |
---|
| 227 | PROVIDE (__sbss_start = .); |
---|
[270ce1ff] | 228 | *(.dynsbss) |
---|
[4217b96] | 229 | *(.sbss* .gnu.linkonce.sb.*) |
---|
[8961188] | 230 | PROVIDE (__sbss_end = .); |
---|
[a524c00] | 231 | } >RAM |
---|
[8961188] | 232 | PROVIDE (__SBSS_END__ = .); |
---|
[a524c00] | 233 | |
---|
[8961188] | 234 | .bss : |
---|
| 235 | { |
---|
| 236 | PROVIDE (__bss_start = .); |
---|
| 237 | *(.dynbss) |
---|
[bd86290d] | 238 | *(.bss .bss* .gnu.linkonce.b*) |
---|
[8961188] | 239 | *(COMMON) |
---|
[a524c00] | 240 | } >RAM |
---|
[af2eb77] | 241 | . = ALIGN(16); |
---|
| 242 | . += 0x1000; |
---|
| 243 | PROVIDE(__stack = .); |
---|
[270ce1ff] | 244 | __rtems_end = . ; |
---|
[8ddf67e] | 245 | . = ALIGN(8) + 0x8000; |
---|
[3c87bb9c] | 246 | PROVIDE(_end = .); |
---|
| 247 | PROVIDE(end = .); |
---|
[8961188] | 248 | |
---|
| 249 | /* These are needed for ELF backends which have not yet been |
---|
| 250 | converted to the new style linker. */ |
---|
| 251 | .stab 0 : { *(.stab) } |
---|
| 252 | .stabstr 0 : { *(.stabstr) } |
---|
| 253 | /* DWARF debug sections. |
---|
| 254 | Symbols in the DWARF debugging sections are relative to the beginning |
---|
| 255 | of the section so we begin them at 0. */ |
---|
| 256 | /* DWARF 1 */ |
---|
| 257 | .debug 0 : { *(.debug) } |
---|
| 258 | .line 0 : { *(.line) } |
---|
| 259 | /* GNU DWARF 1 extensions */ |
---|
| 260 | .debug_srcinfo 0 : { *(.debug_srcinfo) } |
---|
| 261 | .debug_sfnames 0 : { *(.debug_sfnames) } |
---|
| 262 | /* DWARF 1.1 and DWARF 2 */ |
---|
| 263 | .debug_aranges 0 : { *(.debug_aranges) } |
---|
| 264 | .debug_pubnames 0 : { *(.debug_pubnames) } |
---|
| 265 | /* DWARF 2 */ |
---|
| 266 | .debug_info 0 : { *(.debug_info) } |
---|
| 267 | .debug_abbrev 0 : { *(.debug_abbrev) } |
---|
| 268 | .debug_line 0 : { *(.debug_line) } |
---|
| 269 | .debug_frame 0 : { *(.debug_frame) } |
---|
| 270 | .debug_str 0 : { *(.debug_str) } |
---|
| 271 | .debug_loc 0 : { *(.debug_loc) } |
---|
| 272 | .debug_macinfo 0 : { *(.debug_macinfo) } |
---|
| 273 | /* SGI/MIPS DWARF 2 extensions */ |
---|
| 274 | .debug_weaknames 0 : { *(.debug_weaknames) } |
---|
| 275 | .debug_funcnames 0 : { *(.debug_funcnames) } |
---|
| 276 | .debug_typenames 0 : { *(.debug_typenames) } |
---|
| 277 | .debug_varnames 0 : { *(.debug_varnames) } |
---|
| 278 | /* These must appear regardless of . */ |
---|
| 279 | } |
---|