1 /* Default linker script, for normal executables */
2 /* Copyright (C) 2014-2015 Free Software Foundation, Inc.
3 Copying and distribution of this script, with or without modification,
4 are permitted in any medium without royalty provided the copyright
5 notice and this notice are preserved. */
6 OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr")
8 __TEXT_REGION_LENGTH__ = DEFINED(__TEXT_REGION_LENGTH__) ? __TEXT_REGION_LENGTH__ : 128K;
9 __DATA_REGION_LENGTH__ = DEFINED(__DATA_REGION_LENGTH__) ? __DATA_REGION_LENGTH__ : 0xff00;
10 __EEPROM_REGION_LENGTH__ = DEFINED(__EEPROM_REGION_LENGTH__) ? __EEPROM_REGION_LENGTH__ : 64K;
11 __FUSE_REGION_LENGTH__ = DEFINED(__FUSE_REGION_LENGTH__) ? __FUSE_REGION_LENGTH__ : 1K;
12 __LOCK_REGION_LENGTH__ = DEFINED(__LOCK_REGION_LENGTH__) ? __LOCK_REGION_LENGTH__ : 1K;
13 __SIGNATURE_REGION_LENGTH__ = DEFINED(__SIGNATURE_REGION_LENGTH__) ? __SIGNATURE_REGION_LENGTH__ : 1K;
14 __USER_SIGNATURE_REGION_LENGTH__ = DEFINED(__USER_SIGNATURE_REGION_LENGTH__) ? __USER_SIGNATURE_REGION_LENGTH__ : 1K;
17 text (rx) : ORIGIN = 0, LENGTH = __TEXT_REGION_LENGTH__
18 data (rw!x) : ORIGIN = 0x800100, LENGTH = __DATA_REGION_LENGTH__
19 eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = __EEPROM_REGION_LENGTH__
20 fuse (rw!x) : ORIGIN = 0x820000, LENGTH = __FUSE_REGION_LENGTH__
21 lock (rw!x) : ORIGIN = 0x830000, LENGTH = __LOCK_REGION_LENGTH__
22 signature (rw!x) : ORIGIN = 0x840000, LENGTH = __SIGNATURE_REGION_LENGTH__
23 user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = __USER_SIGNATURE_REGION_LENGTH__
27 /* Read-only sections, merged into text segment: */
29 .dynsym : { *(.dynsym) }
30 .dynstr : { *(.dynstr) }
31 .gnu.version : { *(.gnu.version) }
32 .gnu.version_d : { *(.gnu.version_d) }
33 .gnu.version_r : { *(.gnu.version_r) }
34 .rel.init : { *(.rel.init) }
35 .rela.init : { *(.rela.init) }
40 *(.rel.gnu.linkonce.t*)
46 *(.rela.gnu.linkonce.t*)
48 .rel.fini : { *(.rel.fini) }
49 .rela.fini : { *(.rela.fini) }
54 *(.rel.gnu.linkonce.r*)
60 *(.rela.gnu.linkonce.r*)
66 *(.rel.gnu.linkonce.d*)
72 *(.rela.gnu.linkonce.d*)
74 .rel.ctors : { *(.rel.ctors) }
75 .rela.ctors : { *(.rela.ctors) }
76 .rel.dtors : { *(.rel.dtors) }
77 .rela.dtors : { *(.rela.dtors) }
78 .rel.got : { *(.rel.got) }
79 .rela.got : { *(.rela.got) }
80 .rel.bss : { *(.rel.bss) }
81 .rela.bss : { *(.rela.bss) }
82 .rel.plt : { *(.rel.plt) }
83 .rela.plt : { *(.rela.plt) }
84 /* Internal text space or external memory. */
89 /* For data that needs to reside in the lower 64k of progmem. */
91 /* PR 13812: Placing the trampolines here gives a better chance
92 that they will be in range of the code that uses them. */
94 __trampolines_start = . ;
95 /* The jump trampolines for the 16-bit limited relocs will reside here. */
98 __trampolines_end = . ;
99 /* avr-libc expects these data to reside in lower 64K. */
100 *libprintf_flt.a:*(.progmem.data)
101 *libc.a:*(.progmem.data)
104 /* For future tablejump instruction arrays for 3 byte pc devices.
105 We don't relax jump/call instructions within these sections. */
108 /* For code that needs to reside in the lower 128k progmem. */
117 KEEP(SORT(*)(.ctors))
118 KEEP(SORT(*)(.dtors))
119 /* From this point on, we don't bother about wether the insns are
120 below or above the 16 bits boundary. */
121 *(.init0) /* Start here after reset. */
125 *(.init2) /* Clear __zero_reg__, set up stack pointer. */
129 *(.init4) /* Initialize data and BSS. */
133 *(.init6) /* C++ constructors. */
139 *(.init9) /* Call main(). */
145 *(.fini9) /* _exit() starts here. */
151 *(.fini6) /* C++ destructors. */
163 *(.fini0) /* Infinite loop after program termination. */
169 PROVIDE (__data_start = .) ;
173 *(.rodata) /* We need to include .rodata here if gcc is used */
174 *(.rodata*) /* with -fdata-sections. */
178 PROVIDE (__data_end = .) ;
180 .bss ADDR(.data) + SIZEOF (.data) : AT (ADDR (.bss))
182 PROVIDE (__bss_start = .) ;
186 PROVIDE (__bss_end = .) ;
188 __data_load_start = LOADADDR(.data);
189 __data_load_end = __data_load_start + SIZEOF(.data);
190 /* Global data not cleared after reset. */
191 .noinit ADDR(.bss) + SIZEOF (.bss) : AT (ADDR (.noinit))
193 PROVIDE (__noinit_start = .) ;
195 PROVIDE (__noinit_end = .) ;
197 PROVIDE (__heap_start = .) ;
201 /* See .data above... */
222 KEEP(*(.user_signatures*))
224 /* Stabs debugging sections. */
225 .stab 0 : { *(.stab) }
226 .stabstr 0 : { *(.stabstr) }
227 .stab.excl 0 : { *(.stab.excl) }
228 .stab.exclstr 0 : { *(.stab.exclstr) }
229 .stab.index 0 : { *(.stab.index) }
230 .stab.indexstr 0 : { *(.stab.indexstr) }
231 .comment 0 : { *(.comment) }
232 .note.gnu.build-id : { *(.note.gnu.build-id) }
233 /* DWARF debug sections.
234 Symbols in the DWARF debugging sections are relative to the beginning
235 of the section so we begin them at 0. */
237 .debug 0 : { *(.debug) }
238 .line 0 : { *(.line) }
239 /* GNU DWARF 1 extensions */
240 .debug_srcinfo 0 : { *(.debug_srcinfo) }
241 .debug_sfnames 0 : { *(.debug_sfnames) }
242 /* DWARF 1.1 and DWARF 2 */
243 .debug_aranges 0 : { *(.debug_aranges) }
244 .debug_pubnames 0 : { *(.debug_pubnames) }
246 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
247 .debug_abbrev 0 : { *(.debug_abbrev) }
248 .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
249 .debug_frame 0 : { *(.debug_frame) }
250 .debug_str 0 : { *(.debug_str) }
251 .debug_loc 0 : { *(.debug_loc) }
252 .debug_macinfo 0 : { *(.debug_macinfo) }
253 /* SGI/MIPS DWARF 2 extensions */
254 .debug_weaknames 0 : { *(.debug_weaknames) }
255 .debug_funcnames 0 : { *(.debug_funcnames) }
256 .debug_typenames 0 : { *(.debug_typenames) }
257 .debug_varnames 0 : { *(.debug_varnames) }
259 .debug_pubtypes 0 : { *(.debug_pubtypes) }
260 .debug_ranges 0 : { *(.debug_ranges) }
261 /* DWARF Extension. */
262 .debug_macro 0 : { *(.debug_macro) }