1 # Copyright (C) 2014-2017 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.
8 /* Copyright (C) 2014-2017 Free Software Foundation, Inc.
10 Copying and distribution of this script, with or without modification,
11 are permitted in any medium without royalty provided the copyright
12 notice and this notice are preserved. */
14 OUTPUT_FORMAT("${OUTPUT_FORMAT}","${OUTPUT_FORMAT}","${OUTPUT_FORMAT}")
17 __TEXT_REGION_LENGTH__ = DEFINED(__TEXT_REGION_LENGTH__) ? __TEXT_REGION_LENGTH__ : $TEXT_LENGTH;
18 __DATA_REGION_LENGTH__ = DEFINED(__DATA_REGION_LENGTH__) ? __DATA_REGION_LENGTH__ : $DATA_LENGTH;
19 __FUSE_REGION_LENGTH__ = DEFINED(__FUSE_REGION_LENGTH__) ? __FUSE_REGION_LENGTH__ : 2;
20 __LOCK_REGION_LENGTH__ = DEFINED(__LOCK_REGION_LENGTH__) ? __LOCK_REGION_LENGTH__ : 2;
21 __SIGNATURE_REGION_LENGTH__ = DEFINED(__SIGNATURE_REGION_LENGTH__) ? __SIGNATURE_REGION_LENGTH__ : 4;
25 text (rx) : ORIGIN = $TEXT_ORIGIN, LENGTH = __TEXT_REGION_LENGTH__
26 data (rw!x) : ORIGIN = $DATA_ORIGIN, LENGTH = __DATA_REGION_LENGTH__
28 /* Provide offsets for config, lock and signature to match
29 production file format. Ignore offsets in datasheet. */
31 config (rw!x) : ORIGIN = 0x820000, LENGTH = __FUSE_REGION_LENGTH__
32 lock (rw!x) : ORIGIN = 0x830000, LENGTH = __LOCK_REGION_LENGTH__
33 signature (rw!x) : ORIGIN = 0x840000, LENGTH = __SIGNATURE_REGION_LENGTH__
38 /* Read-only sections, merged into text segment: */
39 ${TEXT_DYNAMIC+${DYNAMIC}}
40 .hash ${RELOCATING-0} : { *(.hash) }
41 .dynsym ${RELOCATING-0} : { *(.dynsym) }
42 .dynstr ${RELOCATING-0} : { *(.dynstr) }
43 .gnu.version ${RELOCATING-0} : { *(.gnu.version) }
44 .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) }
45 .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) }
47 .rel.init ${RELOCATING-0} : { *(.rel.init) }
48 .rela.init ${RELOCATING-0} : { *(.rela.init) }
49 .rel.text ${RELOCATING-0} :
52 ${RELOCATING+*(.rel.text.*)}
53 ${RELOCATING+*(.rel.gnu.linkonce.t*)}
55 .rela.text ${RELOCATING-0} :
58 ${RELOCATING+*(.rela.text.*)}
59 ${RELOCATING+*(.rela.gnu.linkonce.t*)}
61 .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
62 .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
63 .rel.rodata ${RELOCATING-0} :
66 ${RELOCATING+*(.rel.rodata.*)}
67 ${RELOCATING+*(.rel.gnu.linkonce.r*)}
69 .rela.rodata ${RELOCATING-0} :
72 ${RELOCATING+*(.rela.rodata.*)}
73 ${RELOCATING+*(.rela.gnu.linkonce.r*)}
75 .rel.data ${RELOCATING-0} :
78 ${RELOCATING+*(.rel.data.*)}
79 ${RELOCATING+*(.rel.gnu.linkonce.d*)}
81 .rela.data ${RELOCATING-0} :
84 ${RELOCATING+*(.rela.data.*)}
85 ${RELOCATING+*(.rela.gnu.linkonce.d*)}
87 .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
88 .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
89 .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
90 .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
91 .rel.got ${RELOCATING-0} : { *(.rel.got) }
92 .rela.got ${RELOCATING-0} : { *(.rela.got) }
93 .rel.bss ${RELOCATING-0} : { *(.rel.bss) }
94 .rela.bss ${RELOCATING-0} : { *(.rela.bss) }
95 .rel.plt ${RELOCATING-0} : { *(.rel.plt) }
96 .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
98 /* Internal text space or external memory. */
99 .text ${RELOCATING-0} :
104 /* For data that needs to reside in the lower 64k of progmem. */
105 ${RELOCATING+ *(.progmem.gcc*)}
107 /* PR 13812: Placing the trampolines here gives a better chance
108 that they will be in range of the code that uses them. */
109 ${RELOCATING+. = ALIGN(2);}
110 ${CONSTRUCTING+ __trampolines_start = . ; }
111 /* The jump trampolines for the 16-bit limited relocs will reside here. */
113 ${RELOCATING+ *(.trampolines*)}
114 ${CONSTRUCTING+ __trampolines_end = . ; }
116 /* avr-libc expects these data to reside in lower 64K. */
117 ${RELOCATING+ *libprintf_flt.a:*(.progmem.data)}
118 ${RELOCATING+ *libc.a:*(.progmem.data)}
120 ${RELOCATING+ *(.progmem*)}
122 ${RELOCATING+. = ALIGN(2);}
124 /* For future tablejump instruction arrays for 3 byte pc devices.
125 We don't relax jump/call instructions within these sections. */
127 ${RELOCATING+ *(.jumptables*)}
129 /* For code that needs to reside in the lower 128k progmem. */
131 ${RELOCATING+ *(.lowtext*)}
133 ${CONSTRUCTING+ __ctors_start = . ; }
134 ${CONSTRUCTING+ *(.ctors) }
135 ${CONSTRUCTING+ __ctors_end = . ; }
136 ${CONSTRUCTING+ __dtors_start = . ; }
137 ${CONSTRUCTING+ *(.dtors) }
138 ${CONSTRUCTING+ __dtors_end = . ; }
139 KEEP(SORT(*)(.ctors))
140 KEEP(SORT(*)(.dtors))
142 /* From this point on, we don't bother about wether the insns are
143 below or above the 16 bits boundary. */
144 *(.init0) /* Start here after reset. */
148 *(.init2) /* Clear __zero_reg__, set up stack pointer. */
152 *(.init4) /* Initialize data and BSS. */
156 *(.init6) /* C++ constructors. */
162 *(.init9) /* Call main(). */
165 ${RELOCATING+. = ALIGN(2);}
166 ${RELOCATING+ *(.text.*)}
167 ${RELOCATING+. = ALIGN(2);}
168 *(.fini9) /* _exit() starts here. */
174 *(.fini6) /* C++ destructors. */
186 *(.fini0) /* Infinite loop after program termination. */
188 ${RELOCATING+ _etext = . ; }
189 } ${RELOCATING+ > text}
191 .data ${RELOCATING-0} :
193 ${RELOCATING+ PROVIDE (__data_start = .) ; }
195 ${RELOCATING+ *(.data*)}
196 *(.rodata) /* We need to include .rodata here if gcc is used */
197 ${RELOCATING+ *(.rodata*)} /* with -fdata-sections. */
199 ${RELOCATING+. = ALIGN(2);}
200 ${RELOCATING+ _edata = . ; }
201 ${RELOCATING+ PROVIDE (__data_end = .) ; }
202 } ${RELOCATING+ > data ${RELOCATING+AT> text}}
204 .bss ${RELOCATING+ ADDR(.data) + SIZEOF (.data)} ${RELOCATING-0} :${RELOCATING+ AT (ADDR (.bss))}
206 ${RELOCATING+ PROVIDE (__bss_start = .) ; }
208 ${RELOCATING+ *(.bss*)}
210 ${RELOCATING+ PROVIDE (__bss_end = .) ; }
211 } ${RELOCATING+ > data}
213 ${RELOCATING+ __data_load_start = LOADADDR(.data); }
214 ${RELOCATING+ __data_load_end = __data_load_start + SIZEOF(.data); }
216 /* Global data not cleared after reset. */
217 .noinit ${RELOCATING+ ADDR(.bss) + SIZEOF (.bss)} ${RELOCATING-0} : ${RELOCATING+ AT (ADDR (.noinit))}
219 ${RELOCATING+ PROVIDE (__noinit_start = .) ; }
221 ${RELOCATING+ PROVIDE (__noinit_end = .) ; }
222 ${RELOCATING+ _end = . ; }
223 ${RELOCATING+ PROVIDE (__heap_start = .) ; }
224 } ${RELOCATING+ > data}
226 .lock ${RELOCATING-0}:
229 } ${RELOCATING+ > lock}
231 .signature ${RELOCATING-0}:
234 } ${RELOCATING+ > signature}
236 .config ${RELOCATING-0}:
239 } ${RELOCATING+ > config}
241 /* Stabs debugging sections. */
242 .stab 0 : { *(.stab) }
243 .stabstr 0 : { *(.stabstr) }
244 .stab.excl 0 : { *(.stab.excl) }
245 .stab.exclstr 0 : { *(.stab.exclstr) }
246 .stab.index 0 : { *(.stab.index) }
247 .stab.indexstr 0 : { *(.stab.indexstr) }
248 .comment 0 : { *(.comment) }
249 .note.gnu.build-id : { *(.note.gnu.build-id) }
252 . $srcdir/scripttempl/DWARF.sc