1 # Copyright (C) 2014 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 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}")
19 text (rx) : ORIGIN = 0, LENGTH = $TEXT_LENGTH
20 data (rw!x) : ORIGIN = $DATA_ORIGIN, LENGTH = $DATA_LENGTH
21 eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K
22 fuse (rw!x) : ORIGIN = 0x820000, LENGTH = 1K
23 lock (rw!x) : ORIGIN = 0x830000, LENGTH = 1K
24 signature (rw!x) : ORIGIN = 0x840000, LENGTH = 1K
29 /* Read-only sections, merged into text segment: */
30 ${TEXT_DYNAMIC+${DYNAMIC}}
31 .hash ${RELOCATING-0} : { *(.hash) }
32 .dynsym ${RELOCATING-0} : { *(.dynsym) }
33 .dynstr ${RELOCATING-0} : { *(.dynstr) }
34 .gnu.version ${RELOCATING-0} : { *(.gnu.version) }
35 .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) }
36 .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) }
38 .rel.init ${RELOCATING-0} : { *(.rel.init) }
39 .rela.init ${RELOCATING-0} : { *(.rela.init) }
40 .rel.text ${RELOCATING-0} :
43 ${RELOCATING+*(.rel.text.*)}
44 ${RELOCATING+*(.rel.gnu.linkonce.t*)}
46 .rela.text ${RELOCATING-0} :
49 ${RELOCATING+*(.rela.text.*)}
50 ${RELOCATING+*(.rela.gnu.linkonce.t*)}
52 .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
53 .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
54 .rel.rodata ${RELOCATING-0} :
57 ${RELOCATING+*(.rel.rodata.*)}
58 ${RELOCATING+*(.rel.gnu.linkonce.r*)}
60 .rela.rodata ${RELOCATING-0} :
63 ${RELOCATING+*(.rela.rodata.*)}
64 ${RELOCATING+*(.rela.gnu.linkonce.r*)}
66 .rel.data ${RELOCATING-0} :
69 ${RELOCATING+*(.rel.data.*)}
70 ${RELOCATING+*(.rel.gnu.linkonce.d*)}
72 .rela.data ${RELOCATING-0} :
75 ${RELOCATING+*(.rela.data.*)}
76 ${RELOCATING+*(.rela.gnu.linkonce.d*)}
78 .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
79 .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
80 .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
81 .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
82 .rel.got ${RELOCATING-0} : { *(.rel.got) }
83 .rela.got ${RELOCATING-0} : { *(.rela.got) }
84 .rel.bss ${RELOCATING-0} : { *(.rel.bss) }
85 .rela.bss ${RELOCATING-0} : { *(.rela.bss) }
86 .rel.plt ${RELOCATING-0} : { *(.rel.plt) }
87 .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
89 /* Internal text space or external memory. */
90 .text ${RELOCATING-0} :
95 /* For data that needs to reside in the lower 64k of progmem. */
96 ${RELOCATING+ *(.progmem.gcc*)}
98 /* PR 13812: Placing the trampolines here gives a better chance
99 that they will be in range of the code that uses them. */
100 ${RELOCATING+. = ALIGN(2);}
101 ${CONSTRUCTING+ __trampolines_start = . ; }
102 /* The jump trampolines for the 16-bit limited relocs will reside here. */
104 ${RELOCATING+ *(.trampolines*)}
105 ${CONSTRUCTING+ __trampolines_end = . ; }
107 ${RELOCATING+ *(.progmem*)}
109 ${RELOCATING+. = ALIGN(2);}
111 /* For future tablejump instruction arrays for 3 byte pc devices.
112 We don't relax jump/call instructions within these sections. */
114 ${RELOCATING+ *(.jumptables*)}
116 /* For code that needs to reside in the lower 128k progmem. */
118 ${RELOCATING+ *(.lowtext*)}
120 ${CONSTRUCTING+ __ctors_start = . ; }
121 ${CONSTRUCTING+ *(.ctors) }
122 ${CONSTRUCTING+ __ctors_end = . ; }
123 ${CONSTRUCTING+ __dtors_start = . ; }
124 ${CONSTRUCTING+ *(.dtors) }
125 ${CONSTRUCTING+ __dtors_end = . ; }
126 KEEP(SORT(*)(.ctors))
127 KEEP(SORT(*)(.dtors))
129 /* From this point on, we don't bother about wether the insns are
130 below or above the 16 bits boundary. */
131 *(.init0) /* Start here after reset. */
135 *(.init2) /* Clear __zero_reg__, set up stack pointer. */
139 *(.init4) /* Initialize data and BSS. */
143 *(.init6) /* C++ constructors. */
149 *(.init9) /* Call main(). */
152 ${RELOCATING+. = ALIGN(2);}
153 ${RELOCATING+ *(.text.*)}
154 ${RELOCATING+. = ALIGN(2);}
155 *(.fini9) /* _exit() starts here. */
161 *(.fini6) /* C++ destructors. */
173 *(.fini0) /* Infinite loop after program termination. */
175 ${RELOCATING+ _etext = . ; }
176 } ${RELOCATING+ > text}
178 .data ${RELOCATING-0} :
180 ${RELOCATING+ PROVIDE (__data_start = .) ; }
182 ${RELOCATING+ *(.data*)}
183 *(.rodata) /* We need to include .rodata here if gcc is used */
184 ${RELOCATING+ *(.rodata*)} /* with -fdata-sections. */
186 ${RELOCATING+. = ALIGN(2);}
187 ${RELOCATING+ _edata = . ; }
188 ${RELOCATING+ PROVIDE (__data_end = .) ; }
189 } ${RELOCATING+ > data ${RELOCATING+AT> text}}
191 .bss ${RELOCATING+ ADDR(.data) + SIZEOF (.data)} ${RELOCATING-0} :${RELOCATING+ AT (ADDR (.bss))}
193 ${RELOCATING+ PROVIDE (__bss_start = .) ; }
195 ${RELOCATING+ *(.bss*)}
197 ${RELOCATING+ PROVIDE (__bss_end = .) ; }
198 } ${RELOCATING+ > data}
200 ${RELOCATING+ __data_load_start = LOADADDR(.data); }
201 ${RELOCATING+ __data_load_end = __data_load_start + SIZEOF(.data); }
203 /* Global data not cleared after reset. */
204 .noinit ${RELOCATING-0}:
206 ${RELOCATING+ PROVIDE (__noinit_start = .) ; }
208 ${RELOCATING+ PROVIDE (__noinit_end = .) ; }
209 ${RELOCATING+ _end = . ; }
210 ${RELOCATING+ PROVIDE (__heap_start = .) ; }
211 } ${RELOCATING+ > data}
213 .eeprom ${RELOCATING-0}:
215 /* See .data above... */
217 ${RELOCATING+ __eeprom_end = . ; }
218 } ${RELOCATING+ > eeprom}
220 .fuse ${RELOCATING-0}:
226 } ${RELOCATING+ > fuse}
228 .lock ${RELOCATING-0}:
231 } ${RELOCATING+ > lock}
233 .signature ${RELOCATING-0}:
236 } ${RELOCATING+ > signature}
238 /* Stabs debugging sections. */
239 .stab 0 : { *(.stab) }
240 .stabstr 0 : { *(.stabstr) }
241 .stab.excl 0 : { *(.stab.excl) }
242 .stab.exclstr 0 : { *(.stab.exclstr) }
243 .stab.index 0 : { *(.stab.index) }
244 .stab.indexstr 0 : { *(.stab.indexstr) }
245 .comment 0 : { *(.comment) }
246 .note.gnu.build-id : { *(.note.gnu.build-id) }
249 . $srcdir/scripttempl/DWARF.sc