1 |
8 |
jlechner |
ENTRY(_start)
|
2 |
|
|
OUTPUT_FORMAT("elf32-scarts_16", "elf32-scarts_16", "elf32-scarts_16")
|
3 |
|
|
OUTPUT_ARCH(scarts_16)
|
4 |
|
|
SEARCH_DIR(@SCARTS_SEARCH_DIR@)
|
5 |
|
|
|
6 |
|
|
/*
|
7 |
|
|
* This is the map for the code memory (addresses grow downwards)
|
8 |
|
|
* +--------------------+ <- @SCARTS_BOOTROM_VMA_START@
|
9 |
|
|
* | .text |
|
10 |
|
|
* +--------------------+ <- @SCARTS_BOOTROM_VMA_END@
|
11 |
|
|
*
|
12 |
|
|
* This is the map for the data memory (addresses grow downwards)
|
13 |
|
|
* +--------------------+ <- @SCARTS_DATAMEM_BOOTLOADER_VMA_START@
|
14 |
|
|
* | .rodata | constant data goes here
|
15 |
|
|
* +--------------------+
|
16 |
|
|
* | .data | initialized data goes here
|
17 |
|
|
* +--------------------+
|
18 |
|
|
* | .bss |
|
19 |
|
|
* | __bss_start | start of bss
|
20 |
|
|
* | _end | start of heap
|
21 |
|
|
* +--------------------+
|
22 |
|
|
* . .
|
23 |
|
|
* . .
|
24 |
|
|
* . .
|
25 |
|
|
* | __stack | top of stack
|
26 |
|
|
* +--------------------+ <- @SCARTS_DATAMEM_BOOTLOADER_VMA_END@
|
27 |
|
|
*/
|
28 |
|
|
|
29 |
|
|
/* MWA: please see important comments on the allocation of various sections in
|
30 |
|
|
memory throughout this document. */
|
31 |
|
|
MEMORY
|
32 |
|
|
{
|
33 |
|
|
ROM (rx) : ORIGIN = @SCARTS_BOOTROM_VMA_START@, LENGTH = @SCARTS_BOOTROM_SIZE@
|
34 |
|
|
ROM_LMA (rx) : ORIGIN = @SCARTS_BOOTROM_LMA_START@, LENGTH = @SCARTS_BOOTROM_SIZE@
|
35 |
|
|
RAM (!rx) : ORIGIN = @SCARTS_DATAMEM_BOOTLOADER_VMA_START@, LENGTH = @SCARTS_DATAMEM_BOOTLOADER_SIZE@
|
36 |
|
|
RAM_LMA (!rx) : ORIGIN = @SCARTS_DATAMEM_BOOTLOADER_LMA_START@, LENGTH = @SCARTS_DATAMEM_BOOTLOADER_SIZE@
|
37 |
|
|
}
|
38 |
|
|
|
39 |
|
|
/* Allocate the stack at the top of the data memory, since the stack grows down. */
|
40 |
|
|
PROVIDE (__stack = @SCARTS_DATAMEM_BOOTLOADER_VMA_END@ + 1);
|
41 |
|
|
|
42 |
|
|
SECTIONS
|
43 |
|
|
{
|
44 |
|
|
/* Read-only sections, merged into text segment: */
|
45 |
|
|
PROVIDE (__executable_start = 0); . = 0;
|
46 |
|
|
.interp : { *(.interp) }
|
47 |
|
|
.note.gnu.build-id : { *(.note.gnu.build-id) }
|
48 |
|
|
.hash : { *(.hash) }
|
49 |
|
|
.gnu.hash : { *(.gnu.hash) }
|
50 |
|
|
.dynsym : { *(.dynsym) }
|
51 |
|
|
.dynstr : { *(.dynstr) }
|
52 |
|
|
.gnu.version : { *(.gnu.version) }
|
53 |
|
|
.gnu.version_d : { *(.gnu.version_d) }
|
54 |
|
|
.gnu.version_r : { *(.gnu.version_r) }
|
55 |
|
|
.rel.init : { *(.rel.init) }
|
56 |
|
|
.rela.init : { *(.rela.init) }
|
57 |
|
|
.rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
|
58 |
|
|
.rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
|
59 |
|
|
.rel.fini : { *(.rel.fini) }
|
60 |
|
|
.rela.fini : { *(.rela.fini) }
|
61 |
|
|
.rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
|
62 |
|
|
.rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
|
63 |
|
|
.rel.data.rel.ro : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) }
|
64 |
|
|
.rela.data.rel.ro : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) }
|
65 |
|
|
.rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
|
66 |
|
|
.rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
|
67 |
|
|
.rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
|
68 |
|
|
.rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
|
69 |
|
|
.rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
|
70 |
|
|
.rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
|
71 |
|
|
.rel.ctors : { *(.rel.ctors) }
|
72 |
|
|
.rela.ctors : { *(.rela.ctors) }
|
73 |
|
|
.rel.dtors : { *(.rel.dtors) }
|
74 |
|
|
.rela.dtors : { *(.rela.dtors) }
|
75 |
|
|
.rel.got : { *(.rel.got) }
|
76 |
|
|
.rela.got : { *(.rela.got) }
|
77 |
|
|
.rel.sdata : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) }
|
78 |
|
|
.rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) }
|
79 |
|
|
.rel.sbss : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) }
|
80 |
|
|
.rela.sbss : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) }
|
81 |
|
|
.rel.sdata2 : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) }
|
82 |
|
|
.rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) }
|
83 |
|
|
.rel.sbss2 : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) }
|
84 |
|
|
.rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) }
|
85 |
|
|
.rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
|
86 |
|
|
.rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
|
87 |
|
|
.rel.plt : { *(.rel.plt) }
|
88 |
|
|
.rela.plt : { *(.rela.plt) }
|
89 |
|
|
.init :
|
90 |
|
|
{
|
91 |
|
|
KEEP (*(.init))
|
92 |
|
|
} =0
|
93 |
|
|
.plt : { *(.plt) }
|
94 |
|
|
.text :
|
95 |
|
|
{
|
96 |
|
|
*(.text .stub .text.* .gnu.linkonce.t.*)
|
97 |
|
|
KEEP (*(.text.*personality*))
|
98 |
|
|
/* .gnu.warning sections are handled specially by elf32.em. */
|
99 |
|
|
*(.gnu.warning)
|
100 |
|
|
} >ROM AT>ROM_LMA
|
101 |
|
|
.fini :
|
102 |
|
|
{
|
103 |
|
|
KEEP (*(.fini))
|
104 |
|
|
} =0
|
105 |
|
|
PROVIDE (__etext = .);
|
106 |
|
|
PROVIDE (_etext = .);
|
107 |
|
|
PROVIDE (etext = .);
|
108 |
|
|
/* MWA: The .rodata section is allocated in RAM, not in ROM, since, in the
|
109 |
|
|
SCARTS architecture, the ROM can only be addressed instruction-wise. As
|
110 |
|
|
a result, the address for the data segment is reset before the .rodata
|
111 |
|
|
section is defined. */
|
112 |
|
|
/* Adjust the address for the data segment. We want to adjust up to
|
113 |
|
|
the same address within the page on the next page up. */
|
114 |
|
|
. = 0;
|
115 |
|
|
/* MWA: For some, yet unknown, reason, large data types may be misaligned at
|
116 |
|
|
the LMA, but be correctly aligned at the VMA. As an imperfect workaround
|
117 |
|
|
we enforce proper alignment by the following simple address arithmetic:
|
118 |
|
|
LMA(x) = VMA(x) (for RAM == RAM_LMA) */
|
119 |
|
|
/* .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } >RAM AT>RAM_LMA */
|
120 |
|
|
.rodata : AT(ADDR(.rodata))
|
121 |
|
|
{
|
122 |
|
|
*(.rodata .rodata.* .gnu.linkonce.r.*)
|
123 |
|
|
} >RAM
|
124 |
|
|
.rodata1 : { *(.rodata1) }
|
125 |
|
|
.sdata2 :
|
126 |
|
|
{
|
127 |
|
|
*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
|
128 |
|
|
}
|
129 |
|
|
.sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
|
130 |
|
|
.eh_frame_hdr : { *(.eh_frame_hdr) }
|
131 |
|
|
.eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
|
132 |
|
|
.gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
|
133 |
|
|
/* Exception handling */
|
134 |
|
|
.eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
|
135 |
|
|
.gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
|
136 |
|
|
/* Thread Local Storage sections */
|
137 |
|
|
.tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
|
138 |
|
|
.tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
|
139 |
|
|
.preinit_array :
|
140 |
|
|
{
|
141 |
|
|
PROVIDE_HIDDEN (__preinit_array_start = .);
|
142 |
|
|
KEEP (*(.preinit_array))
|
143 |
|
|
PROVIDE_HIDDEN (__preinit_array_end = .);
|
144 |
|
|
}
|
145 |
|
|
.init_array :
|
146 |
|
|
{
|
147 |
|
|
PROVIDE_HIDDEN (__init_array_start = .);
|
148 |
|
|
KEEP (*(SORT(.init_array.*)))
|
149 |
|
|
KEEP (*(.init_array))
|
150 |
|
|
PROVIDE_HIDDEN (__init_array_end = .);
|
151 |
|
|
}
|
152 |
|
|
.fini_array :
|
153 |
|
|
{
|
154 |
|
|
PROVIDE_HIDDEN (__fini_array_start = .);
|
155 |
|
|
KEEP (*(.fini_array))
|
156 |
|
|
KEEP (*(SORT(.fini_array.*)))
|
157 |
|
|
PROVIDE_HIDDEN (__fini_array_end = .);
|
158 |
|
|
}
|
159 |
|
|
.ctors :
|
160 |
|
|
{
|
161 |
|
|
/* gcc uses crtbegin.o to find the start of
|
162 |
|
|
the constructors, so we make sure it is
|
163 |
|
|
first. Because this is a wildcard, it
|
164 |
|
|
doesn't matter if the user does not
|
165 |
|
|
actually link against crtbegin.o; the
|
166 |
|
|
linker won't look for a file to match a
|
167 |
|
|
wildcard. The wildcard also means that it
|
168 |
|
|
doesn't matter which directory crtbegin.o
|
169 |
|
|
is in. */
|
170 |
|
|
KEEP (*crtbegin.o(.ctors))
|
171 |
|
|
KEEP (*crtbegin?.o(.ctors))
|
172 |
|
|
/* We don't want to include the .ctor section from
|
173 |
|
|
the crtend.o file until after the sorted ctors.
|
174 |
|
|
The .ctor section from the crtend file contains the
|
175 |
|
|
end of ctors marker and it must be last */
|
176 |
|
|
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
|
177 |
|
|
KEEP (*(SORT(.ctors.*)))
|
178 |
|
|
KEEP (*(.ctors))
|
179 |
|
|
}
|
180 |
|
|
.dtors :
|
181 |
|
|
{
|
182 |
|
|
KEEP (*crtbegin.o(.dtors))
|
183 |
|
|
KEEP (*crtbegin?.o(.dtors))
|
184 |
|
|
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
|
185 |
|
|
KEEP (*(SORT(.dtors.*)))
|
186 |
|
|
KEEP (*(.dtors))
|
187 |
|
|
}
|
188 |
|
|
.jcr : { KEEP (*(.jcr)) }
|
189 |
|
|
.data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
|
190 |
|
|
.dynamic : { *(.dynamic) }
|
191 |
|
|
/* MWA: For some, yet unknown, reason, large data types may be misaligned at
|
192 |
|
|
the LMA, but be correctly aligned at the VMA. As an imperfect workaround
|
193 |
|
|
we enforce proper alignment by the following simple address arithmetic:
|
194 |
|
|
LMA(x) = VMA(x) (for RAM == RAM_LMA) */
|
195 |
|
|
/* .data :
|
196 |
|
|
{
|
197 |
|
|
*(.data .data.* .gnu.linkonce.d.*)
|
198 |
|
|
KEEP (*(.gnu.linkonce.d.*personality*))
|
199 |
|
|
SORT(CONSTRUCTORS)
|
200 |
|
|
} >RAM AT>RAM_LMA */
|
201 |
|
|
.data : AT(ADDR(.data))
|
202 |
|
|
{
|
203 |
|
|
*(.data .data.* .gnu.linkonce.d.*)
|
204 |
|
|
KEEP (*(.gnu.linkonce.d.*personality*))
|
205 |
|
|
SORT(CONSTRUCTORS)
|
206 |
|
|
} >RAM
|
207 |
|
|
.data1 : { *(.data1) }
|
208 |
|
|
.got : { *(.got.plt) *(.got) }
|
209 |
|
|
/* We want the small data sections together, so single-instruction offsets
|
210 |
|
|
can access them all, and initialized data all before uninitialized, so
|
211 |
|
|
we can shorten the on-disk segment size. */
|
212 |
|
|
.sdata :
|
213 |
|
|
{
|
214 |
|
|
*(.sdata .sdata.* .gnu.linkonce.s.*)
|
215 |
|
|
}
|
216 |
|
|
_edata = .; PROVIDE (edata = .);
|
217 |
|
|
__bss_start = .;
|
218 |
|
|
.sbss :
|
219 |
|
|
{
|
220 |
|
|
*(.dynsbss)
|
221 |
|
|
*(.sbss .sbss.* .gnu.linkonce.sb.*)
|
222 |
|
|
*(.scommon)
|
223 |
|
|
}
|
224 |
|
|
/* MWA: For some, yet unknown, reason, large data types may be misaligned at
|
225 |
|
|
the LMA, but be correctly aligned at the VMA. As an imperfect workaround
|
226 |
|
|
we enforce proper alignment by the following simple address arithmetic:
|
227 |
|
|
LMA(x) = VMA(x) (for RAM == RAM_LMA) */
|
228 |
|
|
/* .bss :
|
229 |
|
|
{
|
230 |
|
|
*(.dynbss)
|
231 |
|
|
*(.bss .bss.* .gnu.linkonce.b.*)
|
232 |
|
|
*(COMMON)
|
233 |
|
|
. = ALIGN(. != 0 ? 1 : 1);
|
234 |
|
|
} >RAM AT>RAM_LMA */
|
235 |
|
|
.bss : AT(ADDR(.bss))
|
236 |
|
|
{
|
237 |
|
|
*(.dynbss)
|
238 |
|
|
*(.bss .bss.* .gnu.linkonce.b.*)
|
239 |
|
|
*(COMMON)
|
240 |
|
|
/* Align here to ensure that the .bss section occupies space up to
|
241 |
|
|
_end. Align after .bss to ensure correct alignment even if the
|
242 |
|
|
.bss section disappears because there are no input sections.
|
243 |
|
|
FIXME: Why do we need it? When there is no .bss section, we don't
|
244 |
|
|
pad the .data section. */
|
245 |
|
|
. = ALIGN(. != 0 ? 1 : 1);
|
246 |
|
|
} >RAM
|
247 |
|
|
. = ALIGN(1);
|
248 |
|
|
. = ALIGN(1);
|
249 |
|
|
_end = .; PROVIDE (end = .);
|
250 |
|
|
/* Stabs debugging sections. */
|
251 |
|
|
.stab 0 : { *(.stab) }
|
252 |
|
|
.stabstr 0 : { *(.stabstr) }
|
253 |
|
|
.stab.excl 0 : { *(.stab.excl) }
|
254 |
|
|
.stab.exclstr 0 : { *(.stab.exclstr) }
|
255 |
|
|
.stab.index 0 : { *(.stab.index) }
|
256 |
|
|
.stab.indexstr 0 : { *(.stab.indexstr) }
|
257 |
|
|
.comment 0 : { *(.comment) }
|
258 |
|
|
/* DWARF debug sections.
|
259 |
|
|
Symbols in the DWARF debugging sections are relative to the beginning
|
260 |
|
|
of the section so we begin them at 0. */
|
261 |
|
|
/* DWARF 1 */
|
262 |
|
|
.debug 0 : { *(.debug) }
|
263 |
|
|
.line 0 : { *(.line) }
|
264 |
|
|
/* GNU DWARF 1 extensions */
|
265 |
|
|
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
266 |
|
|
.debug_sfnames 0 : { *(.debug_sfnames) }
|
267 |
|
|
/* DWARF 1.1 and DWARF 2 */
|
268 |
|
|
.debug_aranges 0 : { *(.debug_aranges) }
|
269 |
|
|
.debug_pubnames 0 : { *(.debug_pubnames) }
|
270 |
|
|
/* DWARF 2 */
|
271 |
|
|
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
272 |
|
|
.debug_abbrev 0 : { *(.debug_abbrev) }
|
273 |
|
|
.debug_line 0 : { *(.debug_line) }
|
274 |
|
|
.debug_frame 0 : { *(.debug_frame) }
|
275 |
|
|
.debug_str 0 : { *(.debug_str) }
|
276 |
|
|
.debug_loc 0 : { *(.debug_loc) }
|
277 |
|
|
.debug_macinfo 0 : { *(.debug_macinfo) }
|
278 |
|
|
/* SGI/MIPS DWARF 2 extensions */
|
279 |
|
|
.debug_weaknames 0 : { *(.debug_weaknames) }
|
280 |
|
|
.debug_funcnames 0 : { *(.debug_funcnames) }
|
281 |
|
|
.debug_typenames 0 : { *(.debug_typenames) }
|
282 |
|
|
.debug_varnames 0 : { *(.debug_varnames) }
|
283 |
|
|
/* DWARF 3 */
|
284 |
|
|
.debug_pubtypes 0 : { *(.debug_pubtypes) }
|
285 |
|
|
.debug_ranges 0 : { *(.debug_ranges) }
|
286 |
|
|
.gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
|
287 |
|
|
/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }
|
288 |
|
|
}
|