1 # Copyright (C) 2014-2016 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-2016 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 __EEPROM_REGION_LENGTH__ = DEFINED(__EEPROM_REGION_LENGTH__) ? __EEPROM_REGION_LENGTH__ : 64K;
20 __FUSE_REGION_LENGTH__ = DEFINED(__FUSE_REGION_LENGTH__) ? __FUSE_REGION_LENGTH__ : 1K;
21 __LOCK_REGION_LENGTH__ = DEFINED(__LOCK_REGION_LENGTH__) ? __LOCK_REGION_LENGTH__ : 1K;
22 __SIGNATURE_REGION_LENGTH__ = DEFINED(__SIGNATURE_REGION_LENGTH__) ? __SIGNATURE_REGION_LENGTH__ : 1K;
23 __USER_SIGNATURE_REGION_LENGTH__ = DEFINED(__USER_SIGNATURE_REGION_LENGTH__) ? __USER_SIGNATURE_REGION_LENGTH__ : 1K;
27 text (rx) : ORIGIN = 0, LENGTH = __TEXT_REGION_LENGTH__
28 data (rw!x) : ORIGIN = $DATA_ORIGIN, LENGTH = __DATA_REGION_LENGTH__
29 eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = __EEPROM_REGION_LENGTH__
30 fuse (rw!x) : ORIGIN = 0x820000, LENGTH = __FUSE_REGION_LENGTH__
31 lock (rw!x) : ORIGIN = 0x830000, LENGTH = __LOCK_REGION_LENGTH__
32 signature (rw!x) : ORIGIN = 0x840000, LENGTH = __SIGNATURE_REGION_LENGTH__
33 user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = __USER_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 ${RELOCATING+ *(.progmem*)}
118 ${RELOCATING+. = ALIGN(2);}
120 /* For future tablejump instruction arrays for 3 byte pc devices.
121 We don't relax jump/call instructions within these sections. */
123 ${RELOCATING+ *(.jumptables*)}
125 /* For code that needs to reside in the lower 128k progmem. */
127 ${RELOCATING+ *(.lowtext*)}
129 ${CONSTRUCTING+ __ctors_start = . ; }
130 ${CONSTRUCTING+ *(.ctors) }
131 ${CONSTRUCTING+ __ctors_end = . ; }
132 ${CONSTRUCTING+ __dtors_start = . ; }
133 ${CONSTRUCTING+ *(.dtors) }
134 ${CONSTRUCTING+ __dtors_end = . ; }
135 KEEP(SORT(*)(.ctors))
136 KEEP(SORT(*)(.dtors))
138 /* From this point on, we don't bother about wether the insns are
139 below or above the 16 bits boundary. */
140 *(.init0) /* Start here after reset. */
144 *(.init2) /* Clear __zero_reg__, set up stack pointer. */
148 *(.init4) /* Initialize data and BSS. */
152 *(.init6) /* C++ constructors. */
158 *(.init9) /* Call main(). */
161 ${RELOCATING+. = ALIGN(2);}
162 ${RELOCATING+ *(.text.*)}
163 ${RELOCATING+. = ALIGN(2);}
164 *(.fini9) /* _exit() starts here. */
170 *(.fini6) /* C++ destructors. */
182 *(.fini0) /* Infinite loop after program termination. */
184 ${RELOCATING+ _etext = . ; }
185 } ${RELOCATING+ > text}
187 .data ${RELOCATING-0} :
189 ${RELOCATING+ PROVIDE (__data_start = .) ; }
191 ${RELOCATING+ *(.data*)}
192 *(.rodata) /* We need to include .rodata here if gcc is used */
193 ${RELOCATING+ *(.rodata*)} /* with -fdata-sections. */
195 ${RELOCATING+. = ALIGN(2);}
196 ${RELOCATING+ _edata = . ; }
197 ${RELOCATING+ PROVIDE (__data_end = .) ; }
198 } ${RELOCATING+ > data ${RELOCATING+AT> text}}
200 .bss ${RELOCATING+ ADDR(.data) + SIZEOF (.data)} ${RELOCATING-0} :${RELOCATING+ AT (ADDR (.bss))}
202 ${RELOCATING+ PROVIDE (__bss_start = .) ; }
204 ${RELOCATING+ *(.bss*)}
206 ${RELOCATING+ PROVIDE (__bss_end = .) ; }
207 } ${RELOCATING+ > data}
209 ${RELOCATING+ __data_load_start = LOADADDR(.data); }
210 ${RELOCATING+ __data_load_end = __data_load_start + SIZEOF(.data); }
212 /* Global data not cleared after reset. */
213 .noinit ${RELOCATING-0}:
215 ${RELOCATING+ PROVIDE (__noinit_start = .) ; }
217 ${RELOCATING+ PROVIDE (__noinit_end = .) ; }
218 ${RELOCATING+ _end = . ; }
219 ${RELOCATING+ PROVIDE (__heap_start = .) ; }
220 } ${RELOCATING+ > data}
222 .eeprom ${RELOCATING-0}:
224 /* See .data above... */
226 ${RELOCATING+ __eeprom_end = . ; }
227 } ${RELOCATING+ > eeprom}
229 .fuse ${RELOCATING-0}:
235 } ${RELOCATING+ > fuse}
237 .lock ${RELOCATING-0}:
240 } ${RELOCATING+ > lock}
242 .signature ${RELOCATING-0}:
245 } ${RELOCATING+ > signature}
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