| [444] | 1 | /* |
|---|
| 2 | *uncomment this if you want the linker to output srecords. |
|---|
| 3 | OUTPUT_FORMAT(srec) |
|---|
| 4 | * |
|---|
| 5 | */ |
|---|
| 6 | ENTRY(start) |
|---|
| 7 | OUTPUT_ARCH(TARGET_OBJ_FORMAT) |
|---|
| 8 | SEARCH_DIR(.) |
|---|
| 9 | STARTUP(cygmon-crt0.o) |
|---|
| 10 | GROUP(cygmon-salib.o -lc -lgcc -lc) |
|---|
| 11 | |
|---|
| 12 | /* |
|---|
| 13 | * The memory map looks like this: |
|---|
| 14 | * +--------------------+ <- low memory |
|---|
| 15 | * | .text | |
|---|
| 16 | * | _stext | |
|---|
| 17 | * | _etext | |
|---|
| 18 | * | ctor list | the ctor and dtor lists are for |
|---|
| 19 | * | dtor list | C++ support |
|---|
| 20 | * | _end_text | |
|---|
| 21 | * +--------------------+ |
|---|
| 22 | * | .data | initialized data goes here |
|---|
| 23 | * | _sdata | |
|---|
| 24 | * | _edata | |
|---|
| 25 | * +--------------------+ |
|---|
| 26 | * | .bss | |
|---|
| 27 | * | __bss_start | start of bss, cleared by crt0 |
|---|
| 28 | * | _end | start of heap, used by sbrk() |
|---|
| 29 | * +--------------------+ |
|---|
| 30 | * | heap space | |
|---|
| 31 | * | _ENDHEAP | |
|---|
| 32 | * | stack space | |
|---|
| 33 | * | __stack | top of stack |
|---|
| 34 | * +--------------------+ <- high memory |
|---|
| 35 | */ |
|---|
| 36 | |
|---|
| 37 | _STACK_SIZE = (16 * 1024); |
|---|
| 38 | _RAM_SIZE = 1M; |
|---|
| 39 | _RAM_START = 0x4000; |
|---|
| 40 | _RAM_END = _RAM_START + _RAM_SIZE; |
|---|
| 41 | |
|---|
| 42 | /* |
|---|
| 43 | * Setup the standard memory map. The stack grows down towards low memory. |
|---|
| 44 | */ |
|---|
| 45 | MEMORY |
|---|
| 46 | { |
|---|
| 47 | ram : ORIGIN = 0x4000, LENGTH = 1M |
|---|
| 48 | } |
|---|
| 49 | |
|---|
| 50 | __stack = (_RAM_START + _RAM_SIZE - 4 * 16) - _STACK_SIZE; |
|---|
| 51 | |
|---|
| 52 | /* |
|---|
| 53 | * All the symbols that might be accessed from C code need to be |
|---|
| 54 | * listed twice, once with an additional underscore. aout format needs |
|---|
| 55 | * and extra underscore, whereas coff & elf doesn't. This is to work |
|---|
| 56 | * with both. |
|---|
| 57 | */ |
|---|
| 58 | /* |
|---|
| 59 | * Initalize some symbols to be zero so we can reference them in the |
|---|
| 60 | * crt0 without core dumping. These functions are all optional, but |
|---|
| 61 | * we do this so we can have our crt0 always use them if they exist. |
|---|
| 62 | * This is so BSPs work better when using the crt0 installed with gcc. |
|---|
| 63 | * We have to initalize them twice, so we cover a.out (which prepends |
|---|
| 64 | * an underscore) and coff object file formats. |
|---|
| 65 | */ |
|---|
| 66 | PROVIDE (hardware_init_hook = 0); |
|---|
| 67 | PROVIDE (_hardware_init_hook = 0); |
|---|
| 68 | PROVIDE (software_init_hook = 0); |
|---|
| 69 | PROVIDE (_software_init_hook = 0); |
|---|
| 70 | SECTIONS |
|---|
| 71 | { |
|---|
| 72 | .text : { |
|---|
| 73 | stext = .; |
|---|
| 74 | _stext = .; |
|---|
| 75 | CREATE_OBJECT_SYMBOLS |
|---|
| 76 | *(.text) |
|---|
| 77 | __CTOR_LIST__ = .; |
|---|
| 78 | LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) |
|---|
| 79 | *(.ctors) |
|---|
| 80 | LONG(0) |
|---|
| 81 | __CTOR_END__ = .; |
|---|
| 82 | __DTOR_LIST__ = .; |
|---|
| 83 | LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) |
|---|
| 84 | *(.dtors) |
|---|
| 85 | LONG(0) |
|---|
| 86 | __DTOR_END__ = .; |
|---|
| 87 | *(.init) |
|---|
| 88 | *(.lit) |
|---|
| 89 | *(.rodata) |
|---|
| 90 | *(.rodata.*) |
|---|
| 91 | *(.shdata) |
|---|
| 92 | *(.eh_frame) |
|---|
| 93 | *(.gnu.linkonce.t*) |
|---|
| 94 | *(.gnu.linkonce.r*) |
|---|
| 95 | *(.gcc_except_table) |
|---|
| 96 | *(.fini) |
|---|
| 97 | _etext = .; |
|---|
| 98 | } > ram |
|---|
| 99 | .shbss SIZEOF(.text) + ADDR(.text) : { |
|---|
| 100 | *(.shbss) |
|---|
| 101 | } |
|---|
| 102 | .talias : { } > ram |
|---|
| 103 | .data : { |
|---|
| 104 | sdata = .; |
|---|
| 105 | _sdata = .; |
|---|
| 106 | *(.data) |
|---|
| 107 | *(.gnu.linkonce.d*) |
|---|
| 108 | edata = .; |
|---|
| 109 | _edata = .; |
|---|
| 110 | } > ram |
|---|
| 111 | .bss SIZEOF(.data) + ADDR(.data) : { |
|---|
| 112 | sbss = . ; |
|---|
| 113 | _sbss = . ; |
|---|
| 114 | __bss_start = ALIGN(0x8); |
|---|
| 115 | __bss_start = ALIGN(0x8); |
|---|
| 116 | *(.bss) |
|---|
| 117 | *(COMMON) |
|---|
| 118 | end = ALIGN(0x8); |
|---|
| 119 | _end = ALIGN(0x8); |
|---|
| 120 | __end = ALIGN(0x8); |
|---|
| 121 | ebss = .; |
|---|
| 122 | _ebss = .; |
|---|
| 123 | } |
|---|
| 124 | .mstack : { } > ram |
|---|
| 125 | .rstack : { } > ram |
|---|
| 126 | /* Stabs debugging sections. */ |
|---|
| 127 | .stab 0 : { *(.stab) } |
|---|
| 128 | .stabstr 0 : { *(.stabstr) } |
|---|
| 129 | .stab.excl 0 : { *(.stab.excl) } |
|---|
| 130 | .stab.exclstr 0 : { *(.stab.exclstr) } |
|---|
| 131 | .stab.index 0 : { *(.stab.index) } |
|---|
| 132 | .stab.indexstr 0 : { *(.stab.indexstr) } |
|---|
| 133 | .comment 0 : { *(.comment) } |
|---|
| 134 | /* DWARF debug sections. |
|---|
| 135 | Symbols in the DWARF debugging sections are relative to the beginning |
|---|
| 136 | of the section so we begin them at 0. */ |
|---|
| 137 | /* DWARF 1 */ |
|---|
| 138 | .debug 0 : { *(.debug) } |
|---|
| 139 | .line 0 : { *(.line) } |
|---|
| 140 | /* GNU DWARF 1 extensions */ |
|---|
| 141 | .debug_srcinfo 0 : { *(.debug_srcinfo) } |
|---|
| 142 | .debug_sfnames 0 : { *(.debug_sfnames) } |
|---|
| 143 | /* DWARF 1.1 and DWARF 2 */ |
|---|
| 144 | .debug_aranges 0 : { *(.debug_aranges) } |
|---|
| 145 | .debug_pubnames 0 : { *(.debug_pubnames) } |
|---|
| 146 | /* DWARF 2 */ |
|---|
| 147 | .debug_info 0 : { *(.debug_info) } |
|---|
| 148 | .debug_abbrev 0 : { *(.debug_abbrev) } |
|---|
| 149 | .debug_line 0 : { *(.debug_line) } |
|---|
| 150 | .debug_frame 0 : { *(.debug_frame) } |
|---|
| 151 | .debug_str 0 : { *(.debug_str) } |
|---|
| 152 | .debug_loc 0 : { *(.debug_loc) } |
|---|
| 153 | .debug_macinfo 0 : { *(.debug_macinfo) } |
|---|
| 154 | /* SGI/MIPS DWARF 2 extensions */ |
|---|
| 155 | .debug_weaknames 0 : { *(.debug_weaknames) } |
|---|
| 156 | .debug_funcnames 0 : { *(.debug_funcnames) } |
|---|
| 157 | .debug_typenames 0 : { *(.debug_typenames) } |
|---|
| 158 | .debug_varnames 0 : { *(.debug_varnames) } |
|---|
| 159 | /* These must appear regardless of . */ |
|---|
| 160 | } |
|---|