| 1 | OUTPUT_FORMAT("elf32-mt", "elf32-mt", "elf32-mt") | 
|---|
| 2 | OUTPUT_ARCH(mt) | 
|---|
| 3 | ENTRY(__boot_start) | 
|---|
| 4 |  | 
|---|
| 5 | /* Do we need any of these for elf? | 
|---|
| 6 |    __DYNAMIC = 0;    */ | 
|---|
| 7 | MEMORY | 
|---|
| 8 | { | 
|---|
| 9 |   rom (rx) : ORIGIN = 0x000000, LENGTH = 8M | 
|---|
| 10 |   frame-buffer (w) : ORIGIN = 0x800000, LENGTH = 64K | 
|---|
| 11 |   ram (w) : ORIGIN = 0xc00000, LENGTH = 4M | 
|---|
| 12 |   dma-ram (w) : ORIGIN = 0x1000000, LENGTH = 16M | 
|---|
| 13 | } | 
|---|
| 14 | SECTIONS | 
|---|
| 15 | { | 
|---|
| 16 |   /* Read-only sections, merged into text segment: */ | 
|---|
| 17 |   PROVIDE (__executable_start = 0x0); . = 0x0; | 
|---|
| 18 |   .interp         : { *(.interp) } | 
|---|
| 19 |   .hash           : { *(.hash) } | 
|---|
| 20 |   .dynsym         : { *(.dynsym) } | 
|---|
| 21 |   .dynstr         : { *(.dynstr) } | 
|---|
| 22 |   .gnu.version    : { *(.gnu.version) } | 
|---|
| 23 |   .gnu.version_d  : { *(.gnu.version_d) } | 
|---|
| 24 |   .gnu.version_r  : { *(.gnu.version_r) } | 
|---|
| 25 |   .rel.init       : { *(.rel.init) } | 
|---|
| 26 |   .rela.init      : { *(.rela.init) } | 
|---|
| 27 |   .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } | 
|---|
| 28 |   .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } | 
|---|
| 29 |   .rel.fini       : { *(.rel.fini) } | 
|---|
| 30 |   .rela.fini      : { *(.rela.fini) } | 
|---|
| 31 |   .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } | 
|---|
| 32 |   .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } | 
|---|
| 33 |   .rel.data.rel.ro  : { *(.rel.data.rel.ro*) } | 
|---|
| 34 |   .rela.data.rel.ro : { *(.rel.data.rel.ro*) } | 
|---|
| 35 |   .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } | 
|---|
| 36 |   .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } | 
|---|
| 37 |   .rel.tdata      : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } | 
|---|
| 38 |   .rela.tdata     : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } | 
|---|
| 39 |   .rel.tbss       : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } | 
|---|
| 40 |   .rela.tbss      : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } | 
|---|
| 41 |   .rel.ctors      : { *(.rel.ctors) } | 
|---|
| 42 |   .rela.ctors     : { *(.rela.ctors) } | 
|---|
| 43 |   .rel.dtors      : { *(.rel.dtors) } | 
|---|
| 44 |   .rela.dtors     : { *(.rela.dtors) } | 
|---|
| 45 |   .rel.got        : { *(.rel.got) } | 
|---|
| 46 |   .rela.got       : { *(.rela.got) } | 
|---|
| 47 |   .rel.sdata      : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) } | 
|---|
| 48 |   .rela.sdata     : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) } | 
|---|
| 49 |   .rel.sbss       : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) } | 
|---|
| 50 |   .rela.sbss      : { *(.rela.sbss .rela.sbss.* .rel.gnu.linkonce.sb.*) } | 
|---|
| 51 |   .rel.sdata2     : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) } | 
|---|
| 52 |   .rela.sdata2    : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) } | 
|---|
| 53 |   .rel.sbss2      : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) } | 
|---|
| 54 |   .rela.sbss2     : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) } | 
|---|
| 55 |   .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } | 
|---|
| 56 |   .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } | 
|---|
| 57 |   .rel.plt        : { *(.rel.plt) } | 
|---|
| 58 |   .rela.plt       : { *(.rela.plt) } | 
|---|
| 59 |  | 
|---|
| 60 |   .startup        : { *startup-64-001.o(.startup) } >rom =0 | 
|---|
| 61 |  | 
|---|
| 62 |   .init           : { KEEP (*(.init)) } >rom =0 | 
|---|
| 63 |   .plt            : { *(.plt) } >rom  | 
|---|
| 64 |   .text           : | 
|---|
| 65 |   { | 
|---|
| 66 |     *startup-64-001.o(.text) | 
|---|
| 67 |     *(.text .stub .text.* .gnu.linkonce.t.*) | 
|---|
| 68 |     /* .gnu.warning sections are handled specially by elf32.em.  */ | 
|---|
| 69 |     *(.gnu.warning) | 
|---|
| 70 |   } >rom =0 | 
|---|
| 71 |   .fini           : | 
|---|
| 72 |   { | 
|---|
| 73 |     KEEP (*(.fini)) | 
|---|
| 74 |   } >rom =0 | 
|---|
| 75 |   PROVIDE (__etext = .); | 
|---|
| 76 |   PROVIDE (_etext = .); | 
|---|
| 77 |   PROVIDE (etext = .); | 
|---|
| 78 |   .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) } >rom | 
|---|
| 79 |   .rodata1        : { *(.rodata1) } >rom | 
|---|
| 80 |  | 
|---|
| 81 |   /* Data starting here needs to be copied from ROM to the frame buffer. */ | 
|---|
| 82 |   /* Section .sdata2 is used as the beginning marker of the frame buffer | 
|---|
| 83 |      address as well as the start of the data that needs to be copied.   */ | 
|---|
| 84 |   .sdata2         : AT (ADDR(.rodata1) + SIZEOF(.rodata1)) | 
|---|
| 85 |                     { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) } >frame-buffer | 
|---|
| 86 |   .sbss2          : AT (LOADADDR(.sdata2) + SIZEOF(.sdata2)) | 
|---|
| 87 |                     { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } >frame-buffer | 
|---|
| 88 |   .eh_frame_hdr   : AT (LOADADDR(.sbss2) + SIZEOF(.sbss2)) | 
|---|
| 89 |                     { *(.eh_frame_hdr) } >frame-buffer | 
|---|
| 90 |   .eh_frame       : AT (LOADADDR(.eh_frame_hdr) + SIZEOF(.eh_frame_hdr)) | 
|---|
| 91 |                     ONLY_IF_RO { KEEP (*(.eh_frame)) } >frame-buffer  | 
|---|
| 92 |   .gcc_except_table : AT (LOADADDR(.eh_frame) + SIZEOF(.eh_frame)) | 
|---|
| 93 |                     ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } >frame-buffer | 
|---|
| 94 |   /* Adjust the address for the data segment.  We want to adjust up to | 
|---|
| 95 |      the same address within the page on the next page up.  */ | 
|---|
| 96 |   . = ALIGN(256) + (. & (256 - 1)); | 
|---|
| 97 |   /* Exception handling */ | 
|---|
| 98 |   .eh_frame       : AT (LOADADDR(.eh_frame_hdr) + SIZEOF(.eh_frame_hdr)) | 
|---|
| 99 |                     ONLY_IF_RW { KEEP (*(.eh_frame)) } >frame-buffer  | 
|---|
| 100 |   .gcc_except_table : AT (LOADADDR(.eh_frame) + SIZEOF(.eh_frame)) | 
|---|
| 101 |                     ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } >frame-buffer | 
|---|
| 102 |   /* Thread Local Storage sections  */ | 
|---|
| 103 |   .tdata          : AT (LOADADDR(.gcc_except_table) + SIZEOF(.gcc_except_table)) | 
|---|
| 104 |                     { *(.tdata .tdata.* .gnu.linkonce.td.*) } >frame-buffer | 
|---|
| 105 |   .tbss           : AT (LOADADDR(.tdata) + SIZEOF(.tdata)) | 
|---|
| 106 |                     { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } >frame-buffer | 
|---|
| 107 |   /* Ensure the __preinit_array_start label is properly aligned.  We | 
|---|
| 108 |      could instead move the label definition inside the section, but | 
|---|
| 109 |      the linker would then create the section even if it turns out to | 
|---|
| 110 |      be empty, which isn't pretty.  */ | 
|---|
| 111 |   . = ALIGN(32 / 8); | 
|---|
| 112 |   PROVIDE (__preinit_array_start = .); | 
|---|
| 113 |   .preinit_array  : AT (LOADADDR(.tbss) + SIZEOF(.tbss)) | 
|---|
| 114 |                     { *(.preinit_array) } >frame-buffer | 
|---|
| 115 |   PROVIDE (__preinit_array_end = .); | 
|---|
| 116 |   PROVIDE (__init_array_start = .); | 
|---|
| 117 |   .init_array     : AT (LOADADDR(.preinit_array) + SIZEOF(.preinit_array)) | 
|---|
| 118 |                     { *(.init_array) } >frame-buffer | 
|---|
| 119 |   PROVIDE (__init_array_end = .); | 
|---|
| 120 |   PROVIDE (__fini_array_start = .); | 
|---|
| 121 |   .fini_array     : AT (LOADADDR(.init_array) + SIZEOF(.init_array)) | 
|---|
| 122 |                     { *(.fini_array) } >frame-buffer | 
|---|
| 123 |   PROVIDE (__fini_array_end = .); | 
|---|
| 124 |   .ctors          : AT (LOADADDR(.fini_array) + SIZEOF(.fini_array)) | 
|---|
| 125 |   { | 
|---|
| 126 |     /* gcc uses crtbegin.o to find the start of | 
|---|
| 127 |        the constructors, so we make sure it is | 
|---|
| 128 |        first.  Because this is a wildcard, it | 
|---|
| 129 |        doesn't matter if the user does not | 
|---|
| 130 |        actually link against crtbegin.o; the | 
|---|
| 131 |        linker won't look for a file to match a | 
|---|
| 132 |        wildcard.  The wildcard also means that it | 
|---|
| 133 |        doesn't matter which directory crtbegin.o | 
|---|
| 134 |        is in.  */ | 
|---|
| 135 |     KEEP (*crtbegin*.o(.ctors)) | 
|---|
| 136 |     /* We don't want to include the .ctor section from | 
|---|
| 137 |        from the crtend.o file until after the sorted ctors. | 
|---|
| 138 |        The .ctor section from the crtend file contains the | 
|---|
| 139 |        end of ctors marker and it must be last */ | 
|---|
| 140 |     KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) | 
|---|
| 141 |     KEEP (*(SORT(.ctors.*))) | 
|---|
| 142 |     KEEP (*(.ctors)) | 
|---|
| 143 |   } >frame-buffer | 
|---|
| 144 |   .dtors : AT (LOADADDR(.ctors) + SIZEOF(.ctors)) | 
|---|
| 145 |   { | 
|---|
| 146 |     KEEP (*crtbegin.o(.dtors)) | 
|---|
| 147 |     KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) | 
|---|
| 148 |     KEEP (*(SORT(.dtors.*))) | 
|---|
| 149 |     KEEP (*(.dtors)) | 
|---|
| 150 |   } >frame-buffer | 
|---|
| 151 |   .jcr            : AT (LOADADDR(.dtors) + SIZEOF(.dtors)) | 
|---|
| 152 |                     { KEEP (*(.jcr)) } >frame-buffer | 
|---|
| 153 |   .data.rel.ro    : AT (LOADADDR(.jcr) + SIZEOF(.jcr)) | 
|---|
| 154 |                     { *(.data.rel.ro.local) *(.data.rel.ro*) } >frame-buffer | 
|---|
| 155 |   .dynamic        : AT (LOADADDR(.data.rel.ro) + SIZEOF(.data.rel.ro)) | 
|---|
| 156 |                     { *(.dynamic) } >frame-buffer | 
|---|
| 157 |  | 
|---|
| 158 |   /* DJK - Re-align the data section from the read-only section. */ | 
|---|
| 159 |   . = ALIGN(16) + (. & (16 - 1)); | 
|---|
| 160 |   PROVIDE (_data = .); | 
|---|
| 161 |   .data           : AT (LOADADDR(.dynamic) + SIZEOF(.dynamic)) | 
|---|
| 162 |   { | 
|---|
| 163 |     *(.data .data.* .gnu.linkonce.d.*) | 
|---|
| 164 |     KEEP (*(.gnu.linkonce.d.*personality*)) | 
|---|
| 165 |     SORT(CONSTRUCTORS) | 
|---|
| 166 |   } >frame-buffer | 
|---|
| 167 |   .data1          : AT (LOADADDR(.data) + SIZEOF(.data)) | 
|---|
| 168 |                     { *(.data1) } >frame-buffer | 
|---|
| 169 |   .got            : AT (LOADADDR(.data1) + SIZEOF(.data1)) | 
|---|
| 170 |                     { *(.got.plt) *(.got) } | 
|---|
| 171 |  | 
|---|
| 172 |   /* We want the small data sections together, so single-instruction offsets | 
|---|
| 173 |      can access them all, and initialized data all before uninitialized, so | 
|---|
| 174 |      we can shorten the on-disk segment size.  */ | 
|---|
| 175 |   .sdata          : AT (LOADADDR(.got) + SIZEOF(.got)) | 
|---|
| 176 |                     { *(.sdata .sdata.* .gnu.linkonce.s.*) } >frame-buffer | 
|---|
| 177 |   _edata = .; | 
|---|
| 178 |   PROVIDE ( edata = . ) ; | 
|---|
| 179 |  | 
|---|
| 180 |   _fbdata_start = LOADADDR(.sdata2) ; | 
|---|
| 181 |   _fbdata_end = LOADADDR(.sdata) + SIZEOF(.sdata) - 4 ; | 
|---|
| 182 |  | 
|---|
| 183 |   PROVIDE (__FRAME_BUFFER_START = ADDR(.sdata2)); | 
|---|
| 184 |   PROVIDE (__FRAME_BUFFER_SIZE = 0x10000); | 
|---|
| 185 |   PROVIDE (__FRAME_BUFFER_END = __FRAME_BUFFER_START + __FRAME_BUFFER_SIZE); | 
|---|
| 186 |    | 
|---|
| 187 |   .sbss           : AT (LOADADDR(.sdata) + SIZEOF(.sdata)) | 
|---|
| 188 |   { | 
|---|
| 189 |     PROVIDE (__sbss_start = .); | 
|---|
| 190 |     PROVIDE (___sbss_start = .); | 
|---|
| 191 |     *(.dynsbss) | 
|---|
| 192 |     *(.sbss .sbss.* .gnu.linkonce.sb.*) | 
|---|
| 193 |     *(.scommon) | 
|---|
| 194 |     PROVIDE (__sbss_end = .); | 
|---|
| 195 |     PROVIDE (___sbss_end = .); | 
|---|
| 196 |   } >frame-buffer | 
|---|
| 197 |   .bss            : AT (LOADADDR(.sbss) + SIZEOF(.sbss)) | 
|---|
| 198 |   { | 
|---|
| 199 |     *(.dynbss) | 
|---|
| 200 |     *(.bss .bss.* .gnu.linkonce.b.*) | 
|---|
| 201 |     *(COMMON) | 
|---|
| 202 |     /* Align here to ensure that the .bss section occupies space up to | 
|---|
| 203 |        _end.  Align after .bss to ensure correct alignment even if the | 
|---|
| 204 |       .bss section disappears because there are no input sections.  */ | 
|---|
| 205 |     . = ALIGN(32 / 8); | 
|---|
| 206 |   } >frame-buffer | 
|---|
| 207 |   . = ALIGN(32 / 8); | 
|---|
| 208 |   __bss_start = ADDR(.sbss) ; | 
|---|
| 209 |   __bss_end = __bss_start + SIZEOF(.sbss) + SIZEOF(.bss) - 4 ; | 
|---|
| 210 |   _end = .; | 
|---|
| 211 |   PROVIDE (end = .); | 
|---|
| 212 |  | 
|---|
| 213 |   PROVIDE ( _extdata_start = ADDR(.bss) + SIZEOF(.bss)); | 
|---|
| 214 |   .extdata        : AT ( LOADADDR(.bss) + SIZEOF(.bss)) | 
|---|
| 215 |   { | 
|---|
| 216 |     *(.extdata) | 
|---|
| 217 |   }  >ram | 
|---|
| 218 |   PROVIDE (_extdata_end = _extdata_start + SIZEOF(.extdata) - 4 ); | 
|---|
| 219 |  | 
|---|
| 220 |   .extbss         : AT ( LOADADDR(.extdata) + SIZEOF(.extdata)) | 
|---|
| 221 |   { | 
|---|
| 222 |     _extbss_start = .; | 
|---|
| 223 |     *(.extbss); | 
|---|
| 224 |     . = ALIGN(4); | 
|---|
| 225 |     _extbss_end = .; | 
|---|
| 226 |   } >ram | 
|---|
| 227 |   . = ALIGN(4); | 
|---|
| 228 |  | 
|---|
| 229 |   PROVIDE (__EXTERNAL_MEMORY_START = 0xc00000); | 
|---|
| 230 |  | 
|---|
| 231 |   .dma : | 
|---|
| 232 |   { | 
|---|
| 233 |     _dma_start = .; | 
|---|
| 234 |     *(.dma) | 
|---|
| 235 |     _dma_end = .; | 
|---|
| 236 |   } >dma-ram | 
|---|
| 237 |  | 
|---|
| 238 |   /* Stabs debugging sections.  */ | 
|---|
| 239 |   .stab          0 : { *(.stab) } | 
|---|
| 240 |   .stabstr       0 : { *(.stabstr) } | 
|---|
| 241 |   .stab.excl     0 : { *(.stab.excl) } | 
|---|
| 242 |   .stab.exclstr  0 : { *(.stab.exclstr) } | 
|---|
| 243 |   .stab.index    0 : { *(.stab.index) } | 
|---|
| 244 |   .stab.indexstr 0 : { *(.stab.indexstr) } | 
|---|
| 245 |   .comment       0 : { *(.comment) } | 
|---|
| 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) *(.gnu.linkonce.wi.*) } | 
|---|
| 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 |  | 
|---|
| 272 |  | 
|---|
| 273 |   PROVIDE (__stack = 0x80fff0); | 
|---|
| 274 |  | 
|---|
| 275 |   .stack (DEFINED(__stack) ? __stack : 0x7FFFF0) : | 
|---|
| 276 |   { | 
|---|
| 277 |     __stack = .; | 
|---|
| 278 |     *(.stack) | 
|---|
| 279 |     LONG(0xdeaddead) | 
|---|
| 280 |   } | 
|---|
| 281 |   /DISCARD/ : { *(.note.GNU-stack) } | 
|---|
| 282 | } | 
|---|