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