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") |
---|
7 | OUTPUT_ARCH(avr:5) |
---|
8 | __TEXT_REGION_LENGTH__ = DEFINED(__TEXT_REGION_LENGTH__) ? __TEXT_REGION_LENGTH__ : 128K; |
---|
9 | __DATA_REGION_LENGTH__ = DEFINED(__DATA_REGION_LENGTH__) ? __DATA_REGION_LENGTH__ : 0xffa0; |
---|
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; |
---|
15 | MEMORY |
---|
16 | { |
---|
17 | text (rx) : ORIGIN = 0, LENGTH = __TEXT_REGION_LENGTH__ |
---|
18 | data (rw!x) : ORIGIN = 0x800060, 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__ |
---|
24 | } |
---|
25 | SECTIONS |
---|
26 | { |
---|
27 | /* Read-only sections, merged into text segment: */ |
---|
28 | .hash : { *(.hash) } |
---|
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) } |
---|
36 | .rel.text : |
---|
37 | { |
---|
38 | *(.rel.text) |
---|
39 | *(.rel.text.*) |
---|
40 | *(.rel.gnu.linkonce.t*) |
---|
41 | } |
---|
42 | .rela.text : |
---|
43 | { |
---|
44 | *(.rela.text) |
---|
45 | *(.rela.text.*) |
---|
46 | *(.rela.gnu.linkonce.t*) |
---|
47 | } |
---|
48 | .rel.fini : { *(.rel.fini) } |
---|
49 | .rela.fini : { *(.rela.fini) } |
---|
50 | .rel.rodata : |
---|
51 | { |
---|
52 | *(.rel.rodata) |
---|
53 | *(.rel.rodata.*) |
---|
54 | *(.rel.gnu.linkonce.r*) |
---|
55 | } |
---|
56 | .rela.rodata : |
---|
57 | { |
---|
58 | *(.rela.rodata) |
---|
59 | *(.rela.rodata.*) |
---|
60 | *(.rela.gnu.linkonce.r*) |
---|
61 | } |
---|
62 | .rel.data : |
---|
63 | { |
---|
64 | *(.rel.data) |
---|
65 | *(.rel.data.*) |
---|
66 | *(.rel.gnu.linkonce.d*) |
---|
67 | } |
---|
68 | .rela.data : |
---|
69 | { |
---|
70 | *(.rela.data) |
---|
71 | *(.rela.data.*) |
---|
72 | *(.rela.gnu.linkonce.d*) |
---|
73 | } |
---|
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. */ |
---|
85 | .text : |
---|
86 | { |
---|
87 | *(.vectors) |
---|
88 | KEEP(*(.vectors)) |
---|
89 | /* For data that needs to reside in the lower 64k of progmem. */ |
---|
90 | *(.progmem.gcc*) |
---|
91 | /* PR 13812: Placing the trampolines here gives a better chance |
---|
92 | that they will be in range of the code that uses them. */ |
---|
93 | . = ALIGN(2); |
---|
94 | __trampolines_start = . ; |
---|
95 | /* The jump trampolines for the 16-bit limited relocs will reside here. */ |
---|
96 | *(.trampolines) |
---|
97 | *(.trampolines*) |
---|
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) |
---|
102 | *(.progmem*) |
---|
103 | . = ALIGN(2); |
---|
104 | /* For future tablejump instruction arrays for 3 byte pc devices. |
---|
105 | We don't relax jump/call instructions within these sections. */ |
---|
106 | *(.jumptables) |
---|
107 | *(.jumptables*) |
---|
108 | /* For code that needs to reside in the lower 128k progmem. */ |
---|
109 | *(.lowtext) |
---|
110 | *(.lowtext*) |
---|
111 | __ctors_start = . ; |
---|
112 | *(.ctors) |
---|
113 | __ctors_end = . ; |
---|
114 | __dtors_start = . ; |
---|
115 | *(.dtors) |
---|
116 | __dtors_end = . ; |
---|
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. */ |
---|
122 | KEEP (*(.init0)) |
---|
123 | *(.init1) |
---|
124 | KEEP (*(.init1)) |
---|
125 | *(.init2) /* Clear __zero_reg__, set up stack pointer. */ |
---|
126 | KEEP (*(.init2)) |
---|
127 | *(.init3) |
---|
128 | KEEP (*(.init3)) |
---|
129 | *(.init4) /* Initialize data and BSS. */ |
---|
130 | KEEP (*(.init4)) |
---|
131 | *(.init5) |
---|
132 | KEEP (*(.init5)) |
---|
133 | *(.init6) /* C++ constructors. */ |
---|
134 | KEEP (*(.init6)) |
---|
135 | *(.init7) |
---|
136 | KEEP (*(.init7)) |
---|
137 | *(.init8) |
---|
138 | KEEP (*(.init8)) |
---|
139 | *(.init9) /* Call main(). */ |
---|
140 | KEEP (*(.init9)) |
---|
141 | *(.text) |
---|
142 | . = ALIGN(2); |
---|
143 | *(.text.*) |
---|
144 | . = ALIGN(2); |
---|
145 | *(.fini9) /* _exit() starts here. */ |
---|
146 | KEEP (*(.fini9)) |
---|
147 | *(.fini8) |
---|
148 | KEEP (*(.fini8)) |
---|
149 | *(.fini7) |
---|
150 | KEEP (*(.fini7)) |
---|
151 | *(.fini6) /* C++ destructors. */ |
---|
152 | KEEP (*(.fini6)) |
---|
153 | *(.fini5) |
---|
154 | KEEP (*(.fini5)) |
---|
155 | *(.fini4) |
---|
156 | KEEP (*(.fini4)) |
---|
157 | *(.fini3) |
---|
158 | KEEP (*(.fini3)) |
---|
159 | *(.fini2) |
---|
160 | KEEP (*(.fini2)) |
---|
161 | *(.fini1) |
---|
162 | KEEP (*(.fini1)) |
---|
163 | *(.fini0) /* Infinite loop after program termination. */ |
---|
164 | KEEP (*(.fini0)) |
---|
165 | _etext = . ; |
---|
166 | } > text |
---|
167 | .data : |
---|
168 | { |
---|
169 | PROVIDE (__data_start = .) ; |
---|
170 | *(.data) |
---|
171 | *(.data*) |
---|
172 | *(.rodata) /* We need to include .rodata here if gcc is used */ |
---|
173 | *(.rodata*) /* with -fdata-sections. */ |
---|
174 | *(.gnu.linkonce.d*) |
---|
175 | . = ALIGN(2); |
---|
176 | _edata = . ; |
---|
177 | PROVIDE (__data_end = .) ; |
---|
178 | } > data AT> text |
---|
179 | .bss ADDR(.data) + SIZEOF (.data) : AT (ADDR (.bss)) |
---|
180 | { |
---|
181 | PROVIDE (__bss_start = .) ; |
---|
182 | *(.bss) |
---|
183 | *(.bss*) |
---|
184 | *(COMMON) |
---|
185 | PROVIDE (__bss_end = .) ; |
---|
186 | } > data |
---|
187 | __data_load_start = LOADADDR(.data); |
---|
188 | __data_load_end = __data_load_start + SIZEOF(.data); |
---|
189 | /* Global data not cleared after reset. */ |
---|
190 | .noinit ADDR(.bss) + SIZEOF (.bss) : AT (ADDR (.noinit)) |
---|
191 | { |
---|
192 | PROVIDE (__noinit_start = .) ; |
---|
193 | *(.noinit*) |
---|
194 | PROVIDE (__noinit_end = .) ; |
---|
195 | _end = . ; |
---|
196 | PROVIDE (__heap_start = .) ; |
---|
197 | } > data |
---|
198 | .eeprom : |
---|
199 | { |
---|
200 | /* See .data above... */ |
---|
201 | KEEP(*(.eeprom*)) |
---|
202 | __eeprom_end = . ; |
---|
203 | } > eeprom |
---|
204 | .fuse : |
---|
205 | { |
---|
206 | KEEP(*(.fuse)) |
---|
207 | KEEP(*(.lfuse)) |
---|
208 | KEEP(*(.hfuse)) |
---|
209 | KEEP(*(.efuse)) |
---|
210 | } > fuse |
---|
211 | .lock : |
---|
212 | { |
---|
213 | KEEP(*(.lock*)) |
---|
214 | } > lock |
---|
215 | .signature : |
---|
216 | { |
---|
217 | KEEP(*(.signature*)) |
---|
218 | } > signature |
---|
219 | .user_signatures : |
---|
220 | { |
---|
221 | KEEP(*(.user_signatures*)) |
---|
222 | } > user_signatures |
---|
223 | /* Stabs debugging sections. */ |
---|
224 | .stab 0 : { *(.stab) } |
---|
225 | .stabstr 0 : { *(.stabstr) } |
---|
226 | .stab.excl 0 : { *(.stab.excl) } |
---|
227 | .stab.exclstr 0 : { *(.stab.exclstr) } |
---|
228 | .stab.index 0 : { *(.stab.index) } |
---|
229 | .stab.indexstr 0 : { *(.stab.indexstr) } |
---|
230 | .comment 0 : { *(.comment) } |
---|
231 | .note.gnu.build-id : { *(.note.gnu.build-id) } |
---|
232 | /* DWARF debug sections. |
---|
233 | Symbols in the DWARF debugging sections are relative to the beginning |
---|
234 | of the section so we begin them at 0. */ |
---|
235 | /* DWARF 1 */ |
---|
236 | .debug 0 : { *(.debug) } |
---|
237 | .line 0 : { *(.line) } |
---|
238 | /* GNU DWARF 1 extensions */ |
---|
239 | .debug_srcinfo 0 : { *(.debug_srcinfo) } |
---|
240 | .debug_sfnames 0 : { *(.debug_sfnames) } |
---|
241 | /* DWARF 1.1 and DWARF 2 */ |
---|
242 | .debug_aranges 0 : { *(.debug_aranges) } |
---|
243 | .debug_pubnames 0 : { *(.debug_pubnames) } |
---|
244 | /* DWARF 2 */ |
---|
245 | .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } |
---|
246 | .debug_abbrev 0 : { *(.debug_abbrev) } |
---|
247 | .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) } |
---|
248 | .debug_frame 0 : { *(.debug_frame) } |
---|
249 | .debug_str 0 : { *(.debug_str) } |
---|
250 | .debug_loc 0 : { *(.debug_loc) } |
---|
251 | .debug_macinfo 0 : { *(.debug_macinfo) } |
---|
252 | /* SGI/MIPS DWARF 2 extensions */ |
---|
253 | .debug_weaknames 0 : { *(.debug_weaknames) } |
---|
254 | .debug_funcnames 0 : { *(.debug_funcnames) } |
---|
255 | .debug_typenames 0 : { *(.debug_typenames) } |
---|
256 | .debug_varnames 0 : { *(.debug_varnames) } |
---|
257 | /* DWARF 3 */ |
---|
258 | .debug_pubtypes 0 : { *(.debug_pubtypes) } |
---|
259 | .debug_ranges 0 : { *(.debug_ranges) } |
---|
260 | /* DWARF Extension. */ |
---|
261 | .debug_macro 0 : { *(.debug_macro) } |
---|
262 | } |
---|