[16a8616] | 1 | /* |
---|
| 2 | * This file contains directives for the GNU linker which are specific to the |
---|
| 3 | * Virtex 4 PPC 405. No assumptions are made on the firmware in the FPGA. |
---|
| 4 | * This file is intended to be used together with start.S to generate |
---|
| 5 | * downloadable code. |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") |
---|
| 9 | OUTPUT_ARCH(powerpc) |
---|
| 10 | |
---|
| 11 | ENTRY(download_entry) |
---|
[b80d7355] | 12 | EXTERN(download_entry) |
---|
| 13 | EXTERN(__vectors) |
---|
[16a8616] | 14 | |
---|
| 15 | MsgAreaSize = DEFINED(MsgAreaSize) ? MsgAreaSize : 1M; |
---|
| 16 | RamBase = DEFINED(RamBase) ? RamBase : 0x0; |
---|
| 17 | RamSize = DEFINED(RamSize) ? RamSize : 128M - MsgAreaSize; |
---|
| 18 | HeapSize = DEFINED(HeapSize) ? HeapSize : 0; /* 0=Use def */ |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | MEMORY |
---|
| 22 | { |
---|
[5b822ab] | 23 | VECTORS : ORIGIN = 0x00000000, LENGTH = 12K |
---|
| 24 | RAM : ORIGIN = 0x00003000, LENGTH = 128M - 12K |
---|
[16a8616] | 25 | } |
---|
| 26 | |
---|
| 27 | |
---|
| 28 | SECTIONS |
---|
| 29 | { |
---|
[5b822ab] | 30 | bsp_exc_vector_base = 0x100; |
---|
| 31 | __exeentry = download_entry; |
---|
| 32 | __exestart = bsp_exc_vector_base; |
---|
| 33 | .vectors bsp_exc_vector_base : { *(.vectors) } > VECTORS |
---|
[16a8616] | 34 | |
---|
| 35 | /* Read-only sections, merged into text segment: */ |
---|
| 36 | .interp : { *(.interp) } > RAM |
---|
| 37 | .hash : { *(.hash) } > RAM |
---|
| 38 | .dynsym : { *(.dynsym) } > RAM |
---|
| 39 | .dynstr : { *(.dynstr) } > RAM |
---|
| 40 | .gnu.version : { *(.gnu.version) } > RAM |
---|
| 41 | .gnu.version_d : { *(.gnu.version_d) } > RAM |
---|
| 42 | .gnu.version_r : { *(.gnu.version_r) } > RAM |
---|
| 43 | .rela.text : { *(.rela.text) *(.rela.gnu.linkonce.t*) } > RAM |
---|
| 44 | .rela.data : { *(.rela.data) *(.rela.gnu.linkonce.d*) } > RAM |
---|
| 45 | .rela.rodata : { *(.rela.rodata*) *(.rela.gnu.linkonce.r*) } > RAM |
---|
| 46 | .rela.got : { *(.rela.got) } > RAM |
---|
| 47 | .rela.got1 : { *(.rela.got1) } > RAM |
---|
| 48 | .rela.got2 : { *(.rela.got2) } > RAM |
---|
| 49 | .rela.ctors : { *(.rela.ctors) } > RAM |
---|
| 50 | .rela.dtors : { *(.rela.dtors) } > RAM |
---|
| 51 | .rela.init : { *(.rela.init) } > RAM |
---|
| 52 | .rela.fini : { *(.rela.fini) } > RAM |
---|
| 53 | .rela.bss : { *(.rela.bss) } > RAM |
---|
| 54 | .rela.plt : { *(.rela.plt) } > RAM |
---|
| 55 | .rela.sdata : { *(.rela.sdata) } > RAM |
---|
| 56 | .rela.sbss : { *(.rela.sbss) } > RAM |
---|
| 57 | .rela.sdata2 : { *(.rela.sdata2) } > RAM |
---|
| 58 | .rela.sbss2 : { *(.rela.sbss2) } > RAM |
---|
| 59 | .rela.dyn : { *(.rela.dyn) } > RAM |
---|
| 60 | |
---|
| 61 | /* Initialization code */ |
---|
| 62 | .init : { PROVIDE (_init = .); |
---|
| 63 | *ecrti.o(.init) |
---|
| 64 | KEEP(*(.init)) |
---|
| 65 | *ecrtn.o(.init) |
---|
| 66 | } > RAM |
---|
| 67 | |
---|
| 68 | .text : { *(.entry) |
---|
| 69 | *(.text) |
---|
| 70 | *(.text.*) |
---|
| 71 | |
---|
| 72 | /* Special FreeBSD sysctl sections */ |
---|
| 73 | . = ALIGN (16); |
---|
| 74 | __start_set_sysctl_set = .; |
---|
| 75 | *(set_sysctl_*); |
---|
| 76 | __stop_set_sysctl_set = ABSOLUTE(.); |
---|
| 77 | *(set_domain_*); |
---|
| 78 | *(set_pseudo_*); |
---|
| 79 | |
---|
| 80 | /* .gnu.warning sections are handled specially by elf32.em |
---|
| 81 | */ |
---|
| 82 | *(.gnu.warning) |
---|
| 83 | *(.gnu.linkonce.t*) |
---|
| 84 | } > RAM |
---|
| 85 | |
---|
| 86 | /* Finalization code */ |
---|
| 87 | .fini : { PROVIDE (_fini = .); |
---|
| 88 | *ecrti.o(.fini) |
---|
| 89 | KEEP(*(.fini)) |
---|
| 90 | *ecrtn.o(.fini) |
---|
| 91 | } > RAM |
---|
| 92 | |
---|
| 93 | /* Miscellaneous read-only data */ |
---|
[44d18b9] | 94 | .rodata : { *(.rodata.* .gnu.linkonce.r*) KEEP (*(SORT(.rtemsroset.*))) } > RAM |
---|
[16a8616] | 95 | .rodata1 : { *(.rodata1) } > RAM |
---|
| 96 | |
---|
[960fd85] | 97 | .tdata : { |
---|
| 98 | _TLS_Data_begin = .; |
---|
| 99 | *(.tdata .tdata.* .gnu.linkonce.td.*) |
---|
| 100 | _TLS_Data_end = .; |
---|
| 101 | } >RAM |
---|
| 102 | |
---|
| 103 | .tbss : { |
---|
| 104 | _TLS_BSS_begin = .; |
---|
| 105 | *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) |
---|
| 106 | _TLS_BSS_end = .; |
---|
| 107 | } >RAM |
---|
| 108 | |
---|
| 109 | _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin; |
---|
[d60e760] | 110 | _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin; |
---|
| 111 | _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin; |
---|
[960fd85] | 112 | _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin; |
---|
| 113 | _TLS_Size = _TLS_BSS_end - _TLS_Data_begin; |
---|
[d60e760] | 114 | _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss)); |
---|
[960fd85] | 115 | |
---|
[16a8616] | 116 | /* Initialised small data addressed as offsets from r2 */ |
---|
[8e980e61] | 117 | .sdata2 : { PROVIDE (_SDA2_BASE_ = 32768); *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) } > RAM |
---|
[16a8616] | 118 | |
---|
| 119 | /* Zeroed small data addressed as offsets from r2 */ |
---|
| 120 | .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) |
---|
| 121 | |
---|
| 122 | /* Avoid empty sdata2/sbss2 area: __eabi would not set up |
---|
| 123 | * r2 which may be important if run-time loading is used |
---|
| 124 | */ |
---|
| 125 | . += 1; |
---|
| 126 | |
---|
| 127 | PROVIDE (__SBSS2_END__ = .); |
---|
| 128 | } > RAM |
---|
| 129 | |
---|
| 130 | /* Exception frame info */ |
---|
| 131 | .eh_frame : { *(.eh_frame .eh_frame.*) } > RAM |
---|
| 132 | .eh_frame_hdr : { *(.eh_frame_hdr) } > RAM |
---|
| 133 | |
---|
| 134 | /* Declares where the .text section ends */ |
---|
| 135 | _etext = .; |
---|
| 136 | PROVIDE (etext = .); |
---|
| 137 | |
---|
| 138 | /* Initialized R/W Data section goes in RAM */ |
---|
| 139 | .data : { PROVIDE(__DATA_START__ = ABSOLUTE(.) ); |
---|
| 140 | *(.data) |
---|
| 141 | *(.data.*) |
---|
[b618d8c] | 142 | KEEP (*(SORT(.rtemsrwset.*))) |
---|
[16a8616] | 143 | *(.gnu.linkonce.d*) |
---|
| 144 | } > RAM |
---|
| 145 | |
---|
| 146 | .data1 : { *(.data1) } > RAM |
---|
| 147 | |
---|
| 148 | PROVIDE (__EXCEPT_START__ = .); |
---|
| 149 | .gcc_except_table : { *(.gcc_except_table .gcc_except_table.*) } > RAM |
---|
| 150 | PROVIDE (__EXCEPT_END__ = .); |
---|
| 151 | |
---|
| 152 | .got1 : { *(.got1) } > RAM |
---|
| 153 | |
---|
| 154 | /* Put .ctors and .dtors next to the .got2 section, so that the pointers |
---|
| 155 | * get relocated with -mrelocatable. Also put in the .fixup pointers. |
---|
| 156 | * The current compiler no longer needs this, but keep it around for 2.7.2. |
---|
| 157 | */ |
---|
| 158 | PROVIDE (_GOT2_START_ = .); |
---|
| 159 | .got2 : { *(.got2) } > RAM |
---|
| 160 | |
---|
| 161 | .dynamic : { *(.dynamic) } > RAM |
---|
| 162 | |
---|
| 163 | .ctors : { /* gcc uses crtbegin.o to find the start of |
---|
| 164 | * the constructors, so we make sure it is |
---|
| 165 | * first. Because this is a wildcard, it |
---|
| 166 | * doesn't matter if the user does not |
---|
| 167 | * actually link against crtbegin.o; the |
---|
| 168 | * linker won't look for a file to match a |
---|
| 169 | * wildcard. The wildcard also means that it |
---|
| 170 | * doesn't matter which directory crtbegin.o |
---|
| 171 | * is in. |
---|
| 172 | */ |
---|
| 173 | KEEP (*crtbegin.o(.ctors)) |
---|
| 174 | /* We don't want to include the .ctor section from |
---|
| 175 | * the crtend.o file until after the sorted ctors. |
---|
| 176 | * The .ctor section from the crtend file contains the |
---|
| 177 | * end of ctors marker and it must be last. |
---|
| 178 | */ |
---|
| 179 | KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) |
---|
| 180 | KEEP (*(SORT(.ctors.*))) |
---|
| 181 | KEEP (*(.ctors)) |
---|
| 182 | } > RAM |
---|
| 183 | |
---|
| 184 | .dtors : { KEEP (*crtbegin.o(.dtors)) |
---|
| 185 | KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) |
---|
| 186 | KEEP (*(SORT(.dtors.*))) |
---|
| 187 | KEEP (*(.dtors)) |
---|
| 188 | } > RAM |
---|
| 189 | |
---|
| 190 | PROVIDE (_FIXUP_START_ = .); |
---|
| 191 | .fixup : { *(.fixup) } > RAM |
---|
| 192 | PROVIDE (_FIXUP_END_ = .); |
---|
| 193 | |
---|
| 194 | PROVIDE (_GOT2_END_ = .); |
---|
| 195 | |
---|
| 196 | PROVIDE (_GOT_START_ = .); |
---|
| 197 | .got : { __got_start = .; |
---|
| 198 | *(.got) |
---|
| 199 | } > RAM |
---|
| 200 | |
---|
| 201 | .got.plt : { *(.got.plt) } > RAM |
---|
| 202 | PROVIDE (_GOT_END_ = .); |
---|
| 203 | |
---|
| 204 | .jcr : { KEEP (*(.jcr)) } > RAM |
---|
| 205 | |
---|
| 206 | /* We want the small data sections together, so single-instruction offsets |
---|
| 207 | * can access them all, and initialized data all before uninitialized, so |
---|
| 208 | * we can shorten the on-disk segment size. |
---|
| 209 | */ |
---|
| 210 | /* Initialised small data addressed as offsets from r13 */ |
---|
[8e980e61] | 211 | .sdata : { PROVIDE (_SDA_BASE_ = 32768); *(.sdata* .gnu.linkonce.s.*) } > RAM |
---|
[16a8616] | 212 | |
---|
| 213 | _edata = .; |
---|
| 214 | PROVIDE (edata = .); |
---|
| 215 | |
---|
| 216 | /* Zeroed small data addressed as offsets from r13 */ |
---|
| 217 | .sbss : { PROVIDE (__sbss_start = .); |
---|
| 218 | *(.dynsbss) |
---|
| 219 | *(.sbss*) |
---|
| 220 | *(.gnu.linkonce.sb.*) |
---|
| 221 | *(.scommon) |
---|
| 222 | |
---|
| 223 | /* Avoid empty sdata/sbss area: __eabi would not set up |
---|
| 224 | * r13, which may be important if run-time loading is used |
---|
| 225 | */ |
---|
| 226 | . += 1; |
---|
| 227 | |
---|
| 228 | PROVIDE (__SBSS_END__ = .); |
---|
| 229 | PROVIDE (__sbss_end = .); |
---|
| 230 | } > RAM |
---|
| 231 | |
---|
| 232 | .plt : { *(.plt) } > RAM |
---|
| 233 | .iplt : { *(.iplt) } > RAM |
---|
| 234 | |
---|
| 235 | /* Zeroed large data */ |
---|
| 236 | .bss : { PROVIDE (__bss_start = .); |
---|
| 237 | *(.dynbss) |
---|
| 238 | *(.bss) |
---|
| 239 | *(.bss.*) |
---|
| 240 | *(.gnu.linkonce.b*) |
---|
| 241 | *(COMMON) |
---|
| 242 | |
---|
| 243 | PROVIDE (__bss_end = ALIGN(4)); |
---|
| 244 | __bss_size = __bss_end - __bss_start; |
---|
| 245 | } > RAM |
---|
| 246 | |
---|
| 247 | __exeend = ALIGN(4); |
---|
| 248 | __rtems_end = .; |
---|
| 249 | . = ALIGN(0x10); /* Align to a cache-line boundary */ |
---|
| 250 | PROVIDE(__bsp_ram_start = .); |
---|
| 251 | |
---|
[715d616] | 252 | .rtemsstack (NOLOAD) : { |
---|
| 253 | *(SORT(.rtemsstack.*)) |
---|
| 254 | } >RAM |
---|
| 255 | |
---|
| 256 | WorkAreaBase = .; |
---|
[16a8616] | 257 | |
---|
| 258 | /* The heap comes after the work space */ |
---|
| 259 | |
---|
| 260 | . = RamBase + RamSize; |
---|
| 261 | PROVIDE(__bsp_ram_end = .); |
---|
| 262 | |
---|
| 263 | /* Message area for capturing early printk output */ |
---|
| 264 | /* Placed here to be easily findable with a debugger */ |
---|
[5b822ab] | 265 | MsgAreaBase = .; |
---|
[16a8616] | 266 | . += MsgAreaSize; |
---|
| 267 | |
---|
| 268 | __phy_ram_end = .; /* True end of physical memory */ |
---|
| 269 | |
---|
| 270 | /DISCARD/ : |
---|
| 271 | { |
---|
| 272 | *(.comment) |
---|
| 273 | } |
---|
| 274 | |
---|
| 275 | /* Some configuration constants: Not clear why they're placed here */ |
---|
| 276 | __dccr = 0x80000000; |
---|
| 277 | __iccr = 0x80000000; |
---|
| 278 | __sgr = 0x7fffffff; |
---|
| 279 | __vectors = 0; |
---|
| 280 | } |
---|