1 | OUTPUT_FORMAT("elf32-lm32", "elf32-lm32", |
---|
2 | "elf32-lm32") |
---|
3 | OUTPUT_ARCH(lm32) |
---|
4 | ENTRY(start) |
---|
5 | STARTUP(start.o) |
---|
6 | /* Do we need any of these for elf? |
---|
7 | __DYNAMIC = 0; */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Declare some sizes. Heap is sized at whatever ram space is left. |
---|
11 | */ |
---|
12 | RamBase = DEFINED(RamBase) ? RamBase : 0x08000000; |
---|
13 | RamSize = DEFINED(RamSize) ? RamSize : 32M; |
---|
14 | RamEnd = RamBase + RamSize; |
---|
15 | HeapSize = DEFINED(HeapSize) ? HeapSize : 2M; |
---|
16 | |
---|
17 | MEMORY { |
---|
18 | ebr : ORIGIN = 0x04000000 , LENGTH = 32k |
---|
19 | sdram : ORIGIN = 0x08000000 , LENGTH = 32M |
---|
20 | } |
---|
21 | SECTIONS |
---|
22 | { |
---|
23 | .boot : |
---|
24 | { |
---|
25 | KEEP (*(.boot)) |
---|
26 | } > ebr |
---|
27 | |
---|
28 | /* Read-only sections, merged into text segment: */ |
---|
29 | .interp : { *(.interp) } > sdram |
---|
30 | .hash : { *(.hash) } > sdram |
---|
31 | .dynsym : { *(.dynsym) } > sdram |
---|
32 | .dynstr : { *(.dynstr) } > sdram |
---|
33 | .gnu.version : { *(.gnu.version) } > sdram |
---|
34 | .gnu.version_d : { *(.gnu.version_d) } > sdram |
---|
35 | .gnu.version_r : { *(.gnu.version_r) } > sdram |
---|
36 | .rela.text : |
---|
37 | { *(.rela.text) *(.rela.gnu.linkonce.t*) } > sdram |
---|
38 | .rela.data : |
---|
39 | { *(.rela.data) *(.rela.gnu.linkonce.d*) } > sdram |
---|
40 | .rela.rodata : |
---|
41 | { *(.rela.rodata*) *(.rela.gnu.linkonce.r*) } > sdram |
---|
42 | .rela.got : { *(.rela.got) } > sdram |
---|
43 | .rela.got1 : { *(.rela.got1) } > sdram |
---|
44 | .rela.got2 : { *(.rela.got2) } > sdram |
---|
45 | .rela.ctors : { *(.rela.ctors) } > sdram |
---|
46 | .rela.dtors : { *(.rela.dtors) } > sdram |
---|
47 | .rela.init : { *(.rela.init) } > sdram |
---|
48 | .rela.fini : { *(.rela.fini) } > sdram |
---|
49 | .rela.bss : { *(.rela.bss) } > sdram |
---|
50 | .rela.plt : { *(.rela.plt) } > sdram |
---|
51 | .rela.sdata : { *(.rela.sdata) } > sdram |
---|
52 | .rela.sbss : { *(.rela.sbss) } > sdram |
---|
53 | .rela.sdata2 : { *(.rela.sdata2) } > sdram |
---|
54 | .rela.sbss2 : { *(.rela.sbss2) } > sdram |
---|
55 | .rela.dyn : { *(.rela.dyn) } > sdram |
---|
56 | |
---|
57 | .init : { KEEP(*(.init)) } > sdram |
---|
58 | |
---|
59 | .text : |
---|
60 | { |
---|
61 | *(.text*) |
---|
62 | |
---|
63 | /* |
---|
64 | * Special FreeBSD sysctl sections. |
---|
65 | */ |
---|
66 | . = ALIGN (16); |
---|
67 | __start_set_sysctl_set = .; |
---|
68 | *(set_sysctl_*); |
---|
69 | __stop_set_sysctl_set = ABSOLUTE(.); |
---|
70 | *(set_domain_*); |
---|
71 | *(set_pseudo_*); |
---|
72 | |
---|
73 | /* .gnu.warning sections are handled specially by elf32.em. */ |
---|
74 | *(.gnu.warning) |
---|
75 | *(.gnu.linkonce.t*) |
---|
76 | } > sdram |
---|
77 | |
---|
78 | .fini : { _fini = .; KEEP(*(.fini)) } > sdram |
---|
79 | |
---|
80 | .rodata : { *(.rodata*) KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) } > sdram |
---|
81 | .rodata1 : { *(.rodata1) } > sdram |
---|
82 | .tdata : { |
---|
83 | _TLS_Data_begin = .; |
---|
84 | *(.tdata .tdata.* .gnu.linkonce.td.*) |
---|
85 | _TLS_Data_end = .; |
---|
86 | } > sdram |
---|
87 | .tbss : { |
---|
88 | _TLS_BSS_begin = .; |
---|
89 | *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) |
---|
90 | _TLS_BSS_end = .; |
---|
91 | } > sdram |
---|
92 | _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin; |
---|
93 | _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin; |
---|
94 | _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin; |
---|
95 | _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin; |
---|
96 | _TLS_Size = _TLS_BSS_end - _TLS_Data_begin; |
---|
97 | _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss)); |
---|
98 | |
---|
99 | /* Adjust the address for the data segment. We want to adjust up to |
---|
100 | the same address within the page on the next page up. */ |
---|
101 | . = ALIGN(0x10000) + (. & (0x10000 - 1)); |
---|
102 | /* Ensure the __preinit_array_start label is properly aligned. We |
---|
103 | could instead move the label definition inside the section, but |
---|
104 | the linker would then create the section even if it turns out to |
---|
105 | be empty, which isn't pretty. */ |
---|
106 | . = ALIGN(32 / 8); |
---|
107 | PROVIDE (__preinit_array_start = .); |
---|
108 | .preinit_array : { *(.preinit_array) } >sdram |
---|
109 | PROVIDE (__preinit_array_end = .); |
---|
110 | PROVIDE (__init_array_start = .); |
---|
111 | .init_array : { *(.init_array) } >sdram |
---|
112 | PROVIDE (__init_array_end = .); |
---|
113 | PROVIDE (__fini_array_start = .); |
---|
114 | .fini_array : { *(.fini_array) } >sdram |
---|
115 | PROVIDE (__fini_array_end = .); |
---|
116 | |
---|
117 | /* _SDA2_BASE_ = __SDATA2_START__ + 0x8000; */ |
---|
118 | .sdata2 : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) } >sdram |
---|
119 | .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) |
---|
120 | /* avoid empty sdata2/sbss2 area -- __eabi would not set up r2 |
---|
121 | * which may be important if run-time loading is used |
---|
122 | */ |
---|
123 | . += 1; |
---|
124 | } >sdram |
---|
125 | .eh_frame : { *.(eh_frame) } >sdram |
---|
126 | |
---|
127 | /* NOTE: if the BSP uses page tables, the correctness of |
---|
128 | * '_etext' (and __DATA_START__) is CRUCIAL - otherwise, |
---|
129 | * an invalid mapping may result!!! |
---|
130 | */ |
---|
131 | _etext = .; |
---|
132 | PROVIDE (etext = .); |
---|
133 | |
---|
134 | /* Adjust the address for the data segment. We want to adjust up to |
---|
135 | the same address within the page on the next page up. It would |
---|
136 | be more correct to do this: |
---|
137 | . = ALIGN(0x40000) + (ALIGN(8) & (0x40000 - 1)); |
---|
138 | The current expression does not correctly handle the case of a |
---|
139 | text segment ending precisely at the end of a page; it causes the |
---|
140 | data segment to skip a page. The above expression does not have |
---|
141 | this problem, but it will currently (2/95) cause BFD to allocate |
---|
142 | a single segment, combining both text and data, for this case. |
---|
143 | This will prevent the text segment from being shared among |
---|
144 | multiple executions of the program; I think that is more |
---|
145 | important than losing a page of the virtual address space (note |
---|
146 | that no actual memory is lost; the page which is skipped can not |
---|
147 | be referenced). */ |
---|
148 | . = ALIGN(0x1000); |
---|
149 | .data ALIGN(0x1000) : |
---|
150 | { |
---|
151 | /* NOTE: if the BSP uses page tables, the correctness of |
---|
152 | * '__DATA_START__' (and _etext) is CRUCIAL - otherwise, |
---|
153 | * an invalid mapping may result!!! |
---|
154 | */ |
---|
155 | PROVIDE(__DATA_START__ = ABSOLUTE(.) ); |
---|
156 | *(.data .data.* .gnu.linkonce.d*) |
---|
157 | KEEP (*(SORT(.rtemsrwset.*))) |
---|
158 | SORT(CONSTRUCTORS) |
---|
159 | } > sdram |
---|
160 | .data1 : { *(.data1) } > sdram |
---|
161 | PROVIDE (__EXCEPT_START__ = .); |
---|
162 | .gcc_except_table : { |
---|
163 | *(.gcc_except_table) |
---|
164 | *(.gcc_except_table.*) |
---|
165 | } > sdram |
---|
166 | PROVIDE (__EXCEPT_END__ = .); |
---|
167 | .got1 : { *(.got1) } > sdram |
---|
168 | /* Put .ctors and .dtors next to the .got2 section, so that the pointers |
---|
169 | get relocated with -mrelocatable. Also put in the .fixup pointers. |
---|
170 | The current compiler no longer needs this, but keep it around for 2.7.2 */ |
---|
171 | PROVIDE (_GOT2_START_ = .); |
---|
172 | .got2 : { *(.got2) } > sdram |
---|
173 | .dynamic : { *(.dynamic) } > sdram |
---|
174 | |
---|
175 | .ctors : |
---|
176 | { |
---|
177 | /* gcc uses crtbegin.o to find the start of |
---|
178 | the constructors, so we make sure it is |
---|
179 | first. Because this is a wildcard, it |
---|
180 | doesn't matter if the user does not |
---|
181 | actually link against crtbegin.o; the |
---|
182 | linker won't look for a file to match a |
---|
183 | wildcard. The wildcard also means that it |
---|
184 | doesn't matter which directory crtbegin.o |
---|
185 | is in. */ |
---|
186 | KEEP (*crtbegin.o(.ctors)) |
---|
187 | /* We don't want to include the .ctor section from |
---|
188 | from the crtend.o file until after the sorted ctors. |
---|
189 | The .ctor section from the crtend file contains the |
---|
190 | end of ctors marker and it must be last */ |
---|
191 | KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) |
---|
192 | KEEP (*(SORT(.ctors.*))) |
---|
193 | KEEP (*(.ctors)) |
---|
194 | } > sdram |
---|
195 | .dtors : |
---|
196 | { |
---|
197 | KEEP (*crtbegin.o(.dtors)) |
---|
198 | KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) |
---|
199 | KEEP (*(SORT(.dtors.*))) |
---|
200 | KEEP (*(.dtors)) |
---|
201 | } > sdram |
---|
202 | |
---|
203 | |
---|
204 | PROVIDE (_FIXUP_START_ = .); |
---|
205 | .fixup : { *(.fixup) } > sdram |
---|
206 | PROVIDE (_FIXUP_END_ = .); |
---|
207 | PROVIDE (_GOT2_END_ = .); |
---|
208 | PROVIDE (_GOT_START_ = .); |
---|
209 | |
---|
210 | .got : { *(.got) } > sdram |
---|
211 | .got.plt : { *(.got.plt) } > sdram |
---|
212 | |
---|
213 | PROVIDE (_GOT_END_ = .); |
---|
214 | |
---|
215 | .jcr : { KEEP (*(.jcr)) } > sdram |
---|
216 | |
---|
217 | /* We want the small data sections together, so single-instruction offsets |
---|
218 | can access them all, and initialized data all before uninitialized, so |
---|
219 | we can shorten the on-disk segment size. */ |
---|
220 | /* _SDA_BASE_ = __SDATA_START__ + 0x8000; */ |
---|
221 | .sdata : { *(.sdata*) *(.gnu.linkonce.s.*) } >sdram |
---|
222 | _edata = .; |
---|
223 | _gp = .; |
---|
224 | PROVIDE (edata = .); |
---|
225 | .sbss : |
---|
226 | { |
---|
227 | _clear_start = .; |
---|
228 | PROVIDE (__sbss_start = .); |
---|
229 | *(.dynsbss) |
---|
230 | *(.sbss* .gnu.linkonce.sb.*) |
---|
231 | *(.scommon) |
---|
232 | /* avoid empty sdata/sbss area -- __eabi would not set up r13 |
---|
233 | * which may be important if run-time loading is used |
---|
234 | */ |
---|
235 | . += 1; |
---|
236 | . = ALIGN(16); |
---|
237 | PROVIDE (__sbss_end = .); |
---|
238 | } > sdram |
---|
239 | .plt : { *(.plt) } > sdram |
---|
240 | .bss : |
---|
241 | { |
---|
242 | PROVIDE (__bss_start = .); |
---|
243 | *(.dynbss) |
---|
244 | *(.bss .bss* .gnu.linkonce.b*) |
---|
245 | *(COMMON) |
---|
246 | . = ALIGN(16); |
---|
247 | _end = . ; |
---|
248 | __rtems_end = . ; |
---|
249 | PROVIDE (end = .); |
---|
250 | |
---|
251 | . = ALIGN (16); |
---|
252 | _clear_end = .; |
---|
253 | |
---|
254 | } > sdram |
---|
255 | |
---|
256 | .rtemsstack (NOLOAD) : { |
---|
257 | *(SORT(.rtemsstack.*)) |
---|
258 | WorkAreaBase = .; |
---|
259 | } > sdram |
---|
260 | |
---|
261 | /DISCARD/ : |
---|
262 | { |
---|
263 | *(.comment) |
---|
264 | } |
---|
265 | |
---|
266 | |
---|
267 | /* Stabs debugging sections. */ |
---|
268 | .stab 0 : { *(.stab) } |
---|
269 | .stabstr 0 : { *(.stabstr) } |
---|
270 | .stab.excl 0 : { *(.stab.excl) } |
---|
271 | .stab.exclstr 0 : { *(.stab.exclstr) } |
---|
272 | .stab.index 0 : { *(.stab.index) } |
---|
273 | .stab.indexstr 0 : { *(.stab.indexstr) } |
---|
274 | .comment 0 : { *(.comment) } |
---|
275 | |
---|
276 | /* DWARF debug sections. |
---|
277 | Symbols in the DWARF debugging sections are relative to the beginning |
---|
278 | of the section so we begin them at 0. */ |
---|
279 | /* DWARF 1 */ |
---|
280 | .debug 0 : { *(.debug) } |
---|
281 | .line 0 : { *(.line) } |
---|
282 | |
---|
283 | /* GNU DWARF 1 extensions */ |
---|
284 | .debug_srcinfo 0 : { *(.debug_srcinfo) } |
---|
285 | .debug_sfnames 0 : { *(.debug_sfnames) } |
---|
286 | |
---|
287 | /* DWARF 1.1 and DWARF 2 */ |
---|
288 | .debug_aranges 0 : { *(.debug_aranges) } |
---|
289 | .debug_pubnames 0 : { *(.debug_pubnames) } |
---|
290 | |
---|
291 | /* DWARF 2 */ |
---|
292 | .debug_info 0 : { *(.debug_info) } |
---|
293 | .debug_abbrev 0 : { *(.debug_abbrev) } |
---|
294 | .debug_line 0 : { *(.debug_line) } |
---|
295 | .debug_frame 0 : { *(.debug_frame) } |
---|
296 | .debug_str 0 : { *(.debug_str) } |
---|
297 | .debug_loc 0 : { *(.debug_loc) } |
---|
298 | .debug_macinfo 0 : { *(.debug_macinfo) } |
---|
299 | |
---|
300 | /* SGI/MIPS DWARF 2 extensions */ |
---|
301 | .debug_weaknames 0 : { *(.debug_weaknames) } |
---|
302 | .debug_funcnames 0 : { *(.debug_funcnames) } |
---|
303 | .debug_typenames 0 : { *(.debug_typenames) } |
---|
304 | .debug_varnames 0 : { *(.debug_varnames) } |
---|
305 | /* These must appear regardless of . */ |
---|
306 | } |
---|