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;
22 __RODATA_PM_OFFSET__ = DEFINED(__RODATA_PM_OFFSET__) ? __RODATA_PM_OFFSET__ : 0x4000;
26 text (rx) : ORIGIN = $TEXT_ORIGIN, LENGTH = __TEXT_REGION_LENGTH__
27 data (rw!x) : ORIGIN = $DATA_ORIGIN, LENGTH = __DATA_REGION_LENGTH__
29 /* Provide offsets for config, lock and signature to match
30 production file format. Ignore offsets in datasheet. */
32 config (rw!x) : ORIGIN = 0x820000, LENGTH = __FUSE_REGION_LENGTH__
33 lock (rw!x) : ORIGIN = 0x830000, LENGTH = __LOCK_REGION_LENGTH__
34 signature (rw!x) : ORIGIN = 0x840000, LENGTH = __SIGNATURE_REGION_LENGTH__
39 /* Read-only sections, merged into text segment: */
40 ${TEXT_DYNAMIC+${DYNAMIC}}
41 .hash ${RELOCATING-0} : { *(.hash) }
42 .dynsym ${RELOCATING-0} : { *(.dynsym) }
43 .dynstr ${RELOCATING-0} : { *(.dynstr) }
44 .gnu.version ${RELOCATING-0} : { *(.gnu.version) }
45 .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) }
46 .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) }
48 .rel.init ${RELOCATING-0} : { *(.rel.init) }
49 .rela.init ${RELOCATING-0} : { *(.rela.init) }
50 .rel.text ${RELOCATING-0} :
53 ${RELOCATING+*(.rel.text.*)}
54 ${RELOCATING+*(.rel.gnu.linkonce.t*)}
56 .rela.text ${RELOCATING-0} :
59 ${RELOCATING+*(.rela.text.*)}
60 ${RELOCATING+*(.rela.gnu.linkonce.t*)}
62 .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
63 .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
64 .rel.rodata ${RELOCATING-0} :
67 ${RELOCATING+*(.rel.rodata.*)}
68 ${RELOCATING+*(.rel.gnu.linkonce.r*)}
70 .rela.rodata ${RELOCATING-0} :
73 ${RELOCATING+*(.rela.rodata.*)}
74 ${RELOCATING+*(.rela.gnu.linkonce.r*)}
76 .rel.data ${RELOCATING-0} :
79 ${RELOCATING+*(.rel.data.*)}
80 ${RELOCATING+*(.rel.gnu.linkonce.d*)}
82 .rela.data ${RELOCATING-0} :
85 ${RELOCATING+*(.rela.data.*)}
86 ${RELOCATING+*(.rela.gnu.linkonce.d*)}
88 .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
89 .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
90 .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
91 .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
92 .rel.got ${RELOCATING-0} : { *(.rel.got) }
93 .rela.got ${RELOCATING-0} : { *(.rela.got) }
94 .rel.bss ${RELOCATING-0} : { *(.rel.bss) }
95 .rela.bss ${RELOCATING-0} : { *(.rela.bss) }
96 .rel.plt ${RELOCATING-0} : { *(.rel.plt) }
97 .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
99 /* Internal text space or external memory. */
100 .text ${RELOCATING-0} :
105 /* For data that needs to reside in the lower 64k of progmem. */
106 ${RELOCATING+ *(.progmem.gcc*)}
108 /* PR 13812: Placing the trampolines here gives a better chance
109 that they will be in range of the code that uses them. */
110 ${RELOCATING+. = ALIGN(2);}
111 ${CONSTRUCTING+ __trampolines_start = . ; }
112 /* The jump trampolines for the 16-bit limited relocs will reside here. */
114 ${RELOCATING+ *(.trampolines*)}
115 ${CONSTRUCTING+ __trampolines_end = . ; }
117 /* avr-libc expects these data to reside in lower 64K. */
118 ${RELOCATING+ *libprintf_flt.a:*(.progmem.data)}
119 ${RELOCATING+ *libc.a:*(.progmem.data)}
121 ${RELOCATING+ *(.progmem*)}
123 ${RELOCATING+. = ALIGN(2);}
125 /* For future tablejump instruction arrays for 3 byte pc devices.
126 We don't relax jump/call instructions within these sections. */
128 ${RELOCATING+ *(.jumptables*)}
130 /* For code that needs to reside in the lower 128k progmem. */
132 ${RELOCATING+ *(.lowtext*)}
134 ${CONSTRUCTING+ __ctors_start = . ; }
135 ${CONSTRUCTING+ *(.ctors) }
136 ${CONSTRUCTING+ __ctors_end = . ; }
137 ${CONSTRUCTING+ __dtors_start = . ; }
138 ${CONSTRUCTING+ *(.dtors) }
139 ${CONSTRUCTING+ __dtors_end = . ; }
140 KEEP(SORT(*)(.ctors))
141 KEEP(SORT(*)(.dtors))
143 /* From this point on, we don't bother about wether the insns are
144 below or above the 16 bits boundary. */
145 *(.init0) /* Start here after reset. */
149 *(.init2) /* Clear __zero_reg__, set up stack pointer. */
153 *(.init4) /* Initialize data and BSS. */
157 *(.init6) /* C++ constructors. */
163 *(.init9) /* Call main(). */
166 ${RELOCATING+. = ALIGN(2);}
167 ${RELOCATING+ *(.text.*)}
168 ${RELOCATING+. = ALIGN(2);}
169 *(.fini9) /* _exit() starts here. */
175 *(.fini6) /* C++ destructors. */
187 *(.fini0) /* Infinite loop after program termination. */
189 ${RELOCATING+ _etext = . ; }
190 } ${RELOCATING+ > text}
192 .rodata ${RELOCATING+ ADDR(.text) + SIZEOF (.text) + __RODATA_PM_OFFSET__ } ${RELOCATING-0} :
195 ${RELOCATING+ *(.rodata*)}
197 } ${RELOCATING+AT> text}
199 .data ${RELOCATING-0} :
201 ${RELOCATING+ PROVIDE (__data_start = .) ; }
203 ${RELOCATING+ *(.data*)}
205 ${RELOCATING+. = ALIGN(2);}
206 ${RELOCATING+ _edata = . ; }
207 ${RELOCATING+ PROVIDE (__data_end = .) ; }
208 } ${RELOCATING+ > data ${RELOCATING+AT> text}}
210 .bss ${RELOCATING+ ADDR(.data) + SIZEOF (.data)} ${RELOCATING-0} :${RELOCATING+ AT (ADDR (.bss))}
212 ${RELOCATING+ PROVIDE (__bss_start = .) ; }
214 ${RELOCATING+ *(.bss*)}
216 ${RELOCATING+ PROVIDE (__bss_end = .) ; }
217 } ${RELOCATING+ > data}
219 ${RELOCATING+ __data_load_start = LOADADDR(.data); }
220 ${RELOCATING+ __data_load_end = __data_load_start + SIZEOF(.data); }
222 /* Global data not cleared after reset. */
223 .noinit ${RELOCATING+ ADDR(.bss) + SIZEOF (.bss)} ${RELOCATING-0} : ${RELOCATING+ AT (ADDR (.noinit))}
225 ${RELOCATING+ PROVIDE (__noinit_start = .) ; }
227 ${RELOCATING+ PROVIDE (__noinit_end = .) ; }
228 ${RELOCATING+ _end = . ; }
229 ${RELOCATING+ PROVIDE (__heap_start = .) ; }
230 } ${RELOCATING+ > data}
232 .lock ${RELOCATING-0}:
235 } ${RELOCATING+ > lock}
237 .signature ${RELOCATING-0}:
240 } ${RELOCATING+ > signature}
242 .config ${RELOCATING-0}:
245 } ${RELOCATING+ > config}
247 /* Stabs debugging sections. */
248 .stab 0 : { *(.stab) }
249 .stabstr 0 : { *(.stabstr) }
250 .stab.excl 0 : { *(.stab.excl) }
251 .stab.exclstr 0 : { *(.stab.exclstr) }
252 .stab.index 0 : { *(.stab.index) }
253 .stab.indexstr 0 : { *(.stab.indexstr) }
254 .comment 0 : { *(.comment) }
255 .note.gnu.build-id : { *(.note.gnu.build-id) }
258 . $srcdir/scripttempl/DWARF.sc