1 # Copyright (C) 2014-2019 Free Software Foundation, Inc.
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.
7 HEAP_SECTION_MSP430=" "
10 if test ${GOT_HEAP_MSP-0} -ne 0
12 HEAP_SECTION_MSP430=".heap ${RELOCATING-0} :
14 ${RELOCATING+ PROVIDE (__heap_data_start = .) ; }
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"
26 /* Copyright (C) 2014-2019 Free Software Foundation, Inc.
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. */
32 OUTPUT_FORMAT("${OUTPUT_FORMAT}","${OUTPUT_FORMAT}","${OUTPUT_FORMAT}")
37 test -n "${RELOCATING}" && cat <<EOF
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
43 bootloader(rx) : ORIGIN = 0x0c00, LENGTH = 1K
44 infomem(rx) : ORIGIN = 0x1000, LENGTH = 256
45 infomemnobits(rx) : ORIGIN = 0x1000, LENGTH = 256
55 .bootloader ${RELOCATING-0} :
57 ${RELOCATING+ PROVIDE (__boot_start = .) ; }
59 ${RELOCATING+. = ALIGN(2);}
60 ${RELOCATING+*(.bootloader.*)}
61 } ${RELOCATING+ > bootloader}
63 /* Information memory. */
64 .infomem ${RELOCATING-0} :
67 ${RELOCATING+. = ALIGN(2);}
68 ${RELOCATING+*(.infomem.*)}
69 } ${RELOCATING+ > infomem}
71 /* Information memory (not loaded into MPU). */
72 .infomemnobits ${RELOCATING-0} :
75 ${RELOCATING+. = ALIGN(2);}
76 ${RELOCATING+*(.infomemnobits.*)}
77 } ${RELOCATING+ > infomemnobits}
79 /* Read-only sections, merged into text segment. */
80 ${TEXT_DYNAMIC+${DYNAMIC}}
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) }
88 .rel.init ${RELOCATING-0} : { *(.rel.init) }
89 .rela.init ${RELOCATING-0} : { *(.rela.init) }
90 .rel.text ${RELOCATING-0} :
93 ${RELOCATING+*(.rel.text.*)}
94 ${RELOCATING+*(.rel.gnu.linkonce.t*)}
96 .rela.text ${RELOCATING-0} :
99 ${RELOCATING+*(.rela.text.*)}
100 ${RELOCATING+*(.rela.gnu.linkonce.t*)}
102 .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
103 .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
104 .rel.rodata ${RELOCATING-0} :
107 ${RELOCATING+*(.rel.rodata.*)}
108 ${RELOCATING+*(.rel.gnu.linkonce.r*)}
110 .rela.rodata ${RELOCATING-0} :
113 ${RELOCATING+*(.rela.rodata.*)}
114 ${RELOCATING+*(.rela.gnu.linkonce.r*)}
116 .rel.data ${RELOCATING-0} :
119 ${RELOCATING+*(.rel.data.*)}
120 ${RELOCATING+*(.rel.gnu.linkonce.d*)}
122 .rela.data ${RELOCATING-0} :
125 ${RELOCATING+*(.rela.data.*)}
126 ${RELOCATING+*(.rela.gnu.linkonce.d*)}
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) }
139 /* Internal text space. */
140 .text ${RELOCATING-0} :
142 ${RELOCATING+. = ALIGN(2);
144 *(SORT_NONE(.init0)) /* Start here after reset. */
146 *(SORT_NONE(.init2)) /* Copy data loop */
148 *(SORT_NONE(.init4)) /* Clear bss */
150 *(SORT_NONE(.init6)) /* C++ constructors. */
153 *(SORT_NONE(.init9)) /* Call main(). */}
155 ${CONSTRUCTING+ __ctors_start = . ; }
156 ${CONSTRUCTING+ *(.ctors) }
157 ${CONSTRUCTING+ __ctors_end = . ; }
158 ${CONSTRUCTING+ __dtors_start = . ; }
159 ${CONSTRUCTING+ *(.dtors) }
160 ${CONSTRUCTING+ __dtors_end = . ; }
162 ${RELOCATING+. = ALIGN(2);
163 *(.lower.text.* .lower.text)
167 ${RELOCATING+. = ALIGN(2);
172 *(.either.text.* .either.text)
178 *(SORT_NONE(.fini6)) /* C++ destructors. */
184 *(SORT_NONE(.fini0)) /* Infinite loop after program termination. */
188 } ${RELOCATING+ > text}
190 .rodata ${RELOCATING-0} :
192 ${RELOCATING+. = ALIGN(2);
193 *(.lower.rodata.* .lower.rodata)
197 *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.* .const .const:*})
198 ${RELOCATING+*(.rodata1)
200 *(.either.rodata.*) *(.either.rodata)
204 KEEP (*(.gcc_except_table)) *(.gcc_except_table.*)
206 PROVIDE (__preinit_array_start = .);
207 KEEP (*(.preinit_array))
208 PROVIDE (__preinit_array_end = .);
210 PROVIDE (__init_array_start = .);
211 KEEP (*(SORT(.init_array.*)))
212 KEEP (*(.init_array))
213 PROVIDE (__init_array_end = .);
215 PROVIDE (__fini_array_start = .);
216 KEEP (*(.fini_array))
217 KEEP (*(SORT(.fini_array.*)))
218 PROVIDE (__fini_array_end = .);
220 /* gcc uses crtbegin.o to find the start of the constructors, so
221 we make sure it is first. Because this is a wildcard, it
222 doesn't matter if the user does not actually link against
223 crtbegin.o; the linker won't look for a file to match a
224 wildcard. The wildcard also means that it doesn't matter which
225 directory crtbegin.o is in. */
226 KEEP (*crtbegin*.o(.ctors))
228 /* We don't want to include the .ctor section from from the
229 crtend.o file until after the sorted ctors. The .ctor section
230 from the crtend file contains the end of ctors marker and it
232 KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
233 KEEP (*(SORT(.ctors.*)))
236 KEEP (*crtbegin*.o(.dtors))
237 KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
238 KEEP (*(SORT(.dtors.*)))
240 } ${RELOCATING+ > text}
242 .vectors ${RELOCATING-0} :
244 ${RELOCATING+ PROVIDE (__vectors_start = .) ; }
245 *(.vectors${RELOCATING+*})
246 ${RELOCATING+ _vectors_end = . ; }
247 } ${RELOCATING+ > vectors}
249 .data ${RELOCATING-0} :
251 ${RELOCATING+ PROVIDE (__data_start = .) ; }
252 ${RELOCATING+ PROVIDE (__datastart = .) ; }
253 ${RELOCATING+. = ALIGN(2);
256 *(.data.rel.ro.local) *(.data.rel.ro*)
260 *(.lower.data.* .lower.data)}
263 ${RELOCATING+*(.data.*)
265 KEEP (*(.gnu.linkonce.d.*personality*))
268 *(.either.data.* .either.data)
272 *(.sdata .sdata.* .gnu.linkonce.s.*)
275 } ${RELOCATING+ > data AT> text}
277 ${RELOCATING+__romdatastart = LOADADDR(.data);
278 __romdatacopysize = SIZEOF(.data);}
280 .bss ${RELOCATING-0}${RELOCATING+SIZEOF(.data) + ADDR(.data)} :
282 ${RELOCATING+. = ALIGN(2);}
283 ${RELOCATING+ PROVIDE (__bss_start = .); }
284 ${RELOCATING+ PROVIDE (__bssstart = .);
285 *(.lower.bss.* .lower.bss)
288 ${RELOCATING+*(.either.bss.* .either.bss)
290 PROVIDE (__bss_end = .);}
291 } ${RELOCATING+ > data}
292 ${RELOCATING+ PROVIDE (__bsssize = SIZEOF(.bss)); }
294 .noinit ${RELOCATING-0}${RELOCATING+SIZEOF(.bss) + ADDR(.bss)} :
296 ${RELOCATING+ PROVIDE (__noinit_start = .) ; }
298 ${RELOCATING+ PROVIDE (__noinit_end = .) ; }
299 } ${RELOCATING+ > data}
301 .persistent ${RELOCATING-0}${RELOCATING+SIZEOF(.noinit) + ADDR(.noinit)} :
303 ${RELOCATING+ PROVIDE (__persistent_start = .) ; }
305 ${RELOCATING+ PROVIDE (__persistent_end = .) ; }
306 } ${RELOCATING+ > data}
308 ${RELOCATING+ _end = . ; }
309 ${HEAP_SECTION_MSP430}
311 /* Stabs for profiling information*/
312 .profiler 0 : { *(.profiler) }
314 /* Stabs debugging sections. */
315 .stab 0 : { *(.stab) }
316 .stabstr 0 : { *(.stabstr) }
317 .stab.excl 0 : { *(.stab.excl) }
318 .stab.exclstr 0 : { *(.stab.exclstr) }
319 .stab.index 0 : { *(.stab.index) }
320 .stab.indexstr 0 : { *(.stab.indexstr) }
321 .comment 0 : { *(.comment) }
324 . $srcdir/scripttempl/DWARF.sc
326 test -n "${RELOCATING}" && cat <<EOF
327 .MSP430.attributes 0 :
329 KEEP (*(.MSP430.attributes))
330 KEEP (*(.gnu.attributes))
331 KEEP (*(__TI_build_attributes))
334 PROVIDE (__stack = ${STACK}) ;
335 PROVIDE (__data_start_rom = _etext) ;
336 PROVIDE (__data_end_rom = _etext + SIZEOF (.data)) ;
337 PROVIDE (__noinit_start_rom = _etext + SIZEOF (.data)) ;
338 PROVIDE (__noinit_end_rom = _etext + SIZEOF (.data) + SIZEOF (.noinit)) ;
339 PROVIDE (__subdevice_has_heap = ${GOT_HEAP_MSP-0}) ;