| 1 | /* Default linker script, for normal executables  | 
|---|
| 2 |  | 
|---|
| 3 | Copyright (c) 2008, 2009 Xilinx, Inc.  All rights reserved. | 
|---|
| 4 |  | 
|---|
| 5 | Redistribution and use in source and binary forms, with or without | 
|---|
| 6 | modification, are permitted provided that the following conditions are | 
|---|
| 7 | met: | 
|---|
| 8 |  | 
|---|
| 9 | 1.  Redistributions source code must retain the above copyright notice, | 
|---|
| 10 | this list of conditions and the following disclaimer.  | 
|---|
| 11 |  | 
|---|
| 12 | 2.  Redistributions in binary form must reproduce the above copyright | 
|---|
| 13 | notice, this list of conditions and the following disclaimer in the | 
|---|
| 14 | documentation and/or other materials provided with the distribution.  | 
|---|
| 15 |  | 
|---|
| 16 | 3.  Neither the name of Xilinx nor the names of its contributors may be | 
|---|
| 17 | used to endorse or promote products derived from this software without | 
|---|
| 18 | specific prior written permission.  | 
|---|
| 19 |  | 
|---|
| 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS | 
|---|
| 21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 
|---|
| 22 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | 
|---|
| 23 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 
|---|
| 24 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 
|---|
| 25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED | 
|---|
| 26 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 
|---|
| 27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | 
|---|
| 28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | 
|---|
| 29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 
|---|
| 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
|---|
| 31 | */ | 
|---|
| 32 |  | 
|---|
| 33 | OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", | 
|---|
| 34 |               "elf32-powerpc") | 
|---|
| 35 | OUTPUT_ARCH(powerpc:common) | 
|---|
| 36 | ENTRY(_boot) | 
|---|
| 37 | _START_ADDR = DEFINED(_START_ADDR) ? _START_ADDR : 0xFFFF0000; | 
|---|
| 38 | _STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : 4k; | 
|---|
| 39 | _HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 4k; | 
|---|
| 40 | STARTUP(boot.o) | 
|---|
| 41 | /* Do we need any of these for elf? | 
|---|
| 42 |    __DYNAMIC = 0;    */ | 
|---|
| 43 | PROVIDE (__stack = 0); PROVIDE (___stack = 0); | 
|---|
| 44 | SECTIONS | 
|---|
| 45 | { | 
|---|
| 46 |  | 
|---|
| 47 |   . = _START_ADDR; | 
|---|
| 48 |   .vectors  BLOCK (64k): | 
|---|
| 49 |   { | 
|---|
| 50 |     *(.vectors) | 
|---|
| 51 |   } | 
|---|
| 52 |   /* Read-only sections, merged into text segment: */ | 
|---|
| 53 |   .hash           : { *(.hash)          } | 
|---|
| 54 |   .dynsym         : { *(.dynsym)                } | 
|---|
| 55 |   .dynstr         : { *(.dynstr)                } | 
|---|
| 56 |   .gnu.version   : { *(.gnu.version)      } | 
|---|
| 57 |   .gnu.version_d   : { *(.gnu.version_d)  } | 
|---|
| 58 |   .gnu.version_r   : { *(.gnu.version_r)  } | 
|---|
| 59 |   .rela.text     : | 
|---|
| 60 |     { | 
|---|
| 61 |       *(.rela.text) | 
|---|
| 62 |       *(.rela.text.*) | 
|---|
| 63 |       *(.rela.gnu.linkonce.t*) | 
|---|
| 64 |     } | 
|---|
| 65 |   .rela.data     : | 
|---|
| 66 |     { | 
|---|
| 67 |       *(.rela.data) | 
|---|
| 68 |       *(.rela.data.*) | 
|---|
| 69 |       *(.rela.gnu.linkonce.d*) | 
|---|
| 70 |     } | 
|---|
| 71 |   .rela.rodata   : | 
|---|
| 72 |     { | 
|---|
| 73 |       *(.rela.rodata) | 
|---|
| 74 |       *(.rela.rodata.*) | 
|---|
| 75 |       *(.rela.gnu.linkonce.r*) | 
|---|
| 76 |     } | 
|---|
| 77 |   .rela.got       : { *(.rela.got)      } | 
|---|
| 78 |   .rela.got1      : { *(.rela.got1)     } | 
|---|
| 79 |   .rela.got2      : { *(.rela.got2)     } | 
|---|
| 80 |   .rela.ctors     : { *(.rela.ctors)    } | 
|---|
| 81 |   .rela.dtors     : { *(.rela.dtors)    } | 
|---|
| 82 |   .rela.init      : { *(.rela.init)     } | 
|---|
| 83 |   .rela.fini      : { *(.rela.fini)     } | 
|---|
| 84 |   .rela.bss       : { *(.rela.bss)      } | 
|---|
| 85 |   .rela.plt       : { *(.rela.plt)      } | 
|---|
| 86 |   .rela.sdata     : { *(.rela.sdata)    } | 
|---|
| 87 |   .rela.sbss      : { *(.rela.sbss)     } | 
|---|
| 88 |   .rela.sdata2    : { *(.rela.sdata2)   } | 
|---|
| 89 |   .rela.sbss2     : { *(.rela.sbss2)    } | 
|---|
| 90 |   .text      : | 
|---|
| 91 |   { | 
|---|
| 92 |     *(.text) | 
|---|
| 93 |     *(.text.*) | 
|---|
| 94 |     /* .gnu.warning sections are handled specially by elf32.em.  */ | 
|---|
| 95 |     *(.gnu.warning) | 
|---|
| 96 |     *(.gnu.linkonce.t.*) | 
|---|
| 97 |   } =0 | 
|---|
| 98 |   .init           : { KEEP (*(.init))   } =0 | 
|---|
| 99 |   .fini           : { KEEP (*(.fini))   } =0 | 
|---|
| 100 |   .rodata    : | 
|---|
| 101 |   { | 
|---|
| 102 |     *(.rodata) | 
|---|
| 103 |     *(.rodata.*) | 
|---|
| 104 |     *(.gnu.linkonce.r.*) | 
|---|
| 105 |   } | 
|---|
| 106 |   .rodata1        : { *(.rodata1) } | 
|---|
| 107 |   _etext = .; | 
|---|
| 108 |   PROVIDE (etext = .); | 
|---|
| 109 |   PROVIDE (__etext = .); | 
|---|
| 110 |   .sdata2   : { *(.sdata2) *(.sdata2.*) *(.gnu.linkonce.s2.*)} | 
|---|
| 111 |   __SDATA2_START__ = ADDR(.sdata2); | 
|---|
| 112 |   __SDATA2_END__ = ADDR(.sdata2) + SIZEOF(.sdata2); | 
|---|
| 113 |   .sbss2   : { *(.sbss2) *(.gnu.linkonce.sb2.*)} | 
|---|
| 114 |   __SBSS2_START__ = ADDR(.sbss2); | 
|---|
| 115 |   __SBSS2_END__ = ADDR(.sbss2) + SIZEOF(.sbss2); | 
|---|
| 116 |   /* Adjust the address for the data segment.  We want to adjust up to | 
|---|
| 117 |      the same address within the page on the next page up.  It would | 
|---|
| 118 |      be more correct to do this: | 
|---|
| 119 |        . = ALIGN(0x08) + (ALIGN(8) & (0x08 - 1)); | 
|---|
| 120 |      The current expression does not correctly handle the case of a | 
|---|
| 121 |      text segment ending precisely at the end of a page; it causes the | 
|---|
| 122 |      data segment to skip a page.  The above expression does not have | 
|---|
| 123 |      this problem, but it will currently (2/95) cause BFD to allocate | 
|---|
| 124 |      a single segment, combining both text and data, for this case. | 
|---|
| 125 |      This will prevent the text segment from being shared among | 
|---|
| 126 |      multiple executions of the program; I think that is more | 
|---|
| 127 |      important than losing a page of the virtual address space (note | 
|---|
| 128 |      that no actual memory is lost; the page which is skipped can not | 
|---|
| 129 |      be referenced).  */ | 
|---|
| 130 | /*  . =  ALIGN(8) + 0x08;*/ | 
|---|
| 131 |   .data    : | 
|---|
| 132 |   { | 
|---|
| 133 |     *(.data) | 
|---|
| 134 |     *(.data.*) | 
|---|
| 135 |     *(.gnu.linkonce.d*) | 
|---|
| 136 |     CONSTRUCTORS | 
|---|
| 137 |   } | 
|---|
| 138 |   .data1   : { *(.data1) } | 
|---|
| 139 |   .got1           : { *(.got1) } | 
|---|
| 140 |   .dynamic        : { *(.dynamic) } | 
|---|
| 141 |   /* Put .ctors and .dtors next to the .got2 section, so that the pointers | 
|---|
| 142 |      get relocated with -mrelocatable. Also put in the .fixup pointers. | 
|---|
| 143 |      The current compiler no longer needs this, but keep it around for 2.7.2  */ | 
|---|
| 144 |                 PROVIDE (_GOT2_START_ = .); | 
|---|
| 145 |                 PROVIDE (__GOT2_START_ = .); | 
|---|
| 146 |   .got2           :  { *(.got2) } | 
|---|
| 147 |                 PROVIDE (__CTOR_LIST__ = .); | 
|---|
| 148 |                 PROVIDE (___CTOR_LIST__ = .); | 
|---|
| 149 |                 .ctors   : | 
|---|
| 150 |   { | 
|---|
| 151 |     /* gcc uses crtbegin.o to find the start of | 
|---|
| 152 |        the constructors, so we make sure it is | 
|---|
| 153 |        first.  Because this is a wildcard, it | 
|---|
| 154 |        doesn't matter if the user does not | 
|---|
| 155 |        actually link against crtbegin.o; the | 
|---|
| 156 |        linker won't look for a file to match a | 
|---|
| 157 |        wildcard.  The wildcard also means that it | 
|---|
| 158 |        doesn't matter which directory crtbegin.o | 
|---|
| 159 |        is in.  */ | 
|---|
| 160 |     KEEP (*crtbegin.o(.ctors)) | 
|---|
| 161 |     /* We don't want to include the .ctor section from | 
|---|
| 162 |        from the crtend.o file until after the sorted ctors. | 
|---|
| 163 |        The .ctor section from the crtend file contains the | 
|---|
| 164 |        end of ctors marker and it must be last */ | 
|---|
| 165 |     KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) | 
|---|
| 166 |     KEEP (*(SORT(.ctors.*))) | 
|---|
| 167 |     KEEP (*(.ctors)) | 
|---|
| 168 |   } | 
|---|
| 169 |                 PROVIDE (__CTOR_END__ = .); | 
|---|
| 170 |                 PROVIDE (___CTOR_END__ = .); | 
|---|
| 171 |                 PROVIDE (__DTOR_LIST__ = .); | 
|---|
| 172 |                 PROVIDE (___DTOR_LIST__ = .); | 
|---|
| 173 |                  .dtors         : | 
|---|
| 174 |   { | 
|---|
| 175 |     KEEP (*crtbegin.o(.dtors)) | 
|---|
| 176 |     KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) | 
|---|
| 177 |     KEEP (*(SORT(.dtors.*))) | 
|---|
| 178 |     KEEP (*(.dtors)) | 
|---|
| 179 |   } | 
|---|
| 180 |                 PROVIDE (__DTOR_END__ = .); | 
|---|
| 181 |                 PROVIDE (___DTOR_END__ = .); | 
|---|
| 182 |                 PROVIDE (_FIXUP_START_ = .); | 
|---|
| 183 |                 PROVIDE (__FIXUP_START_ = .); | 
|---|
| 184 |   .fixup          : { *(.fixup) } | 
|---|
| 185 |                 PROVIDE (_FIXUP_END_ = .); | 
|---|
| 186 |                 PROVIDE (__FIXUP_END_ = .); | 
|---|
| 187 |                 PROVIDE (_GOT2_END_ = .); | 
|---|
| 188 |                 PROVIDE (__GOT2_END_ = .); | 
|---|
| 189 |                 PROVIDE (_GOT_START_ = .); | 
|---|
| 190 |                 PROVIDE (__GOT_START_ = .); | 
|---|
| 191 |   .got            : { *(.got) } | 
|---|
| 192 |   .got.plt        : { *(.got.plt) } | 
|---|
| 193 |                 PROVIDE (_GOT_END_ = .); | 
|---|
| 194 |                 PROVIDE (__GOT_END_ = .); | 
|---|
| 195 |   /* Added by Sathya to handle C++ exceptions */ | 
|---|
| 196 |   .eh_frame   : { | 
|---|
| 197 |     *(.eh_frame) | 
|---|
| 198 |   } | 
|---|
| 199 |   .jcr   : { | 
|---|
| 200 |     *(.jcr) | 
|---|
| 201 |   } | 
|---|
| 202 |   .gcc_except_table   : { | 
|---|
| 203 |     *(.gcc_except_table) | 
|---|
| 204 |   } | 
|---|
| 205 |   /* We want the small data sections together, so single-instruction offsets | 
|---|
| 206 |      can access them all, and initialized data all before uninitialized, so | 
|---|
| 207 |      we can shorten the on-disk segment size.  */ | 
|---|
| 208 |   .sdata          : { *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*)} | 
|---|
| 209 |   __SDATA_START__ = ADDR(.sdata); | 
|---|
| 210 |   __SDATA_END__ = ADDR(.sdata) + SIZEOF(.sdata); | 
|---|
| 211 |   _edata  =  .; | 
|---|
| 212 |   PROVIDE (edata = .); | 
|---|
| 213 |   PROVIDE (__edata = .); | 
|---|
| 214 |   .sbss      : | 
|---|
| 215 |   { | 
|---|
| 216 |     __sbss_start = .; | 
|---|
| 217 |     ___sbss_start = .; | 
|---|
| 218 |     *(.sbss) | 
|---|
| 219 |     *(.sbss.*) | 
|---|
| 220 |     *(.gnu.linkonce.sb.*) | 
|---|
| 221 |     *(.scommon) | 
|---|
| 222 |     *(.dynsbss) | 
|---|
| 223 |     __sbss_end = .; | 
|---|
| 224 |     ___sbss_end = .; | 
|---|
| 225 |   } | 
|---|
| 226 |   .plt   : { *(.plt) } | 
|---|
| 227 |   .bss       : | 
|---|
| 228 |   { | 
|---|
| 229 |    __bss_start = .; | 
|---|
| 230 |    ___bss_start = .; | 
|---|
| 231 |    *(.dynbss) | 
|---|
| 232 |    *(.bss) | 
|---|
| 233 |    *(.bss.*) | 
|---|
| 234 |    *(.gnu.linkonce.b.*) | 
|---|
| 235 |    *(COMMON) | 
|---|
| 236 |    . = ALIGN(4); | 
|---|
| 237 |    __bss_end = .; | 
|---|
| 238 |   } | 
|---|
| 239 |  | 
|---|
| 240 |   .stack     : | 
|---|
| 241 |   {  | 
|---|
| 242 |     _stack_end = .; | 
|---|
| 243 |     . = . + _STACK_SIZE; | 
|---|
| 244 |     . = ALIGN(16); | 
|---|
| 245 |     __stack = .; | 
|---|
| 246 |   } | 
|---|
| 247 |  | 
|---|
| 248 |   .heap      : | 
|---|
| 249 |   { | 
|---|
| 250 |     _heap_start = .; | 
|---|
| 251 |     . = . + _HEAP_SIZE; | 
|---|
| 252 |     . = ALIGN(16); | 
|---|
| 253 |     _heap_end = .; | 
|---|
| 254 |   } | 
|---|
| 255 |  | 
|---|
| 256 |   .tdata   : { | 
|---|
| 257 |     *(.tdata) | 
|---|
| 258 |     *(.tdata.*) | 
|---|
| 259 |     *(.gnu.linkonce.td.*) | 
|---|
| 260 |   } | 
|---|
| 261 |   .tbss   : { | 
|---|
| 262 |     *(.tbss) | 
|---|
| 263 |     *(.gnu.linkonce.tb.*) | 
|---|
| 264 |   } | 
|---|
| 265 |   /* Check to see if boot0 is going to be within 24bits from boot */ | 
|---|
| 266 |   /* If so, then leave the location counter as is. */ | 
|---|
| 267 |   /* If not, then make location counter to be 0x20 locations above boot location */ | 
|---|
| 268 |   /* This assumes that a BRAM is present for boot and hence 0x20 locations above it are valid */ | 
|---|
| 269 |   /* This fixes CR 183394 */ | 
|---|
| 270 |  __boot0_flag__ = ((. > 0x00ffffff) && (. < 0xff000000)) ? 1 : 0; | 
|---|
| 271 |  . = (__boot0_flag__) ? 0xffffffdc : .; | 
|---|
| 272 |   .boot0  : { *(.boot0)} | 
|---|
| 273 |   _end = . ; | 
|---|
| 274 |   end = .; | 
|---|
| 275 |   __end = .; | 
|---|
| 276 |   .boot  0xFFFFFFFC  : { *(.boot) } | 
|---|
| 277 |   /* These are needed for ELF backends which have not yet been | 
|---|
| 278 |      converted to the new style linker.  */ | 
|---|
| 279 |   .stab 0 : { *(.stab) } | 
|---|
| 280 |   .stabstr 0 : { *(.stabstr) } | 
|---|
| 281 |   /* DWARF debug sections. | 
|---|
| 282 |      Symbols in the DWARF debugging sections are relative to the beginning | 
|---|
| 283 |      of the section so we begin them at 0.  */ | 
|---|
| 284 |   /* DWARF 1 */ | 
|---|
| 285 |   .debug          0 : { *(.debug) } | 
|---|
| 286 |   .line           0 : { *(.line) } | 
|---|
| 287 |   /* GNU DWARF 1 extensions */ | 
|---|
| 288 |   .debug_srcinfo  0 : { *(.debug_srcinfo) } | 
|---|
| 289 |   .debug_sfnames  0 : { *(.debug_sfnames) } | 
|---|
| 290 |   /* DWARF 1.1 and DWARF 2 */ | 
|---|
| 291 |   .debug_aranges  0 : { *(.debug_aranges) } | 
|---|
| 292 |   .debug_pubnames 0 : { *(.debug_pubnames) } | 
|---|
| 293 |   /* DWARF 2 */ | 
|---|
| 294 |   .debug_info     0 : { *(.debug_info) } | 
|---|
| 295 |   .debug_abbrev   0 : { *(.debug_abbrev) } | 
|---|
| 296 |   .debug_line     0 : { *(.debug_line) } | 
|---|
| 297 |   .debug_frame    0 : { *(.debug_frame) } | 
|---|
| 298 |   .debug_str      0 : { *(.debug_str) } | 
|---|
| 299 |   .debug_loc      0 : { *(.debug_loc) } | 
|---|
| 300 |   .debug_macinfo  0 : { *(.debug_macinfo) } | 
|---|
| 301 |   /* SGI/MIPS DWARF 2 extensions */ | 
|---|
| 302 |   .debug_weaknames 0 : { *(.debug_weaknames) } | 
|---|
| 303 |   .debug_funcnames 0 : { *(.debug_funcnames) } | 
|---|
| 304 |   .debug_typenames 0 : { *(.debug_typenames) } | 
|---|
| 305 |   .debug_varnames  0 : { *(.debug_varnames) } | 
|---|
| 306 |   /* These must appear regardless of  .  */ | 
|---|
| 307 | } | 
|---|