[332484b5] | 1 | /* linkcmds |
---|
| 2 | */ |
---|
| 3 | |
---|
| 4 | OUTPUT_ARCH(m68k) |
---|
[b4361d1] | 5 | ENTRY(start) |
---|
| 6 | STARTUP(start.o) |
---|
[332484b5] | 7 | __DYNAMIC = 0; |
---|
| 8 | |
---|
| 9 | /* |
---|
[89aa1ec8] | 10 | * ROM: |
---|
[332484b5] | 11 | * +--------------------+ <- low memory |
---|
| 12 | * | .text | |
---|
| 13 | * | etext | |
---|
| 14 | * | ctor list | the ctor and dtor lists are for |
---|
| 15 | * | dtor list | C++ support |
---|
| 16 | * | _endtext | |
---|
[89aa1ec8] | 17 | * | temporary .data | .data is moved to RAM by crt0 |
---|
| 18 | * | | |
---|
| 19 | * +--------------------+ <- high memory |
---|
| 20 | * |
---|
| 21 | * |
---|
| 22 | * RAM: |
---|
| 23 | * +--------------------+ <- low memory |
---|
[332484b5] | 24 | * | .data | initialized data goes here |
---|
| 25 | * | _sdata | |
---|
| 26 | * | _edata | |
---|
| 27 | * +--------------------+ |
---|
| 28 | * | .bss | |
---|
[89aa1ec8] | 29 | * | __bss_start | start of bss, cleared by crt0 |
---|
[332484b5] | 30 | * | _end | start of heap, used by sbrk() |
---|
| 31 | * +--------------------+ |
---|
| 32 | * | heap space | |
---|
| 33 | * | _ENDHEAP | |
---|
| 34 | * | stack space | |
---|
| 35 | * +--------------------+ <- high memory |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | /* |
---|
| 39 | * Declare some sizes. |
---|
| 40 | */ |
---|
[89aa1ec8] | 41 | RomBase = DEFINED(RomBase) ? RomBase : 0x90000; |
---|
| 42 | RamBase = DEFINED(RamBase) ? RamBase : 0x03000; |
---|
| 43 | RamSize = DEFINED(RamSize) ? RamSize : 0x7d000; |
---|
[ffa1153] | 44 | RamEnd = RamBase + RamSize; |
---|
[332484b5] | 45 | |
---|
| 46 | MEMORY |
---|
| 47 | { |
---|
[89aa1ec8] | 48 | rom : ORIGIN = 0x90000, LENGTH = 0x70000 |
---|
| 49 | ram : ORIGIN = 0x03000, LENGTH = 0x7d000 |
---|
[332484b5] | 50 | } |
---|
| 51 | |
---|
[89aa1ec8] | 52 | _copy_data_from_rom = 1; |
---|
| 53 | HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0; |
---|
| 54 | |
---|
[332484b5] | 55 | |
---|
| 56 | /* |
---|
[89aa1ec8] | 57 | * |
---|
[332484b5] | 58 | */ |
---|
| 59 | SECTIONS |
---|
| 60 | { |
---|
[89aa1ec8] | 61 | .text : |
---|
| 62 | { |
---|
| 63 | . = .; |
---|
| 64 | text_start = .; |
---|
| 65 | _text_start = .; |
---|
| 66 | *(.text*) |
---|
| 67 | . = ALIGN (16); |
---|
| 68 | |
---|
| 69 | /* |
---|
| 70 | * C++ constructors/destructors |
---|
| 71 | */ |
---|
| 72 | *(.gnu.linkonce.t.*) |
---|
| 73 | |
---|
| 74 | /* |
---|
| 75 | * Initialization and finalization code. |
---|
| 76 | * |
---|
| 77 | * Various files can provide initialization and finalization |
---|
| 78 | * functions. crtbegin.o and crtend.o are two instances. The |
---|
| 79 | * body of these functions are in .init and .fini sections. We |
---|
| 80 | * accumulate the bodies here, and prepend function prologues |
---|
| 81 | * from crti.o and function epilogues from crtn.o. crti.o must |
---|
| 82 | * be linked first; crtn.o must be linked last. Because these |
---|
| 83 | * are wildcards, it doesn't matter if the user does not |
---|
| 84 | * actually link against crti.o and crtn.o; the linker won't |
---|
| 85 | * look for a file to match a wildcard. The wildcard also |
---|
| 86 | * means that it doesn't matter which directory crti.o and |
---|
| 87 | * crtn.o are in. |
---|
| 88 | */ |
---|
| 89 | PROVIDE (_init = .); |
---|
| 90 | *crti.o(.init) |
---|
| 91 | *(.init) |
---|
| 92 | *crtn.o(.init) |
---|
| 93 | PROVIDE (_fini = .); |
---|
| 94 | *crti.o(.fini) |
---|
| 95 | *(.fini) |
---|
| 96 | *crtn.o(.fini) |
---|
| 97 | |
---|
| 98 | /* |
---|
| 99 | * Special FreeBSD sysctl sections. |
---|
| 100 | */ |
---|
| 101 | . = ALIGN (16); |
---|
| 102 | __start_set_sysctl_set = .; |
---|
| 103 | *(set_sysctl_*); |
---|
| 104 | __stop_set_sysctl_set = ABSOLUTE(.); |
---|
| 105 | *(set_domain_*); |
---|
| 106 | *(set_pseudo_*); |
---|
| 107 | |
---|
| 108 | /* |
---|
| 109 | * C++ constructors/destructors |
---|
| 110 | * |
---|
| 111 | * gcc uses crtbegin.o to find the start of the constructors |
---|
| 112 | * and destructors so we make sure it is first. Because this |
---|
| 113 | * is a wildcard, it doesn't matter if the user does not |
---|
| 114 | * actually link against crtbegin.o; the linker won't look for |
---|
| 115 | * a file to match a wildcard. The wildcard also means that |
---|
| 116 | * it doesn't matter which directory crtbegin.o is in. The |
---|
| 117 | * constructor and destructor list are terminated in |
---|
| 118 | * crtend.o. The same comments apply to it. |
---|
| 119 | */ |
---|
| 120 | . = ALIGN (16); |
---|
| 121 | *crtbegin.o(.ctors) |
---|
| 122 | *(.ctors) |
---|
| 123 | *crtend.o(.ctors) |
---|
| 124 | *crtbegin.o(.dtors) |
---|
| 125 | *(.dtors) |
---|
| 126 | *crtend.o(.dtors) |
---|
| 127 | |
---|
| 128 | /* |
---|
| 129 | * Exception frame info |
---|
| 130 | */ |
---|
| 131 | . = ALIGN (16); |
---|
| 132 | *(.eh_frame) |
---|
| 133 | |
---|
| 134 | /* |
---|
| 135 | * Read-only data |
---|
| 136 | */ |
---|
| 137 | . = ALIGN (16); |
---|
| 138 | _rodata_start = . ; |
---|
| 139 | *(.rodata*) |
---|
[b618d8c] | 140 | KEEP (*(SORT(.rtemsroset.*))) |
---|
[89aa1ec8] | 141 | *(.gnu.linkonce.r*) |
---|
| 142 | } > rom |
---|
| 143 | .tdata : { |
---|
| 144 | _TLS_Data_begin = .; |
---|
| 145 | *(.tdata .tdata.* .gnu.linkonce.td.*) |
---|
| 146 | _TLS_Data_end = .; |
---|
| 147 | } > rom |
---|
| 148 | .tbss : { |
---|
| 149 | _TLS_BSS_begin = .; |
---|
| 150 | *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) |
---|
| 151 | _TLS_BSS_end = .; |
---|
[18e47db5] | 152 | |
---|
| 153 | . = ALIGN (16); |
---|
| 154 | PROVIDE (_etext = .); |
---|
| 155 | _endtext = .; |
---|
| 156 | __data_start_rom = .; |
---|
[89aa1ec8] | 157 | } > rom |
---|
| 158 | _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin; |
---|
[d60e760] | 159 | _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin; |
---|
| 160 | _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin; |
---|
[89aa1ec8] | 161 | _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin; |
---|
| 162 | _TLS_Size = _TLS_BSS_end - _TLS_Data_begin; |
---|
[d60e760] | 163 | _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss)); |
---|
[89aa1ec8] | 164 | .data : AT(__data_start_rom) |
---|
| 165 | { |
---|
| 166 | PROVIDE (_copy_start = .); |
---|
| 167 | *(.data*) |
---|
[b618d8c] | 168 | KEEP (*(SORT(.rtemsrwset.*))) |
---|
[89aa1ec8] | 169 | *(.gnu.linkonce.d*) |
---|
[18e47db5] | 170 | *(.gcc_exc) |
---|
[89aa1ec8] | 171 | *(.gcc_except_table*) |
---|
| 172 | *(.jcr) |
---|
| 173 | . = ALIGN (16); |
---|
| 174 | PROVIDE (_edata = .); |
---|
| 175 | PROVIDE (_copy_end = .); |
---|
| 176 | } > ram |
---|
| 177 | .shbss : |
---|
| 178 | { |
---|
| 179 | *(.shbss) |
---|
| 180 | } > ram |
---|
| 181 | .bss : |
---|
| 182 | { |
---|
| 183 | M68Kvec = .; |
---|
| 184 | . += (256 * 4); |
---|
| 185 | _clear_start = .; |
---|
| 186 | *(.dynbss) |
---|
| 187 | *(.bss* .gnu.linkonce.b.*) |
---|
| 188 | *(COMMON) |
---|
| 189 | . = ALIGN (16); |
---|
| 190 | PROVIDE (end = .); |
---|
| 191 | _clear_end = .; |
---|
[715d616] | 192 | } > ram |
---|
[e10dec0] | 193 | .noinit (NOLOAD) : { |
---|
| 194 | *(.noinit*) |
---|
| 195 | } > ram |
---|
[715d616] | 196 | .rtemsstack (NOLOAD) : { |
---|
| 197 | *(SORT(.rtemsstack.*)) |
---|
[89aa1ec8] | 198 | WorkAreaBase = .; |
---|
| 199 | } > ram |
---|
| 200 | .stab . (NOLOAD) : |
---|
| 201 | { |
---|
| 202 | [ .stab ] |
---|
| 203 | } |
---|
| 204 | .stabstr . (NOLOAD) : |
---|
| 205 | { |
---|
| 206 | [ .stabstr ] |
---|
| 207 | } |
---|
[332484b5] | 208 | } |
---|