| [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 = TARGET_RAM_START; |
|---|
| 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 = TARGET_RAM_START, 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 | KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) |
|---|
| 80 | KEEP (*(SORT(.ctors.*))) |
|---|
| 81 | KEEP (*crtend.o(.ctors)) |
|---|
| 82 | LONG(0) |
|---|
| 83 | __CTOR_END__ = .; |
|---|
| 84 | __DTOR_LIST__ = .; |
|---|
| 85 | LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) |
|---|
| 86 | KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) |
|---|
| 87 | KEEP (*(SORT(.dtors.*))) |
|---|
| 88 | KEEP (*crtend.o(.dtors)) |
|---|
| 89 | LONG(0) |
|---|
| 90 | __DTOR_END__ = .; |
|---|
| 91 | *(.init) |
|---|
| 92 | *(.lit) |
|---|
| 93 | *(.rodata) |
|---|
| 94 | *(.rodata.*) |
|---|
| 95 | *(.shdata) |
|---|
| 96 | *(.eh_frame) |
|---|
| 97 | *(.gnu.linkonce.t*) |
|---|
| 98 | *(.gnu.linkonce.r*) |
|---|
| 99 | *(.gcc_except_table) |
|---|
| 100 | *(.fini) |
|---|
| 101 | _etext = .; |
|---|
| 102 | } > ram |
|---|
| 103 | .shbss SIZEOF(.text) + ADDR(.text) : { |
|---|
| 104 | *(.shbss) |
|---|
| 105 | } |
|---|
| 106 | .talias : { } > ram |
|---|
| 107 | .data : { |
|---|
| 108 | sdata = .; |
|---|
| 109 | _sdata = .; |
|---|
| 110 | *(.data) |
|---|
| 111 | *(.gnu.linkonce.d*) |
|---|
| 112 | edata = .; |
|---|
| 113 | _edata = .; |
|---|
| 114 | } > ram |
|---|
| 115 | .bss SIZEOF(.data) + ADDR(.data) : { |
|---|
| 116 | sbss = . ; |
|---|
| 117 | _sbss = . ; |
|---|
| 118 | __bss_start = ALIGN(0x8); |
|---|
| 119 | __bss_start = ALIGN(0x8); |
|---|
| 120 | *(.bss) |
|---|
| 121 | *(COMMON) |
|---|
| 122 | end = ALIGN(0x8); |
|---|
| 123 | _end = ALIGN(0x8); |
|---|
| 124 | __end = ALIGN(0x8); |
|---|
| 125 | ebss = .; |
|---|
| 126 | _ebss = .; |
|---|
| 127 | } |
|---|
| 128 | .mstack : { } > ram |
|---|
| 129 | .rstack : { } > ram |
|---|
| 130 | .stab 0 (NOLOAD) : { |
|---|
| 131 | [ .stab ] |
|---|
| 132 | } |
|---|
| 133 | .stabstr 0 (NOLOAD) : |
|---|
| 134 | { |
|---|
| 135 | [ .stabstr ] |
|---|
| 136 | } |
|---|
| 137 | /* DWARF debug sections. |
|---|
| 138 | Symbols in the DWARF debugging sections are relative to the beginning |
|---|
| 139 | of the section so we begin them at 0. */ |
|---|
| 140 | /* DWARF 1 */ |
|---|
| 141 | .debug 0 (NOLOAD) : |
|---|
| 142 | { |
|---|
| 143 | [ .debug ] |
|---|
| 144 | } |
|---|
| 145 | .line 0 (NOLOAD) : |
|---|
| 146 | { |
|---|
| 147 | [ .line ] |
|---|
| 148 | } |
|---|
| 149 | /* GNU DWARF 1 extensions */ |
|---|
| 150 | .debug_srcinfo 0 (NOLOAD) : |
|---|
| 151 | { |
|---|
| 152 | [ .debug_srcinfo ] |
|---|
| 153 | } |
|---|
| 154 | .debug_sfnames 0 (NOLOAD) : |
|---|
| 155 | { |
|---|
| 156 | [ .debug_sfnames ] |
|---|
| 157 | } |
|---|
| 158 | /* DWARF 1.1 and DWARF 2 */ |
|---|
| 159 | .debug_aranges 0 (NOLOAD) : |
|---|
| 160 | { |
|---|
| 161 | [ .debug_aranges ] |
|---|
| 162 | } |
|---|
| 163 | .debug_pubnames 0 (NOLOAD) : |
|---|
| 164 | { |
|---|
| 165 | [ .debug_pubnames ] |
|---|
| 166 | } |
|---|
| 167 | /* DWARF 2 */ |
|---|
| 168 | .debug_info 0 (NOLOAD) : |
|---|
| 169 | { |
|---|
| 170 | [ .debug_info ] |
|---|
| 171 | } |
|---|
| 172 | .debug_abbrev 0 (NOLOAD) : |
|---|
| 173 | { |
|---|
| 174 | [ .debug_abbrev ] |
|---|
| 175 | } |
|---|
| 176 | .debug_line 0 (NOLOAD) : |
|---|
| 177 | { |
|---|
| 178 | [ .debug_line ] |
|---|
| 179 | } |
|---|
| 180 | .debug_frame 0 (NOLOAD) : |
|---|
| 181 | { |
|---|
| 182 | [ .debug_frame ] |
|---|
| 183 | } |
|---|
| 184 | .debug_str 0 (NOLOAD) : |
|---|
| 185 | { |
|---|
| 186 | [ .debug_str ] |
|---|
| 187 | } |
|---|
| 188 | .debug_loc 0 (NOLOAD) : |
|---|
| 189 | { |
|---|
| 190 | [ .debug_loc ] |
|---|
| 191 | } |
|---|
| 192 | .debug_macinfo 0 (NOLOAD) : |
|---|
| 193 | { |
|---|
| 194 | [ .debug_macinfo ] |
|---|
| 195 | } |
|---|
| 196 | } |
|---|