[444] | 1 | /* Linker script for running ELF programs in the Sparc simulator */ |
---|
| 2 | |
---|
| 3 | /* OUTPUT_FORMAT("elf32-sparc", "elf32-sparc", "elf32-sparcle") */ |
---|
| 4 | /* OUTPUT_FORMAT("elf32-sparc") */ |
---|
| 5 | OUTPUT_ARCH(sparc) |
---|
| 6 | STARTUP(traps.o) |
---|
| 7 | INPUT(erc32-crt0.o) |
---|
| 8 | ENTRY(_trap_table) |
---|
| 9 | GROUP(-lc -lerc32 -lgcc) /* -lerc32 used to be -lsim */ |
---|
| 10 | |
---|
| 11 | SEARCH_DIR(.) |
---|
| 12 | /* Do we need any of these for elf? |
---|
| 13 | __DYNAMIC = 0; */ |
---|
| 14 | |
---|
| 15 | /* |
---|
| 16 | * The memory map looks like this: |
---|
| 17 | * +--------------------+ <- low memory |
---|
| 18 | * | .text | |
---|
| 19 | * | _stext | |
---|
| 20 | * | _etext | |
---|
| 21 | * | ctor list | the ctor and dtor lists are for |
---|
| 22 | * | dtor list | C++ support |
---|
| 23 | * | _end_text | |
---|
| 24 | * +--------------------+ |
---|
| 25 | * | .data | initialized data goes here |
---|
| 26 | * | _sdata | |
---|
| 27 | * | _edata | |
---|
| 28 | * +--------------------+ |
---|
| 29 | * | .bss | |
---|
| 30 | * | __bss_start | start of bss, cleared by crt0 |
---|
| 31 | * | _end | start of heap, used by sbrk() |
---|
| 32 | * +--------------------+ |
---|
| 33 | * | heap space | |
---|
| 34 | * | _ENDHEAP | |
---|
| 35 | * | stack space | |
---|
| 36 | * | __stack | top of stack |
---|
| 37 | * +--------------------+ <- high memory |
---|
| 38 | */ |
---|
| 39 | |
---|
| 40 | /* |
---|
| 41 | * User modifiable values: |
---|
| 42 | * |
---|
| 43 | * _CLOCK_SPEED in Mhz (used to program the counter/timers) |
---|
| 44 | * |
---|
| 45 | * _PROM_SIZE size of PROM (permissible values are 4K, 8K, 16K |
---|
| 46 | * 32K, 64K, 128K, 256K, and 512K) |
---|
| 47 | * _RAM_SIZE size of RAM (permissible values are 256K, 512K, |
---|
| 48 | * 1MB, 2Mb, 4Mb, 8Mb, 16Mb, and 32Mb) |
---|
| 49 | * |
---|
| 50 | * These symbols are only used in assembler code, so they only need to |
---|
| 51 | * be listed once. They should always be refered to without SYM(). |
---|
| 52 | */ |
---|
| 53 | |
---|
| 54 | _CLOCK_SPEED = 10; |
---|
| 55 | |
---|
| 56 | _PROM_SIZE = 4M; |
---|
| 57 | _RAM_SIZE = 256K; |
---|
| 58 | |
---|
| 59 | _RAM_START = 0x02000000; |
---|
| 60 | _RAM_END = _RAM_START + _RAM_SIZE; |
---|
| 61 | _STACK_SIZE = (16 * 1024); |
---|
| 62 | _PROM_START = 0x00000000; |
---|
| 63 | _PROM_END = _PROM_START + _PROM_SIZE; |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | /* |
---|
| 67 | * Base address of the on-CPU peripherals |
---|
| 68 | */ |
---|
| 69 | |
---|
| 70 | _ERC32_MEC = 0x01f80000; |
---|
| 71 | |
---|
| 72 | /* |
---|
| 73 | * Setup the memory map for the SIS simulator. |
---|
| 74 | * stack grows up towards low memory. |
---|
| 75 | */ |
---|
| 76 | |
---|
| 77 | MEMORY |
---|
| 78 | { |
---|
| 79 | rom : ORIGIN = 0x00000000, LENGTH = 4M |
---|
| 80 | ram (rwx) : ORIGIN = 0x02000000, LENGTH = 2M |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | __stack = _RAM_START + _RAM_SIZE - 4 * 16; |
---|
| 84 | __trap_stack = (_RAM_START + _RAM_SIZE - 4 * 16) - _STACK_SIZE; |
---|
| 85 | |
---|
| 86 | /* |
---|
| 87 | * All the symbols that might be accessed from C code need to be |
---|
| 88 | * listed twice, once with an additional underscore. aout format needs |
---|
| 89 | * and extra underscore, whereas coff & elf doesn't. This is to work |
---|
| 90 | * with both. |
---|
| 91 | */ |
---|
| 92 | SECTIONS |
---|
| 93 | { |
---|
| 94 | .text : |
---|
| 95 | { |
---|
| 96 | _stext = .; |
---|
| 97 | PROVIDE (stext = .); |
---|
| 98 | *(.text) |
---|
| 99 | _etext = .; |
---|
| 100 | PROVIDE (etext = .); |
---|
| 101 | |
---|
| 102 | /* For a.out. */ |
---|
| 103 | CONSTRUCTORS |
---|
| 104 | |
---|
| 105 | /* For ELF. */ |
---|
| 106 | __CTOR_LIST__ = .; |
---|
| 107 | LONG(-1) |
---|
| 108 | KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) |
---|
| 109 | KEEP (*(SORT(.ctors.*))) |
---|
| 110 | KEEP (*crtend.o(.ctors)) |
---|
| 111 | LONG(0) |
---|
| 112 | __CTOR_END__ = .; |
---|
| 113 | __DTOR_LIST__ = .; |
---|
| 114 | LONG(-1) |
---|
| 115 | KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) |
---|
| 116 | KEEP (*(SORT(.dtors.*))) |
---|
| 117 | KEEP (*crtend.o(.dtors)) |
---|
| 118 | LONG(0) |
---|
| 119 | __DTOR_END__ = .; |
---|
| 120 | |
---|
| 121 | *(.init) |
---|
| 122 | *(.lit) |
---|
| 123 | *(.rodata) |
---|
| 124 | *(.shdata) |
---|
| 125 | __EH_FRAME_BEGIN__ = .; |
---|
| 126 | *(.eh_frame) |
---|
| 127 | *(.gnu.linkonce.t*) |
---|
| 128 | *(.gnu.linkonce.r*) |
---|
| 129 | *(.gcc_except_table) |
---|
| 130 | *(.fini) |
---|
| 131 | |
---|
| 132 | _endtext = .; |
---|
| 133 | PROVIDE(endtext = .); |
---|
| 134 | } > ram |
---|
| 135 | |
---|
| 136 | .shbss SIZEOF(.text) + ADDR(.text) : |
---|
| 137 | { |
---|
| 138 | *(.shbss) |
---|
| 139 | } |
---|
| 140 | |
---|
| 141 | .talias : { } > ram |
---|
| 142 | |
---|
| 143 | .data : |
---|
| 144 | { |
---|
| 145 | _sdata = .; |
---|
| 146 | PROVIDE (sdata = .); |
---|
| 147 | *(.data) |
---|
| 148 | *(.data.*) |
---|
| 149 | *(.gnu.linkonce.d*) |
---|
| 150 | _edata = .; |
---|
| 151 | PROVIDE (edata = .); |
---|
| 152 | } > ram |
---|
| 153 | |
---|
| 154 | .bss SIZEOF(.data) + ADDR(.data) : |
---|
| 155 | { |
---|
| 156 | _sbss = . ; |
---|
| 157 | PROVIDE (sbss = . ); |
---|
| 158 | __bss_start = ALIGN(0x8); |
---|
| 159 | *(.bss) |
---|
| 160 | *(COMMON) |
---|
| 161 | _ebss = .; |
---|
| 162 | PROVIDE (ebss = .); |
---|
| 163 | _end = ALIGN(0x8); |
---|
| 164 | __end = ALIGN(0x8); |
---|
| 165 | PROVIDE (end = ALIGN(0x8)); |
---|
| 166 | } |
---|
| 167 | |
---|
| 168 | /* Stabs debugging sections. */ |
---|
| 169 | .stab 0 : { *(.stab) } |
---|
| 170 | .stabstr 0 : { *(.stabstr) } |
---|
| 171 | .stab.excl 0 : { *(.stab.excl) } |
---|
| 172 | .stab.exclstr 0 : { *(.stab.exclstr) } |
---|
| 173 | .stab.index 0 : { *(.stab.index) } |
---|
| 174 | .stab.indexstr 0 : { *(.stab.indexstr) } |
---|
| 175 | .comment 0 : { *(.comment) } |
---|
| 176 | /* DWARF debug sections. |
---|
| 177 | Symbols in the DWARF debugging sections are relative to the beginning |
---|
| 178 | of the section so we begin them at 0. */ |
---|
| 179 | /* DWARF 1 */ |
---|
| 180 | .debug 0 : { *(.debug) } |
---|
| 181 | .line 0 : { *(.line) } |
---|
| 182 | /* GNU DWARF 1 extensions */ |
---|
| 183 | .debug_srcinfo 0 : { *(.debug_srcinfo) } |
---|
| 184 | .debug_sfnames 0 : { *(.debug_sfnames) } |
---|
| 185 | /* DWARF 1.1 and DWARF 2 */ |
---|
| 186 | .debug_aranges 0 : { *(.debug_aranges) } |
---|
| 187 | .debug_pubnames 0 : { *(.debug_pubnames) } |
---|
| 188 | /* DWARF 2 */ |
---|
| 189 | .debug_info 0 : { *(.debug_info) } |
---|
| 190 | .debug_abbrev 0 : { *(.debug_abbrev) } |
---|
| 191 | .debug_line 0 : { *(.debug_line) } |
---|
| 192 | .debug_frame 0 : { *(.debug_frame) } |
---|
| 193 | .debug_str 0 : { *(.debug_str) } |
---|
| 194 | .debug_loc 0 : { *(.debug_loc) } |
---|
| 195 | .debug_macinfo 0 : { *(.debug_macinfo) } |
---|
| 196 | .debug_ranges 0 : { *(.debug_ranges) } |
---|
| 197 | /* SGI/MIPS DWARF 2 extensions */ |
---|
| 198 | .debug_weaknames 0 : { *(.debug_weaknames) } |
---|
| 199 | .debug_funcnames 0 : { *(.debug_funcnames) } |
---|
| 200 | .debug_typenames 0 : { *(.debug_typenames) } |
---|
| 201 | .debug_varnames 0 : { *(.debug_varnames) } |
---|
| 202 | /* These must appear regardless of . */ |
---|
| 203 | } |
---|