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