Commit | Line | Data |
---|---|---|
7c8bf1e8 MM |
1 | cat <<EOF |
2 | OUTPUT_FORMAT("${OUTPUT_FORMAT}","${OUTPUT_FORMAT}","${OUTPUT_FORMAT}") | |
3 | OUTPUT_ARCH(${ARCH}) | |
4 | ||
5 | MEMORY | |
6 | { | |
7 | text (rx) : ORIGIN = 0, LENGTH = $TEXT_LENGTH | |
84f1b567 | 8 | data (rw!x) : ORIGIN = $DATA_ORIGIN, LENGTH = $DATA_LENGTH |
7c8bf1e8 | 9 | eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K |
ef844a53 EW |
10 | fuse (rw!x) : ORIGIN = 0x820000, LENGTH = 1K |
11 | lock (rw!x) : ORIGIN = 0x830000, LENGTH = 1K | |
12 | signature (rw!x) : ORIGIN = 0x840000, LENGTH = 1K | |
7c8bf1e8 MM |
13 | } |
14 | ||
15 | SECTIONS | |
16 | { | |
17 | /* Read-only sections, merged into text segment: */ | |
18 | ${TEXT_DYNAMIC+${DYNAMIC}} | |
ec2d9b29 AM |
19 | .hash ${RELOCATING-0} : { *(.hash) } |
20 | .dynsym ${RELOCATING-0} : { *(.dynsym) } | |
21 | .dynstr ${RELOCATING-0} : { *(.dynstr) } | |
22 | .gnu.version ${RELOCATING-0} : { *(.gnu.version) } | |
23 | .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) } | |
24 | .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) } | |
25 | ||
26 | .rel.init ${RELOCATING-0} : { *(.rel.init) } | |
27 | .rela.init ${RELOCATING-0} : { *(.rela.init) } | |
28 | .rel.text ${RELOCATING-0} : | |
7c8bf1e8 MM |
29 | { |
30 | *(.rel.text) | |
31 | ${RELOCATING+*(.rel.text.*)} | |
32 | ${RELOCATING+*(.rel.gnu.linkonce.t*)} | |
33 | } | |
ec2d9b29 | 34 | .rela.text ${RELOCATING-0} : |
7c8bf1e8 MM |
35 | { |
36 | *(.rela.text) | |
37 | ${RELOCATING+*(.rela.text.*)} | |
38 | ${RELOCATING+*(.rela.gnu.linkonce.t*)} | |
39 | } | |
ec2d9b29 AM |
40 | .rel.fini ${RELOCATING-0} : { *(.rel.fini) } |
41 | .rela.fini ${RELOCATING-0} : { *(.rela.fini) } | |
42 | .rel.rodata ${RELOCATING-0} : | |
7c8bf1e8 MM |
43 | { |
44 | *(.rel.rodata) | |
45 | ${RELOCATING+*(.rel.rodata.*)} | |
46 | ${RELOCATING+*(.rel.gnu.linkonce.r*)} | |
47 | } | |
ec2d9b29 | 48 | .rela.rodata ${RELOCATING-0} : |
7c8bf1e8 MM |
49 | { |
50 | *(.rela.rodata) | |
51 | ${RELOCATING+*(.rela.rodata.*)} | |
52 | ${RELOCATING+*(.rela.gnu.linkonce.r*)} | |
53 | } | |
ec2d9b29 | 54 | .rel.data ${RELOCATING-0} : |
7c8bf1e8 MM |
55 | { |
56 | *(.rel.data) | |
57 | ${RELOCATING+*(.rel.data.*)} | |
58 | ${RELOCATING+*(.rel.gnu.linkonce.d*)} | |
59 | } | |
ec2d9b29 | 60 | .rela.data ${RELOCATING-0} : |
7c8bf1e8 MM |
61 | { |
62 | *(.rela.data) | |
63 | ${RELOCATING+*(.rela.data.*)} | |
64 | ${RELOCATING+*(.rela.gnu.linkonce.d*)} | |
65 | } | |
ec2d9b29 AM |
66 | .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) } |
67 | .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } | |
68 | .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) } | |
69 | .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } | |
70 | .rel.got ${RELOCATING-0} : { *(.rel.got) } | |
71 | .rela.got ${RELOCATING-0} : { *(.rela.got) } | |
72 | .rel.bss ${RELOCATING-0} : { *(.rel.bss) } | |
73 | .rela.bss ${RELOCATING-0} : { *(.rela.bss) } | |
74 | .rel.plt ${RELOCATING-0} : { *(.rel.plt) } | |
75 | .rela.plt ${RELOCATING-0} : { *(.rela.plt) } | |
7c8bf1e8 | 76 | |
28c9d252 | 77 | /* Internal text space or external memory. */ |
ec2d9b29 | 78 | .text ${RELOCATING-0} : |
7c8bf1e8 | 79 | { |
0c9b4fee | 80 | *(.vectors) |
df406460 | 81 | KEEP(*(.vectors)) |
0c9b4fee | 82 | |
28c9d252 NC |
83 | /* For data that needs to reside in the lower 64k of progmem. */ |
84 | *(.progmem.gcc*) | |
85 | *(.progmem*) | |
86 | ${RELOCATING+. = ALIGN(2);} | |
87 | ||
88 | ${CONSTRUCTING+ __trampolines_start = . ; } | |
89 | /* The jump trampolines for the 16-bit limited relocs will reside here. */ | |
90 | *(.trampolines) | |
91 | *(.trampolines*) | |
92 | ${CONSTRUCTING+ __trampolines_end = . ; } | |
93 | ||
94 | /* For future tablejump instruction arrays for 3 byte pc devices. | |
95 | We don't relax jump/call instructions within these sections. */ | |
96 | *(.jumptables) | |
97 | *(.jumptables*) | |
98 | ||
99 | /* For code that needs to reside in the lower 128k progmem. */ | |
100 | *(.lowtext) | |
101 | *(.lowtext*) | |
102 | ||
0c9b4fee MM |
103 | ${CONSTRUCTING+ __ctors_start = . ; } |
104 | ${CONSTRUCTING+ *(.ctors) } | |
105 | ${CONSTRUCTING+ __ctors_end = . ; } | |
106 | ${CONSTRUCTING+ __dtors_start = . ; } | |
107 | ${CONSTRUCTING+ *(.dtors) } | |
108 | ${CONSTRUCTING+ __dtors_end = . ; } | |
df406460 NC |
109 | KEEP(SORT(*)(.ctors)) |
110 | KEEP(SORT(*)(.dtors)) | |
0c9b4fee | 111 | |
28c9d252 NC |
112 | /* From this point on, we don't bother about wether the insns are |
113 | below or above the 16 bits boundary. */ | |
0c9b4fee | 114 | *(.init0) /* Start here after reset. */ |
df406460 | 115 | KEEP (*(.init0)) |
0c9b4fee | 116 | *(.init1) |
df406460 | 117 | KEEP (*(.init1)) |
0c9b4fee | 118 | *(.init2) /* Clear __zero_reg__, set up stack pointer. */ |
df406460 | 119 | KEEP (*(.init2)) |
0c9b4fee | 120 | *(.init3) |
df406460 | 121 | KEEP (*(.init3)) |
0c9b4fee | 122 | *(.init4) /* Initialize data and BSS. */ |
df406460 | 123 | KEEP (*(.init4)) |
0c9b4fee | 124 | *(.init5) |
df406460 | 125 | KEEP (*(.init5)) |
0c9b4fee | 126 | *(.init6) /* C++ constructors. */ |
df406460 | 127 | KEEP (*(.init6)) |
0c9b4fee | 128 | *(.init7) |
df406460 | 129 | KEEP (*(.init7)) |
0c9b4fee | 130 | *(.init8) |
df406460 | 131 | KEEP (*(.init8)) |
0c9b4fee | 132 | *(.init9) /* Call main(). */ |
df406460 | 133 | KEEP (*(.init9)) |
7c8bf1e8 MM |
134 | *(.text) |
135 | ${RELOCATING+. = ALIGN(2);} | |
136 | *(.text.*) | |
137 | ${RELOCATING+. = ALIGN(2);} | |
0c9b4fee | 138 | *(.fini9) /* _exit() starts here. */ |
df406460 | 139 | KEEP (*(.fini9)) |
0c9b4fee | 140 | *(.fini8) |
df406460 | 141 | KEEP (*(.fini8)) |
0c9b4fee | 142 | *(.fini7) |
df406460 | 143 | KEEP (*(.fini7)) |
0c9b4fee | 144 | *(.fini6) /* C++ destructors. */ |
df406460 | 145 | KEEP (*(.fini6)) |
0c9b4fee | 146 | *(.fini5) |
df406460 | 147 | KEEP (*(.fini5)) |
0c9b4fee | 148 | *(.fini4) |
df406460 | 149 | KEEP (*(.fini4)) |
0c9b4fee | 150 | *(.fini3) |
df406460 | 151 | KEEP (*(.fini3)) |
0c9b4fee | 152 | *(.fini2) |
df406460 | 153 | KEEP (*(.fini2)) |
0c9b4fee | 154 | *(.fini1) |
df406460 | 155 | KEEP (*(.fini1)) |
0c9b4fee | 156 | *(.fini0) /* Infinite loop after program termination. */ |
df406460 | 157 | KEEP (*(.fini0)) |
7c8bf1e8 MM |
158 | ${RELOCATING+ _etext = . ; } |
159 | } ${RELOCATING+ > text} | |
160 | ||
ec2d9b29 | 161 | .data ${RELOCATING-0} : ${RELOCATING+AT (ADDR (.text) + SIZEOF (.text))} |
7c8bf1e8 MM |
162 | { |
163 | ${RELOCATING+ PROVIDE (__data_start = .) ; } | |
fef632e1 NC |
164 | /* --gc-sections will delete empty .data. This leads to wrong start |
165 | addresses for subsequent sections because -Tdata= from the command | |
166 | line will have no effect, see PR13697. Thus, keep .data */ | |
167 | KEEP (*(.data)) | |
df406460 NC |
168 | *(.data*) |
169 | *(.rodata) /* We need to include .rodata here if gcc is used */ | |
170 | *(.rodata*) /* with -fdata-sections. */ | |
7c8bf1e8 MM |
171 | *(.gnu.linkonce.d*) |
172 | ${RELOCATING+. = ALIGN(2);} | |
173 | ${RELOCATING+ _edata = . ; } | |
0c9b4fee | 174 | ${RELOCATING+ PROVIDE (__data_end = .) ; } |
7c8bf1e8 MM |
175 | } ${RELOCATING+ > data} |
176 | ||
ec2d9b29 | 177 | .bss ${RELOCATING-0} :${RELOCATING+ AT (ADDR (.bss))} |
7c8bf1e8 MM |
178 | { |
179 | ${RELOCATING+ PROVIDE (__bss_start = .) ; } | |
180 | *(.bss) | |
df406460 | 181 | *(.bss*) |
7c8bf1e8 MM |
182 | *(COMMON) |
183 | ${RELOCATING+ PROVIDE (__bss_end = .) ; } | |
0c9b4fee MM |
184 | } ${RELOCATING+ > data} |
185 | ||
186 | ${RELOCATING+ __data_load_start = LOADADDR(.data); } | |
187 | ${RELOCATING+ __data_load_end = __data_load_start + SIZEOF(.data); } | |
188 | ||
189 | /* Global data not cleared after reset. */ | |
ec2d9b29 | 190 | .noinit ${RELOCATING-0}: |
0c9b4fee MM |
191 | { |
192 | ${RELOCATING+ PROVIDE (__noinit_start = .) ; } | |
193 | *(.noinit*) | |
194 | ${RELOCATING+ PROVIDE (__noinit_end = .) ; } | |
7c8bf1e8 | 195 | ${RELOCATING+ _end = . ; } |
0c9b4fee | 196 | ${RELOCATING+ PROVIDE (__heap_start = .) ; } |
7c8bf1e8 MM |
197 | } ${RELOCATING+ > data} |
198 | ||
ec2d9b29 | 199 | .eeprom ${RELOCATING-0}: |
7c8bf1e8 MM |
200 | { |
201 | *(.eeprom*) | |
202 | ${RELOCATING+ __eeprom_end = . ; } | |
203 | } ${RELOCATING+ > eeprom} | |
204 | ||
ef844a53 EW |
205 | .fuse ${RELOCATING-0}: |
206 | { | |
207 | KEEP(*(.fuse)) | |
208 | KEEP(*(.lfuse)) | |
209 | KEEP(*(.hfuse)) | |
210 | KEEP(*(.efuse)) | |
211 | } ${RELOCATING+ > fuse} | |
212 | ||
213 | .lock ${RELOCATING-0}: | |
214 | { | |
215 | KEEP(*(.lock*)) | |
216 | } ${RELOCATING+ > lock} | |
217 | ||
218 | .signature ${RELOCATING-0}: | |
219 | { | |
220 | KEEP(*(.signature*)) | |
221 | } ${RELOCATING+ > signature} | |
222 | ||
7c8bf1e8 MM |
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 | ||
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 | ||
236 | /* DWARF 1 */ | |
237 | .debug 0 : { *(.debug) } | |
238 | .line 0 : { *(.line) } | |
239 | ||
240 | /* GNU DWARF 1 extensions */ | |
09b910c6 AM |
241 | .debug_srcinfo 0 : { *(.debug_srcinfo) } |
242 | .debug_sfnames 0 : { *(.debug_sfnames) } | |
7c8bf1e8 MM |
243 | |
244 | /* DWARF 1.1 and DWARF 2 */ | |
09b910c6 AM |
245 | .debug_aranges 0 : { *(.debug_aranges) } |
246 | .debug_pubnames 0 : { *(.debug_pubnames) } | |
7c8bf1e8 MM |
247 | |
248 | /* DWARF 2 */ | |
09b910c6 AM |
249 | .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } |
250 | .debug_abbrev 0 : { *(.debug_abbrev) } | |
251 | .debug_line 0 : { *(.debug_line) } | |
252 | .debug_frame 0 : { *(.debug_frame) } | |
253 | .debug_str 0 : { *(.debug_str) } | |
254 | .debug_loc 0 : { *(.debug_loc) } | |
255 | .debug_macinfo 0 : { *(.debug_macinfo) } | |
2a995fc1 NC |
256 | |
257 | /* DWARF 3 */ | |
258 | .debug_pubtypes 0 : { *(.debug_pubtypes) } | |
259 | .debug_ranges 0 : { *(.debug_ranges) } | |
260 | ||
261 | /* DWARF Extension. */ | |
262 | .debug_macro 0 : { *(.debug_macro) } | |
7c8bf1e8 MM |
263 | } |
264 | EOF | |
265 |