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