1 | /* |
---|
2 | * This file contains GNU linker directives for a generic MC68340/349 board. |
---|
3 | * Variations in hardware type and dynamic memory size can be made |
---|
4 | * by overriding some values with linker command-line arguments. |
---|
5 | * |
---|
6 | * ATTENTION: RAM and ROM placement must accord those in start340.S!! |
---|
7 | * (next time I'll use some shared variables :) ) |
---|
8 | * |
---|
9 | * Geoffroy Montel |
---|
10 | * France Telecom - CNET/DSM/TAM/CAT |
---|
11 | * 4, rue du Clos Courtel |
---|
12 | * 35512 CESSON-SEVIGNE |
---|
13 | * FRANCE |
---|
14 | * |
---|
15 | * e-mail: g_montel@yahoo.com |
---|
16 | */ |
---|
17 | |
---|
18 | /* |
---|
19 | * Declare some sizes. |
---|
20 | */ |
---|
21 | RamBase = DEFINED(RamBase) ? RamBase : 0x10000000; |
---|
22 | RamSize = DEFINED(RamSize) ? RamSize : 4M; |
---|
23 | HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0; |
---|
24 | _StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000; |
---|
25 | |
---|
26 | /* |
---|
27 | * Declare on-board memory. |
---|
28 | * It would be nice if the ram length could be given as |
---|
29 | * LENGTH=RamSize, but gld doesn't allow non-constant |
---|
30 | * values in the LENGTH expression. |
---|
31 | */ |
---|
32 | MEMORY { |
---|
33 | ram : ORIGIN = 0x10000000, LENGTH = 4M |
---|
34 | rom : ORIGIN = 0x01000000, LENGTH = 4M |
---|
35 | /* dpram : ORIGIN = 0xFE000000, LENGTH = 8k */ |
---|
36 | } |
---|
37 | |
---|
38 | ENTRY(start) |
---|
39 | STARTUP(start.o) |
---|
40 | |
---|
41 | /* |
---|
42 | * Declare low-order three octets of Ethernet address. |
---|
43 | */ |
---|
44 | ETHERNET_ADDRESS = DEFINED(ETHERNET_ADDRESS) ? ETHERNET_ADDRESS : 0xDEAD12; |
---|
45 | |
---|
46 | /* |
---|
47 | * Load objects |
---|
48 | */ |
---|
49 | SECTIONS { |
---|
50 | |
---|
51 | /* |
---|
52 | * Boot PROM |
---|
53 | */ |
---|
54 | rom : { |
---|
55 | _RomBase = .; |
---|
56 | __RomBase = .; |
---|
57 | } >rom |
---|
58 | |
---|
59 | /* |
---|
60 | * Dynamic RAM |
---|
61 | */ |
---|
62 | ram : { |
---|
63 | . = .; |
---|
64 | } >ram |
---|
65 | |
---|
66 | /* |
---|
67 | * Text, data and bss segments |
---|
68 | */ |
---|
69 | .text : { |
---|
70 | *(.text*) |
---|
71 | |
---|
72 | /* |
---|
73 | * C++ constructors/destructors |
---|
74 | */ |
---|
75 | *(.gnu.linkonce.t.*) |
---|
76 | |
---|
77 | /* |
---|
78 | * Initialization and finalization code. |
---|
79 | * |
---|
80 | * Various files can provide initialization and finalization |
---|
81 | * functions. crtbegin.o and crtend.o are two instances. The |
---|
82 | * body of these functions are in .init and .fini sections. We |
---|
83 | * accumulate the bodies here, and prepend function prologues |
---|
84 | * from crti.o and function epilogues from crtn.o. crti.o must |
---|
85 | * be linked first; crtn.o must be linked last. Because these |
---|
86 | * are wildcards, it doesn't matter if the user does not |
---|
87 | * actually link against crti.o and crtn.o; the linker won't |
---|
88 | * look for a file to match a wildcard. The wildcard also |
---|
89 | * means that it doesn't matter which directory crti.o and |
---|
90 | * crtn.o are in. |
---|
91 | */ |
---|
92 | PROVIDE (_init = .); |
---|
93 | *crti.o(.init) |
---|
94 | *(.init) |
---|
95 | *crtn.o(.init) |
---|
96 | PROVIDE (_fini = .); |
---|
97 | *crti.o(.fini) |
---|
98 | *(.fini) |
---|
99 | *crtn.o(.fini) |
---|
100 | |
---|
101 | /* |
---|
102 | * Special FreeBSD sysctl sections. |
---|
103 | */ |
---|
104 | . = ALIGN (16); |
---|
105 | __start_set_sysctl_set = .; |
---|
106 | *(set_sysctl_*); |
---|
107 | __stop_set_sysctl_set = ABSOLUTE(.); |
---|
108 | *(set_domain_*); |
---|
109 | *(set_pseudo_*); |
---|
110 | |
---|
111 | /* |
---|
112 | * C++ constructors/destructors |
---|
113 | * |
---|
114 | * gcc uses crtbegin.o to find the start of the constructors |
---|
115 | * and destructors so we make sure it is first. Because this |
---|
116 | * is a wildcard, it doesn't matter if the user does not |
---|
117 | * actually link against crtbegin.o; the linker won't look for |
---|
118 | * a file to match a wildcard. The wildcard also means that |
---|
119 | * it doesn't matter which directory crtbegin.o is in. The |
---|
120 | * constructor and destructor list are terminated in |
---|
121 | * crtend.o. The same comments apply to it. |
---|
122 | */ |
---|
123 | . = ALIGN (16); |
---|
124 | *crtbegin.o(.ctors) |
---|
125 | *(.ctors) |
---|
126 | *crtend.o(.ctors) |
---|
127 | *crtbegin.o(.dtors) |
---|
128 | *(.dtors) |
---|
129 | *crtend.o(.dtors) |
---|
130 | |
---|
131 | /* |
---|
132 | * Exception frame info |
---|
133 | */ |
---|
134 | . = ALIGN (16); |
---|
135 | *(.eh_frame) |
---|
136 | |
---|
137 | /* |
---|
138 | * Read-only data |
---|
139 | */ |
---|
140 | . = ALIGN (16); |
---|
141 | _rodata_start = . ; |
---|
142 | *(.rodata*) |
---|
143 | KEEP (*(SORT(.rtemsroset.*))) |
---|
144 | *(.gnu.linkonce.r*) |
---|
145 | |
---|
146 | . = ALIGN (16); |
---|
147 | PROVIDE (_etext = .); |
---|
148 | } >ram |
---|
149 | |
---|
150 | .tdata : { |
---|
151 | _TLS_Data_begin = .; |
---|
152 | *(.tdata .tdata.* .gnu.linkonce.td.*) |
---|
153 | _TLS_Data_end = .; |
---|
154 | } >ram |
---|
155 | |
---|
156 | .tbss : { |
---|
157 | _TLS_BSS_begin = .; |
---|
158 | *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) |
---|
159 | _TLS_BSS_end = .; |
---|
160 | } >ram |
---|
161 | |
---|
162 | _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin; |
---|
163 | _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin; |
---|
164 | _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin; |
---|
165 | _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin; |
---|
166 | _TLS_Size = _TLS_BSS_end - _TLS_Data_begin; |
---|
167 | _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss)); |
---|
168 | |
---|
169 | .data : { |
---|
170 | PROVIDE (_copy_start = .); |
---|
171 | *(.data*) |
---|
172 | KEEP (*(SORT(.rtemsrwset.*))) |
---|
173 | *(.gnu.linkonce.d*) |
---|
174 | *(.gcc_except_table*) |
---|
175 | *(.jcr) |
---|
176 | . = ALIGN (16); |
---|
177 | PROVIDE (_edata = .); |
---|
178 | PROVIDE (_copy_end = .); |
---|
179 | } >ram |
---|
180 | .bss : { |
---|
181 | M68Kvec = .; |
---|
182 | . += (256 * 4); |
---|
183 | _clear_start = .; |
---|
184 | *(.dynbss) |
---|
185 | *(.bss* .gnu.linkonce.b.*) |
---|
186 | *(COMMON) |
---|
187 | . = ALIGN (16); |
---|
188 | PROVIDE (end = .); |
---|
189 | |
---|
190 | . += _StackSize; |
---|
191 | . = ALIGN (16); |
---|
192 | _stack_init = .; |
---|
193 | _clear_end = .; |
---|
194 | |
---|
195 | WorkAreaBase = .; |
---|
196 | } >ram |
---|
197 | |
---|
198 | /* |
---|
199 | * On-chip memory/peripherals |
---|
200 | * |
---|
201 | */ |
---|
202 | dpram : { |
---|
203 | m340 = .; |
---|
204 | _m340 = .; |
---|
205 | . += (8 * 1024); |
---|
206 | } >ram |
---|
207 | |
---|
208 | |
---|
209 | /* Stabs debugging sections. */ |
---|
210 | .stab 0 : { *(.stab) } |
---|
211 | .stabstr 0 : { *(.stabstr) } |
---|
212 | .stab.excl 0 : { *(.stab.excl) } |
---|
213 | .stab.exclstr 0 : { *(.stab.exclstr) } |
---|
214 | .stab.index 0 : { *(.stab.index) } |
---|
215 | .stab.indexstr 0 : { *(.stab.indexstr) } |
---|
216 | .comment 0 : { *(.comment) } |
---|
217 | |
---|
218 | /* DWARF debug sections. |
---|
219 | Symbols in the DWARF debugging sections are relative to the beginning |
---|
220 | of the section so we begin them at 0. */ |
---|
221 | /* DWARF 1 */ |
---|
222 | .debug 0 : { *(.debug) } |
---|
223 | .line 0 : { *(.line) } |
---|
224 | |
---|
225 | /* GNU DWARF 1 extensions */ |
---|
226 | .debug_srcinfo 0 : { *(.debug_srcinfo) } |
---|
227 | .debug_sfnames 0 : { *(.debug_sfnames) } |
---|
228 | |
---|
229 | /* DWARF 1.1 and DWARF 2 */ |
---|
230 | .debug_aranges 0 : { *(.debug_aranges) } |
---|
231 | .debug_pubnames 0 : { *(.debug_pubnames) } |
---|
232 | |
---|
233 | /* DWARF 2 */ |
---|
234 | .debug_info 0 : { *(.debug_info) } |
---|
235 | .debug_abbrev 0 : { *(.debug_abbrev) } |
---|
236 | .debug_line 0 : { *(.debug_line) } |
---|
237 | .debug_frame 0 : { *(.debug_frame) } |
---|
238 | .debug_str 0 : { *(.debug_str) } |
---|
239 | .debug_loc 0 : { *(.debug_loc) } |
---|
240 | .debug_macinfo 0 : { *(.debug_macinfo) } |
---|
241 | |
---|
242 | /* SGI/MIPS DWARF 2 extensions */ |
---|
243 | .debug_weaknames 0 : { *(.debug_weaknames) } |
---|
244 | .debug_funcnames 0 : { *(.debug_funcnames) } |
---|
245 | .debug_typenames 0 : { *(.debug_typenames) } |
---|
246 | .debug_varnames 0 : { *(.debug_varnames) } |
---|
247 | /* These must appear regardless of . */ |
---|
248 | } |
---|