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