[444] | 1 | /* Linker script for 68HC11 executable (PROM). */ |
---|
| 2 | ENTRY(_start) |
---|
| 3 | OUTPUT_FORMAT("elf32-m68hc11", "elf32-m68hc11", "elf32-m68hc11") |
---|
| 4 | OUTPUT_ARCH(m68hc11) |
---|
| 5 | |
---|
| 6 | GROUP(-lc -lbcc -lgcc) |
---|
| 7 | SEARCH_DIR(.); |
---|
| 8 | /* Fixed definition of the available memory banks. |
---|
| 9 | See generic emulation script for a user defined configuration. */ |
---|
| 10 | |
---|
| 11 | /* The memory layout below is suitable for gcc validation. |
---|
| 12 | It takes care of big programs allowing up to 48128 bytes |
---|
| 13 | of text while allowing some programs that consume some |
---|
| 14 | memory (comp-goto-1 requires the RAM to be set to 0x4400 |
---|
| 15 | to avoid head<->stack collision in malloc/sbrk). */ |
---|
| 16 | MEMORY |
---|
| 17 | { |
---|
| 18 | page0 (rwx) : ORIGIN = 0x00, LENGTH = 256 |
---|
| 19 | text (rx) : ORIGIN = 0x04400, LENGTH = 0x10000 - 0x4400 |
---|
| 20 | data : ORIGIN = 0x01100, LENGTH = 0x2000 - 0x1100 |
---|
| 21 | } |
---|
| 22 | /* Setup the stack on the top of the data memory bank. */ |
---|
| 23 | PROVIDE (_stack = 0x04400 - 1); |
---|
| 24 | SECTIONS |
---|
| 25 | { |
---|
| 26 | .hash : { *(.hash) } |
---|
| 27 | .dynsym : { *(.dynsym) } |
---|
| 28 | .dynstr : { *(.dynstr) } |
---|
| 29 | .gnu.version : { *(.gnu.version) } |
---|
| 30 | .gnu.version_d : { *(.gnu.version_d) } |
---|
| 31 | .gnu.version_r : { *(.gnu.version_r) } |
---|
| 32 | .rel.text : |
---|
| 33 | { |
---|
| 34 | *(.rel.text) |
---|
| 35 | *(.rel.text.*) |
---|
| 36 | *(.rel.gnu.linkonce.t.*) |
---|
| 37 | } |
---|
| 38 | .rela.text : |
---|
| 39 | { |
---|
| 40 | *(.rela.text) |
---|
| 41 | *(.rela.text.*) |
---|
| 42 | *(.rela.gnu.linkonce.t.*) |
---|
| 43 | } |
---|
| 44 | .rel.data : |
---|
| 45 | { |
---|
| 46 | *(.rel.data) |
---|
| 47 | *(.rel.data.*) |
---|
| 48 | *(.rel.gnu.linkonce.d.*) |
---|
| 49 | } |
---|
| 50 | .rela.data : |
---|
| 51 | { |
---|
| 52 | *(.rela.data) |
---|
| 53 | *(.rela.data.*) |
---|
| 54 | *(.rela.gnu.linkonce.d.*) |
---|
| 55 | } |
---|
| 56 | .rel.rodata : |
---|
| 57 | { |
---|
| 58 | *(.rel.rodata) |
---|
| 59 | *(.rel.rodata.*) |
---|
| 60 | *(.rel.gnu.linkonce.r.*) |
---|
| 61 | } |
---|
| 62 | .rela.rodata : |
---|
| 63 | { |
---|
| 64 | *(.rela.rodata) |
---|
| 65 | *(.rela.rodata.*) |
---|
| 66 | *(.rela.gnu.linkonce.r.*) |
---|
| 67 | } |
---|
| 68 | .rel.sdata : |
---|
| 69 | { |
---|
| 70 | *(.rel.sdata) |
---|
| 71 | *(.rel.sdata.*) |
---|
| 72 | *(.rel.gnu.linkonce.s.*) |
---|
| 73 | } |
---|
| 74 | .rela.sdata : |
---|
| 75 | { |
---|
| 76 | *(.rela.sdata) |
---|
| 77 | *(.rela.sdata.*) |
---|
| 78 | *(.rela.gnu.linkonce.s.*) |
---|
| 79 | } |
---|
| 80 | .rel.sbss : |
---|
| 81 | { |
---|
| 82 | *(.rel.sbss) |
---|
| 83 | *(.rel.sbss.*) |
---|
| 84 | *(.rel.gnu.linkonce.sb.*) |
---|
| 85 | } |
---|
| 86 | .rela.sbss : |
---|
| 87 | { |
---|
| 88 | *(.rela.sbss) |
---|
| 89 | *(.rela.sbss.*) |
---|
| 90 | *(.rel.gnu.linkonce.sb.*) |
---|
| 91 | } |
---|
| 92 | .rel.bss : |
---|
| 93 | { |
---|
| 94 | *(.rel.bss) |
---|
| 95 | *(.rel.bss.*) |
---|
| 96 | *(.rel.gnu.linkonce.b.*) |
---|
| 97 | } |
---|
| 98 | .rela.bss : |
---|
| 99 | { |
---|
| 100 | *(.rela.bss) |
---|
| 101 | *(.rela.bss.*) |
---|
| 102 | *(.rela.gnu.linkonce.b.*) |
---|
| 103 | } |
---|
| 104 | .rela.stext : { *(.rela.stest) } |
---|
| 105 | .rela.etext : { *(.rela.etest) } |
---|
| 106 | .rela.sdata : { *(.rela.sdata) } |
---|
| 107 | .rela.edata : { *(.rela.edata) } |
---|
| 108 | .rela.eit_v : { *(.rela.eit_v) } |
---|
| 109 | .rela.ebss : { *(.rela.ebss) } |
---|
| 110 | .rela.srodata : { *(.rela.srodata) } |
---|
| 111 | .rela.erodata : { *(.rela.erodata) } |
---|
| 112 | .rela.got : { *(.rela.got) } |
---|
| 113 | .rela.ctors : { *(.rela.ctors) } |
---|
| 114 | .rela.dtors : { *(.rela.dtors) } |
---|
| 115 | .rela.init : { *(.rela.init) } |
---|
| 116 | .rela.fini : { *(.rela.fini) } |
---|
| 117 | .rela.plt : { *(.rela.plt) } |
---|
| 118 | .rel.stext : { *(.rel.stest) } |
---|
| 119 | .rel.etext : { *(.rel.etest) } |
---|
| 120 | .rel.sdata : { *(.rel.sdata) } |
---|
| 121 | .rel.edata : { *(.rel.edata) } |
---|
| 122 | .rel.ebss : { *(.rel.ebss) } |
---|
| 123 | .rel.eit_v : { *(.rel.eit_v) } |
---|
| 124 | .rel.srodata : { *(.rel.srodata) } |
---|
| 125 | .rel.erodata : { *(.rel.erodata) } |
---|
| 126 | .rel.got : { *(.rel.got) } |
---|
| 127 | .rel.ctors : { *(.rel.ctors) } |
---|
| 128 | .rel.dtors : { *(.rel.dtors) } |
---|
| 129 | .rel.init : { *(.rel.init) } |
---|
| 130 | .rel.fini : { *(.rel.fini) } |
---|
| 131 | .rel.plt : { *(.rel.plt) } |
---|
| 132 | /* Concatenate .page0 sections. Put them in the page0 memory bank |
---|
| 133 | unless we are creating a relocatable file. */ |
---|
| 134 | .page0 : |
---|
| 135 | { |
---|
| 136 | *(.page0) |
---|
| 137 | *(.softregs) |
---|
| 138 | } > page0 |
---|
| 139 | |
---|
| 140 | /* Start of text section. */ |
---|
| 141 | .stext : |
---|
| 142 | { |
---|
| 143 | *(.stext) |
---|
| 144 | } > text |
---|
| 145 | .init : |
---|
| 146 | { |
---|
| 147 | *(.init) |
---|
| 148 | } =0 |
---|
| 149 | /* Put trampolines at beginning of text at 0x4400 so that they |
---|
| 150 | are not in memory bank window. */ |
---|
| 151 | .tramp : |
---|
| 152 | { |
---|
| 153 | *(.tramp) |
---|
| 154 | } > text |
---|
| 155 | .text : |
---|
| 156 | { |
---|
| 157 | /* Put startup code at beginning so that _start keeps same address. */ |
---|
| 158 | /* Startup code. */ |
---|
| 159 | KEEP (*(.install0)) /* Section should setup the stack pointer. */ |
---|
| 160 | KEEP (*(.install1)) /* Place holder for applications. */ |
---|
| 161 | KEEP (*(.install2)) /* Optional installation of data sections in RAM. */ |
---|
| 162 | KEEP (*(.install3)) /* Place holder for applications. */ |
---|
| 163 | KEEP (*(.install4)) /* Section that calls the main. */ |
---|
| 164 | *(.init) |
---|
| 165 | *(.text) |
---|
| 166 | *(.text.*) |
---|
| 167 | /* .gnu.warning sections are handled specially by elf32.em. */ |
---|
| 168 | *(.gnu.warning) |
---|
| 169 | *(.gnu.linkonce.t.*) |
---|
| 170 | /* Finish code. */ |
---|
| 171 | KEEP (*(.fini0)) /* Beginning of finish code (_exit symbol). */ |
---|
| 172 | KEEP (*(.fini1)) /* Place holder for applications. */ |
---|
| 173 | KEEP (*(.fini2)) /* C++ destructors. */ |
---|
| 174 | KEEP (*(.fini3)) /* Place holder for applications. */ |
---|
| 175 | KEEP (*(.fini4)) /* Runtime exit. */ |
---|
| 176 | _etext = .; |
---|
| 177 | PROVIDE (etext = .); |
---|
| 178 | } > text |
---|
| 179 | .eh_frame : |
---|
| 180 | { |
---|
| 181 | *(.eh_frame) |
---|
| 182 | } > text |
---|
| 183 | .gcc_except_table : |
---|
| 184 | { |
---|
| 185 | *(.gcc_except_table) |
---|
| 186 | } > text |
---|
| 187 | .rodata : |
---|
| 188 | { |
---|
| 189 | *(.rodata) |
---|
| 190 | *(.rodata.*) |
---|
| 191 | *(.gnu.linkonce.r*) |
---|
| 192 | } > text |
---|
| 193 | .rodata1 : |
---|
| 194 | { |
---|
| 195 | *(.rodata1) |
---|
| 196 | } > text |
---|
| 197 | /* Constructor and destructor tables are in ROM. */ |
---|
| 198 | .ctors : |
---|
| 199 | { |
---|
| 200 | PROVIDE (__CTOR_LIST__ = .); |
---|
| 201 | KEEP (*(.ctors)) |
---|
| 202 | PROVIDE(__CTOR_END__ = .); |
---|
| 203 | } > text |
---|
| 204 | .dtors : |
---|
| 205 | { |
---|
| 206 | PROVIDE(__DTOR_LIST__ = .); |
---|
| 207 | KEEP (*(.dtors)) |
---|
| 208 | PROVIDE(__DTOR_END__ = .); |
---|
| 209 | } > text |
---|
| 210 | /* Start of the data section image in ROM. */ |
---|
| 211 | __data_image = .; |
---|
| 212 | PROVIDE (__data_image = .); |
---|
| 213 | /* All read-only sections that normally go in PROM must be above. |
---|
| 214 | We construct the DATA image section in PROM at end of all these |
---|
| 215 | read-only sections. The data image must be copied at init time. |
---|
| 216 | Refer to GNU ld, Section 3.6.8.2 Output Section LMA. */ |
---|
| 217 | .data : AT (__data_image) |
---|
| 218 | { |
---|
| 219 | __data_section_start = .; |
---|
| 220 | PROVIDE (__data_section_start = .); |
---|
| 221 | *(.sdata) |
---|
| 222 | *(.data) |
---|
| 223 | *(.data.*) |
---|
| 224 | *(.data1) |
---|
| 225 | *(.gnu.linkonce.d.*) |
---|
| 226 | CONSTRUCTORS |
---|
| 227 | _edata = .; |
---|
| 228 | PROVIDE (edata = .); |
---|
| 229 | } > data |
---|
| 230 | __data_section_size = SIZEOF(.data); |
---|
| 231 | PROVIDE (__data_section_size = SIZEOF(.data)); |
---|
| 232 | __data_image_end = __data_image + __data_section_size; |
---|
| 233 | /* SCz: this does not work yet... This is supposed to force the loading |
---|
| 234 | of _map_data.o (from libgcc.a) when the .data section is not empty. |
---|
| 235 | By doing so, this should bring the code that copies the .data section |
---|
| 236 | from ROM to RAM at init time. |
---|
| 237 | ___pre_comp_data_size = SIZEOF(.data); |
---|
| 238 | __install_data_sections = ___pre_comp_data_size > 0 ? |
---|
| 239 | __map_data_sections : 0; |
---|
| 240 | */ |
---|
| 241 | /* .install : |
---|
| 242 | { |
---|
| 243 | . = _data_image_end; |
---|
| 244 | } > text */ |
---|
| 245 | /* Relocation for some bss and data sections. */ |
---|
| 246 | .bss : |
---|
| 247 | { |
---|
| 248 | __bss_start = .; |
---|
| 249 | *(.sbss) |
---|
| 250 | *(.scommon) |
---|
| 251 | *(.dynbss) |
---|
| 252 | *(.bss) |
---|
| 253 | *(.bss.*) |
---|
| 254 | *(.gnu.linkonce.b.*) |
---|
| 255 | *(COMMON) |
---|
| 256 | PROVIDE (_end = .); |
---|
| 257 | } > data |
---|
| 258 | __bss_size = SIZEOF(.bss); |
---|
| 259 | PROVIDE (__bss_size = SIZEOF(.bss)); |
---|
| 260 | /* If the 'vectors_addr' symbol is defined, it indicates the start address |
---|
| 261 | of interrupt vectors. This depends on the 68HC11 operating mode: |
---|
| 262 | Addr |
---|
| 263 | Single chip 0xffc0 |
---|
| 264 | Extended mode 0xffc0 |
---|
| 265 | Bootstrap 0x00c0 |
---|
| 266 | Test 0xbfc0 |
---|
| 267 | In general, the vectors address is 0xffc0. This can be overriden |
---|
| 268 | with the '-defsym vectors_addr=0xbfc0' ld option. |
---|
| 269 | Note: for the bootstrap mode, the interrupt vectors are at 0xbfc0 but |
---|
| 270 | they are redirected to 0x00c0 by the internal PROM. Application's vectors |
---|
| 271 | must also consist of jump instructions (see Motorola's manual). */ |
---|
| 272 | PROVIDE (_vectors_addr = DEFINED (vectors_addr) ? vectors_addr : 0xffc0); |
---|
| 273 | .vectors DEFINED (vectors_addr) ? vectors_addr : 0xffc0 : |
---|
| 274 | { |
---|
| 275 | KEEP (*(.vectors)) |
---|
| 276 | } |
---|
| 277 | /* Stabs debugging sections. */ |
---|
| 278 | .stab 0 : { *(.stab) } |
---|
| 279 | .stabstr 0 : { *(.stabstr) } |
---|
| 280 | .stab.excl 0 : { *(.stab.excl) } |
---|
| 281 | .stab.exclstr 0 : { *(.stab.exclstr) } |
---|
| 282 | .stab.index 0 : { *(.stab.index) } |
---|
| 283 | .stab.indexstr 0 : { *(.stab.indexstr) } |
---|
| 284 | .comment 0 : { *(.comment) } |
---|
| 285 | /* DWARF debug sections. |
---|
| 286 | Symbols in the DWARF debugging sections are relative to the beginning |
---|
| 287 | of the section so we begin them at 0. |
---|
| 288 | Treatment of DWARF debug section must be at end of the linker |
---|
| 289 | script to avoid problems when there are undefined symbols. It's necessary |
---|
| 290 | to avoid that the DWARF section is relocated before such undefined |
---|
| 291 | symbols are found. */ |
---|
| 292 | /* DWARF 1 */ |
---|
| 293 | .debug 0 : { *(.debug) } |
---|
| 294 | .line 0 : { *(.line) } |
---|
| 295 | /* GNU DWARF 1 extensions */ |
---|
| 296 | .debug_srcinfo 0 : { *(.debug_srcinfo) } |
---|
| 297 | .debug_sfnames 0 : { *(.debug_sfnames) } |
---|
| 298 | /* DWARF 1.1 and DWARF 2 */ |
---|
| 299 | .debug_aranges 0 : { *(.debug_aranges) } |
---|
| 300 | .debug_pubnames 0 : { *(.debug_pubnames) } |
---|
| 301 | /* DWARF 2 */ |
---|
| 302 | .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } |
---|
| 303 | .debug_abbrev 0 : { *(.debug_abbrev) } |
---|
| 304 | .debug_line 0 : { *(.debug_line) } |
---|
| 305 | .debug_frame 0 : { *(.debug_frame) } |
---|
| 306 | .debug_str 0 : { *(.debug_str) } |
---|
| 307 | .debug_loc 0 : { *(.debug_loc) } |
---|
| 308 | .debug_macinfo 0 : { *(.debug_macinfo) } |
---|
| 309 | .debug_ranges 0 : { *(.debug_ranges) } |
---|
| 310 | } |
---|