Commit | Line | Data |
---|---|---|
2571583a | 1 | # Copyright (C) 2014-2017 Free Software Foundation, Inc. |
985743c7 NC |
2 | # |
3 | # Copying and distribution of this file, with or without modification, | |
4 | # are permitted in any medium without royalty provided the copyright | |
5 | # notice and this notice are preserved. | |
f2f489ac NC |
6 | |
7 | HEAP_SECTION_MSP430=" " | |
8 | HEAP_MEMORY_MSP430=" " | |
9 | ||
10 | if test ${GOT_HEAP_MSP-0} -ne 0 | |
11 | then | |
ec2d9b29 | 12 | HEAP_SECTION_MSP430=".heap ${RELOCATING-0} : |
f2f489ac NC |
13 | { |
14 | ${RELOCATING+ PROVIDE (__heap_data_start = .) ; } | |
15 | *(.heap*) | |
16 | ${RELOCATING+ PROVIDE (_heap_data_end = .) ; } | |
17 | ${RELOCATING+. = ALIGN(2);} | |
18 | ${RELOCATING+ PROVIDE (__heap_bottom = .) ; } | |
19 | ${RELOCATING+ PROVIDE (__heap_top = ${HEAP_START} + ${HEAP_LENGTH}) ; } | |
20 | } ${RELOCATING+ > heap}" | |
21 | HEAP_MEMORY_MSP430="heap(rwx) : ORIGIN = $HEAP_START, LENGTH = $HEAP_LENGTH" | |
22 | fi | |
23 | ||
24 | ||
2469cfa2 | 25 | cat <<EOF |
2571583a | 26 | /* Copyright (C) 2014-2017 Free Software Foundation, Inc. |
985743c7 NC |
27 | |
28 | Copying and distribution of this script, with or without modification, | |
29 | are permitted in any medium without royalty provided the copyright | |
30 | notice and this notice are preserved. */ | |
31 | ||
2469cfa2 NC |
32 | OUTPUT_FORMAT("${OUTPUT_FORMAT}","${OUTPUT_FORMAT}","${OUTPUT_FORMAT}") |
33 | OUTPUT_ARCH(${ARCH}) | |
34 | ||
35 | MEMORY | |
36 | { | |
37 | text (rx) : ORIGIN = $ROM_START, LENGTH = $ROM_SIZE | |
38 | data (rwx) : ORIGIN = $RAM_START, LENGTH = $RAM_SIZE | |
39 | vectors (rw) : ORIGIN = 0xffe0, LENGTH = 0x20 | |
40 | bootloader(rx) : ORIGIN = 0x0c00, LENGTH = 1K | |
41 | infomem(rx) : ORIGIN = 0x1000, LENGTH = 256 | |
42 | infomemnobits(rx) : ORIGIN = 0x1000, LENGTH = 256 | |
f2f489ac | 43 | ${HEAP_MEMORY_MSP430} |
2469cfa2 NC |
44 | } |
45 | ||
46 | SECTIONS | |
47 | { | |
13761a11 NC |
48 | /* Bootloader. */ |
49 | .bootloader ${RELOCATING-0} : | |
50 | { | |
51 | ${RELOCATING+ PROVIDE (__boot_start = .) ; } | |
52 | *(.bootloader) | |
53 | ${RELOCATING+. = ALIGN(2);} | |
54 | *(.bootloader.*) | |
55 | } ${RELOCATING+ > bootloader} | |
56 | ||
57 | /* Information memory. */ | |
58 | .infomem ${RELOCATING-0} : | |
59 | { | |
60 | *(.infomem) | |
61 | ${RELOCATING+. = ALIGN(2);} | |
62 | *(.infomem.*) | |
63 | } ${RELOCATING+ > infomem} | |
64 | ||
65 | /* Information memory (not loaded into MPU). */ | |
66 | .infomemnobits ${RELOCATING-0} : | |
67 | { | |
68 | *(.infomemnobits) | |
69 | ${RELOCATING+. = ALIGN(2);} | |
70 | *(.infomemnobits.*) | |
71 | } ${RELOCATING+ > infomemnobits} | |
72 | ||
2469cfa2 NC |
73 | /* Read-only sections, merged into text segment. */ |
74 | ${TEXT_DYNAMIC+${DYNAMIC}} | |
ec2d9b29 AM |
75 | .hash ${RELOCATING-0} : { *(.hash) } |
76 | .dynsym ${RELOCATING-0} : { *(.dynsym) } | |
77 | .dynstr ${RELOCATING-0} : { *(.dynstr) } | |
78 | .gnu.version ${RELOCATING-0} : { *(.gnu.version) } | |
79 | .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) } | |
80 | .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) } | |
81 | ||
82 | .rel.init ${RELOCATING-0} : { *(.rel.init) } | |
83 | .rela.init ${RELOCATING-0} : { *(.rela.init) } | |
84 | .rel.text ${RELOCATING-0} : | |
2469cfa2 NC |
85 | { |
86 | *(.rel.text) | |
87 | ${RELOCATING+*(.rel.text.*)} | |
88 | ${RELOCATING+*(.rel.gnu.linkonce.t*)} | |
89 | } | |
ec2d9b29 | 90 | .rela.text ${RELOCATING-0} : |
2469cfa2 NC |
91 | { |
92 | *(.rela.text) | |
93 | ${RELOCATING+*(.rela.text.*)} | |
94 | ${RELOCATING+*(.rela.gnu.linkonce.t*)} | |
95 | } | |
ec2d9b29 AM |
96 | .rel.fini ${RELOCATING-0} : { *(.rel.fini) } |
97 | .rela.fini ${RELOCATING-0} : { *(.rela.fini) } | |
98 | .rel.rodata ${RELOCATING-0} : | |
2469cfa2 NC |
99 | { |
100 | *(.rel.rodata) | |
101 | ${RELOCATING+*(.rel.rodata.*)} | |
102 | ${RELOCATING+*(.rel.gnu.linkonce.r*)} | |
103 | } | |
ec2d9b29 | 104 | .rela.rodata ${RELOCATING-0} : |
2469cfa2 NC |
105 | { |
106 | *(.rela.rodata) | |
107 | ${RELOCATING+*(.rela.rodata.*)} | |
108 | ${RELOCATING+*(.rela.gnu.linkonce.r*)} | |
109 | } | |
ec2d9b29 | 110 | .rel.data ${RELOCATING-0} : |
2469cfa2 NC |
111 | { |
112 | *(.rel.data) | |
113 | ${RELOCATING+*(.rel.data.*)} | |
114 | ${RELOCATING+*(.rel.gnu.linkonce.d*)} | |
115 | } | |
ec2d9b29 | 116 | .rela.data ${RELOCATING-0} : |
2469cfa2 NC |
117 | { |
118 | *(.rela.data) | |
119 | ${RELOCATING+*(.rela.data.*)} | |
120 | ${RELOCATING+*(.rela.gnu.linkonce.d*)} | |
121 | } | |
ec2d9b29 AM |
122 | .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) } |
123 | .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } | |
124 | .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) } | |
125 | .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } | |
126 | .rel.got ${RELOCATING-0} : { *(.rel.got) } | |
127 | .rela.got ${RELOCATING-0} : { *(.rela.got) } | |
128 | .rel.bss ${RELOCATING-0} : { *(.rel.bss) } | |
129 | .rela.bss ${RELOCATING-0} : { *(.rela.bss) } | |
130 | .rel.plt ${RELOCATING-0} : { *(.rel.plt) } | |
131 | .rela.plt ${RELOCATING-0} : { *(.rela.plt) } | |
2469cfa2 NC |
132 | |
133 | /* Internal text space. */ | |
134 | .text : | |
135 | { | |
d4b6ee67 | 136 | ${RELOCATING+. = ALIGN(2);} |
b2e4da5a L |
137 | *(SORT_NONE(.init)) |
138 | *(SORT_NONE(.init0)) /* Start here after reset. */ | |
139 | *(SORT_NONE(.init1)) | |
140 | *(SORT_NONE(.init2)) /* Copy data loop */ | |
141 | *(SORT_NONE(.init3)) | |
142 | *(SORT_NONE(.init4)) /* Clear bss */ | |
143 | *(SORT_NONE(.init5)) | |
144 | *(SORT_NONE(.init6)) /* C++ constructors. */ | |
145 | *(SORT_NONE(.init7)) | |
146 | *(SORT_NONE(.init8)) | |
147 | *(SORT_NONE(.init9)) /* Call main(). */ | |
d4b6ee67 NC |
148 | |
149 | ${CONSTRUCTING+ __ctors_start = . ; } | |
150 | ${CONSTRUCTING+ *(.ctors) } | |
151 | ${CONSTRUCTING+ __ctors_end = . ; } | |
152 | ${CONSTRUCTING+ __dtors_start = . ; } | |
153 | ${CONSTRUCTING+ *(.dtors) } | |
154 | ${CONSTRUCTING+ __dtors_end = . ; } | |
155 | ||
837a17b3 NC |
156 | ${RELOCATING+. = ALIGN(2);} |
157 | *(.lower.text.* .lower.text) | |
158 | ||
2469cfa2 NC |
159 | ${RELOCATING+. = ALIGN(2);} |
160 | *(.text) | |
161 | ${RELOCATING+. = ALIGN(2);} | |
162 | *(.text.*) | |
13761a11 NC |
163 | ${RELOCATING+. = ALIGN(2);} |
164 | *(.text:*) | |
d4b6ee67 | 165 | |
837a17b3 NC |
166 | *(.either.text.* .either.text) |
167 | ||
2469cfa2 | 168 | ${RELOCATING+. = ALIGN(2);} |
b2e4da5a L |
169 | *(SORT_NONE(.fini9)) |
170 | *(SORT_NONE(.fini8)) | |
171 | *(SORT_NONE(.fini7)) | |
172 | *(SORT_NONE(.fini6)) /* C++ destructors. */ | |
173 | *(SORT_NONE(.fini5)) | |
174 | *(SORT_NONE(.fini4)) | |
175 | *(SORT_NONE(.fini3)) | |
176 | *(SORT_NONE(.fini2)) | |
177 | *(SORT_NONE(.fini1)) | |
178 | *(SORT_NONE(.fini0)) /* Infinite loop after program termination. */ | |
179 | *(SORT_NONE(.fini)) | |
d4b6ee67 | 180 | |
f2f489ac | 181 | _etext = .; |
2469cfa2 NC |
182 | } ${RELOCATING+ > text} |
183 | ||
13761a11 NC |
184 | .rodata : |
185 | { | |
837a17b3 NC |
186 | ${RELOCATING+. = ALIGN(2);} |
187 | *(.lower.rodata.* .lower.rodata) | |
188 | ||
13761a11 NC |
189 | . = ALIGN(2); |
190 | *(.plt) | |
191 | *(.rodata .rodata.* .gnu.linkonce.r.* .const .const:*) | |
192 | *(.rodata1) | |
193 | ||
837a17b3 | 194 | *(.either.rodata.*) *(.either.rodata) |
13761a11 NC |
195 | *(.eh_frame_hdr) |
196 | KEEP (*(.eh_frame)) | |
197 | ||
198 | KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) | |
199 | ||
200 | PROVIDE (__preinit_array_start = .); | |
201 | KEEP (*(.preinit_array)) | |
202 | PROVIDE (__preinit_array_end = .); | |
203 | ||
204 | PROVIDE (__init_array_start = .); | |
205 | KEEP (*(SORT(.init_array.*))) | |
206 | KEEP (*(.init_array)) | |
207 | PROVIDE (__init_array_end = .); | |
208 | ||
209 | PROVIDE (__fini_array_start = .); | |
210 | KEEP (*(.fini_array)) | |
211 | KEEP (*(SORT(.fini_array.*))) | |
212 | PROVIDE (__fini_array_end = .); | |
13761a11 NC |
213 | |
214 | /* gcc uses crtbegin.o to find the start of the constructors, so | |
215 | we make sure it is first. Because this is a wildcard, it | |
216 | doesn't matter if the user does not actually link against | |
217 | crtbegin.o; the linker won't look for a file to match a | |
218 | wildcard. The wildcard also means that it doesn't matter which | |
219 | directory crtbegin.o is in. */ | |
220 | KEEP (*crtbegin*.o(.ctors)) | |
221 | ||
222 | /* We don't want to include the .ctor section from from the | |
223 | crtend.o file until after the sorted ctors. The .ctor section | |
224 | from the crtend file contains the end of ctors marker and it | |
225 | must be last */ | |
226 | KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) | |
227 | KEEP (*(SORT(.ctors.*))) | |
228 | KEEP (*(.ctors)) | |
229 | ||
230 | KEEP (*crtbegin*.o(.dtors)) | |
231 | KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) | |
232 | KEEP (*(SORT(.dtors.*))) | |
233 | KEEP (*(.dtors)) | |
234 | } ${RELOCATING+ > text} | |
235 | ||
236 | .vectors ${RELOCATING-0}: | |
237 | { | |
238 | ${RELOCATING+ PROVIDE (__vectors_start = .) ; } | |
239 | *(.vectors*) | |
240 | ${RELOCATING+ _vectors_end = . ; } | |
241 | } ${RELOCATING+ > vectors} | |
242 | ||
925bbbbb NC |
243 | .data ${RELOCATING-0} : |
244 | { | |
2469cfa2 | 245 | ${RELOCATING+ PROVIDE (__data_start = .) ; } |
13761a11 | 246 | ${RELOCATING+ PROVIDE (__datastart = .) ; } |
2469cfa2 | 247 | ${RELOCATING+. = ALIGN(2);} |
13761a11 NC |
248 | |
249 | KEEP (*(.jcr)) | |
250 | *(.data.rel.ro.local) *(.data.rel.ro*) | |
251 | *(.dynamic) | |
252 | ||
837a17b3 NC |
253 | ${RELOCATING+. = ALIGN(2);} |
254 | *(.lower.data.* .lower.data) | |
255 | ||
2469cfa2 | 256 | *(.data) |
727f7031 | 257 | *(.data.*) |
2469cfa2 | 258 | *(.gnu.linkonce.d*) |
13761a11 NC |
259 | KEEP (*(.gnu.linkonce.d.*personality*)) |
260 | *(.data1) | |
837a17b3 NC |
261 | |
262 | *(.either.data.* .either.data) | |
263 | ||
13761a11 NC |
264 | *(.got.plt) *(.got) |
265 | ${RELOCATING+. = ALIGN(2);} | |
266 | *(.sdata .sdata.* .gnu.linkonce.s.*) | |
2469cfa2 NC |
267 | ${RELOCATING+. = ALIGN(2);} |
268 | ${RELOCATING+ _edata = . ; } | |
925bbbbb | 269 | } ${RELOCATING+ > data ${RELOCATING+AT> text}} |
837a17b3 | 270 | |
296ebfbb NC |
271 | __romdatastart = LOADADDR(.data); |
272 | __romdatacopysize = SIZEOF(.data); | |
273 | ||
2469cfa2 NC |
274 | .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} : |
275 | { | |
727f7031 | 276 | ${RELOCATING+. = ALIGN(2);} |
0d832c8e NC |
277 | ${RELOCATING+ PROVIDE (__bss_start = .); } |
278 | ${RELOCATING+ PROVIDE (__bssstart = .); } | |
837a17b3 NC |
279 | *(.lower.bss.* .lower.bss) |
280 | ${RELOCATING+. = ALIGN(2);} | |
2469cfa2 | 281 | *(.bss) |
837a17b3 | 282 | *(.either.bss.* .either.bss) |
2469cfa2 NC |
283 | *(COMMON) |
284 | ${RELOCATING+ PROVIDE (__bss_end = .) ; } | |
2469cfa2 | 285 | } ${RELOCATING+ > data} |
0d832c8e | 286 | ${RELOCATING+ PROVIDE (__bsssize = SIZEOF(.bss)); } |
2469cfa2 NC |
287 | |
288 | .noinit ${RELOCATING+ SIZEOF(.bss) + ADDR(.bss)} : | |
289 | { | |
290 | ${RELOCATING+ PROVIDE (__noinit_start = .) ; } | |
291 | *(.noinit) | |
2469cfa2 | 292 | ${RELOCATING+ PROVIDE (__noinit_end = .) ; } |
2469cfa2 NC |
293 | } ${RELOCATING+ > data} |
294 | ||
886a2506 NC |
295 | .persistent ${RELOCATING+ SIZEOF(.noinit) + ADDR(.noinit)} : |
296 | { | |
297 | ${RELOCATING+ PROVIDE (__persistent_start = .) ; } | |
298 | *(.persistent) | |
299 | ${RELOCATING+ PROVIDE (__persistent_end = .) ; } | |
300 | } ${RELOCATING+ > data} | |
301 | ||
302 | ${RELOCATING+ _end = . ; } | |
f2f489ac | 303 | ${HEAP_SECTION_MSP430} |
2469cfa2 | 304 | |
b18c562e NC |
305 | /* Stabs for profiling information*/ |
306 | .profiler 0 : { *(.profiler) } | |
307 | ||
2469cfa2 NC |
308 | /* Stabs debugging sections. */ |
309 | .stab 0 : { *(.stab) } | |
310 | .stabstr 0 : { *(.stabstr) } | |
311 | .stab.excl 0 : { *(.stab.excl) } | |
312 | .stab.exclstr 0 : { *(.stab.exclstr) } | |
313 | .stab.index 0 : { *(.stab.index) } | |
314 | .stab.indexstr 0 : { *(.stab.indexstr) } | |
315 | .comment 0 : { *(.comment) } | |
ceb0a680 | 316 | EOF |
2a995fc1 | 317 | |
d1f70bdc | 318 | . $srcdir/scripttempl/DWARF.sc |
2a995fc1 | 319 | |
ceb0a680 | 320 | cat <<EOF |
df154dc1 | 321 | .MSP430.attributes 0 : |
13761a11 NC |
322 | { |
323 | KEEP (*(.MSP430.attributes)) | |
324 | KEEP (*(.gnu.attributes)) | |
325 | KEEP (*(__TI_build_attributes)) | |
326 | } | |
327 | ||
2469cfa2 | 328 | PROVIDE (__stack = ${STACK}) ; |
db6a5910 NC |
329 | PROVIDE (__data_start_rom = _etext) ; |
330 | PROVIDE (__data_end_rom = _etext + SIZEOF (.data)) ; | |
331 | PROVIDE (__noinit_start_rom = _etext + SIZEOF (.data)) ; | |
332 | PROVIDE (__noinit_end_rom = _etext + SIZEOF (.data) + SIZEOF (.noinit)) ; | |
f2f489ac | 333 | PROVIDE (__subdevice_has_heap = ${GOT_HEAP_MSP-0}) ; |
2469cfa2 NC |
334 | } |
335 | EOF |