Commit | Line | Data |
---|---|---|
6f2750fe | 1 | # Copyright (C) 2014-2016 Free Software Foundation, Inc. |
985743c7 NC |
2 | # |
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. | |
6 | ||
7c8bf1e8 | 7 | cat <<EOF |
6f2750fe | 8 | /* Copyright (C) 2014-2016 Free Software Foundation, Inc. |
985743c7 NC |
9 | |
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. */ | |
13 | ||
7c8bf1e8 MM |
14 | OUTPUT_FORMAT("${OUTPUT_FORMAT}","${OUTPUT_FORMAT}","${OUTPUT_FORMAT}") |
15 | OUTPUT_ARCH(${ARCH}) | |
16 | ||
cb072816 SKS |
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; | |
24 | ||
7c8bf1e8 MM |
25 | MEMORY |
26 | { | |
cb072816 SKS |
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__ | |
7c8bf1e8 MM |
34 | } |
35 | ||
36 | SECTIONS | |
37 | { | |
38 | /* Read-only sections, merged into text segment: */ | |
39 | ${TEXT_DYNAMIC+${DYNAMIC}} | |
ec2d9b29 AM |
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) } | |
46 | ||
47 | .rel.init ${RELOCATING-0} : { *(.rel.init) } | |
48 | .rela.init ${RELOCATING-0} : { *(.rela.init) } | |
49 | .rel.text ${RELOCATING-0} : | |
7c8bf1e8 MM |
50 | { |
51 | *(.rel.text) | |
52 | ${RELOCATING+*(.rel.text.*)} | |
53 | ${RELOCATING+*(.rel.gnu.linkonce.t*)} | |
54 | } | |
ec2d9b29 | 55 | .rela.text ${RELOCATING-0} : |
7c8bf1e8 MM |
56 | { |
57 | *(.rela.text) | |
58 | ${RELOCATING+*(.rela.text.*)} | |
59 | ${RELOCATING+*(.rela.gnu.linkonce.t*)} | |
60 | } | |
ec2d9b29 AM |
61 | .rel.fini ${RELOCATING-0} : { *(.rel.fini) } |
62 | .rela.fini ${RELOCATING-0} : { *(.rela.fini) } | |
63 | .rel.rodata ${RELOCATING-0} : | |
7c8bf1e8 MM |
64 | { |
65 | *(.rel.rodata) | |
66 | ${RELOCATING+*(.rel.rodata.*)} | |
67 | ${RELOCATING+*(.rel.gnu.linkonce.r*)} | |
68 | } | |
ec2d9b29 | 69 | .rela.rodata ${RELOCATING-0} : |
7c8bf1e8 MM |
70 | { |
71 | *(.rela.rodata) | |
72 | ${RELOCATING+*(.rela.rodata.*)} | |
73 | ${RELOCATING+*(.rela.gnu.linkonce.r*)} | |
74 | } | |
ec2d9b29 | 75 | .rel.data ${RELOCATING-0} : |
7c8bf1e8 MM |
76 | { |
77 | *(.rel.data) | |
78 | ${RELOCATING+*(.rel.data.*)} | |
79 | ${RELOCATING+*(.rel.gnu.linkonce.d*)} | |
80 | } | |
ec2d9b29 | 81 | .rela.data ${RELOCATING-0} : |
7c8bf1e8 MM |
82 | { |
83 | *(.rela.data) | |
84 | ${RELOCATING+*(.rela.data.*)} | |
85 | ${RELOCATING+*(.rela.gnu.linkonce.d*)} | |
86 | } | |
ec2d9b29 AM |
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) } | |
7c8bf1e8 | 97 | |
28c9d252 | 98 | /* Internal text space or external memory. */ |
ec2d9b29 | 99 | .text ${RELOCATING-0} : |
7c8bf1e8 | 100 | { |
0c9b4fee | 101 | *(.vectors) |
df406460 | 102 | KEEP(*(.vectors)) |
0c9b4fee | 103 | |
28c9d252 | 104 | /* For data that needs to reside in the lower 64k of progmem. */ |
8c661d24 | 105 | ${RELOCATING+ *(.progmem.gcc*)} |
28c9d252 | 106 | |
861319c9 NC |
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);} | |
28c9d252 NC |
110 | ${CONSTRUCTING+ __trampolines_start = . ; } |
111 | /* The jump trampolines for the 16-bit limited relocs will reside here. */ | |
112 | *(.trampolines) | |
8c661d24 | 113 | ${RELOCATING+ *(.trampolines*)} |
28c9d252 NC |
114 | ${CONSTRUCTING+ __trampolines_end = . ; } |
115 | ||
8c661d24 | 116 | ${RELOCATING+ *(.progmem*)} |
861319c9 | 117 | |
778ee4a6 NC |
118 | ${RELOCATING+. = ALIGN(2);} |
119 | ||
28c9d252 NC |
120 | /* For future tablejump instruction arrays for 3 byte pc devices. |
121 | We don't relax jump/call instructions within these sections. */ | |
122 | *(.jumptables) | |
8c661d24 | 123 | ${RELOCATING+ *(.jumptables*)} |
28c9d252 NC |
124 | |
125 | /* For code that needs to reside in the lower 128k progmem. */ | |
126 | *(.lowtext) | |
8c661d24 | 127 | ${RELOCATING+ *(.lowtext*)} |
28c9d252 | 128 | |
0c9b4fee MM |
129 | ${CONSTRUCTING+ __ctors_start = . ; } |
130 | ${CONSTRUCTING+ *(.ctors) } | |
131 | ${CONSTRUCTING+ __ctors_end = . ; } | |
132 | ${CONSTRUCTING+ __dtors_start = . ; } | |
133 | ${CONSTRUCTING+ *(.dtors) } | |
134 | ${CONSTRUCTING+ __dtors_end = . ; } | |
df406460 NC |
135 | KEEP(SORT(*)(.ctors)) |
136 | KEEP(SORT(*)(.dtors)) | |
0c9b4fee | 137 | |
28c9d252 NC |
138 | /* From this point on, we don't bother about wether the insns are |
139 | below or above the 16 bits boundary. */ | |
0c9b4fee | 140 | *(.init0) /* Start here after reset. */ |
df406460 | 141 | KEEP (*(.init0)) |
0c9b4fee | 142 | *(.init1) |
df406460 | 143 | KEEP (*(.init1)) |
0c9b4fee | 144 | *(.init2) /* Clear __zero_reg__, set up stack pointer. */ |
df406460 | 145 | KEEP (*(.init2)) |
0c9b4fee | 146 | *(.init3) |
df406460 | 147 | KEEP (*(.init3)) |
0c9b4fee | 148 | *(.init4) /* Initialize data and BSS. */ |
df406460 | 149 | KEEP (*(.init4)) |
0c9b4fee | 150 | *(.init5) |
df406460 | 151 | KEEP (*(.init5)) |
0c9b4fee | 152 | *(.init6) /* C++ constructors. */ |
df406460 | 153 | KEEP (*(.init6)) |
0c9b4fee | 154 | *(.init7) |
df406460 | 155 | KEEP (*(.init7)) |
0c9b4fee | 156 | *(.init8) |
df406460 | 157 | KEEP (*(.init8)) |
0c9b4fee | 158 | *(.init9) /* Call main(). */ |
df406460 | 159 | KEEP (*(.init9)) |
7c8bf1e8 MM |
160 | *(.text) |
161 | ${RELOCATING+. = ALIGN(2);} | |
865acd35 | 162 | ${RELOCATING+ *(.text.*)} |
7c8bf1e8 | 163 | ${RELOCATING+. = ALIGN(2);} |
0c9b4fee | 164 | *(.fini9) /* _exit() starts here. */ |
df406460 | 165 | KEEP (*(.fini9)) |
0c9b4fee | 166 | *(.fini8) |
df406460 | 167 | KEEP (*(.fini8)) |
0c9b4fee | 168 | *(.fini7) |
df406460 | 169 | KEEP (*(.fini7)) |
0c9b4fee | 170 | *(.fini6) /* C++ destructors. */ |
df406460 | 171 | KEEP (*(.fini6)) |
0c9b4fee | 172 | *(.fini5) |
df406460 | 173 | KEEP (*(.fini5)) |
0c9b4fee | 174 | *(.fini4) |
df406460 | 175 | KEEP (*(.fini4)) |
0c9b4fee | 176 | *(.fini3) |
df406460 | 177 | KEEP (*(.fini3)) |
0c9b4fee | 178 | *(.fini2) |
df406460 | 179 | KEEP (*(.fini2)) |
0c9b4fee | 180 | *(.fini1) |
df406460 | 181 | KEEP (*(.fini1)) |
0c9b4fee | 182 | *(.fini0) /* Infinite loop after program termination. */ |
df406460 | 183 | KEEP (*(.fini0)) |
7c8bf1e8 MM |
184 | ${RELOCATING+ _etext = . ; } |
185 | } ${RELOCATING+ > text} | |
186 | ||
5ed365b4 | 187 | .data ${RELOCATING-0} : |
7c8bf1e8 MM |
188 | { |
189 | ${RELOCATING+ PROVIDE (__data_start = .) ; } | |
b4841801 | 190 | *(.data) |
8c661d24 | 191 | ${RELOCATING+ *(.data*)} |
df406460 | 192 | *(.rodata) /* We need to include .rodata here if gcc is used */ |
865acd35 | 193 | ${RELOCATING+ *(.rodata*)} /* with -fdata-sections. */ |
7c8bf1e8 MM |
194 | *(.gnu.linkonce.d*) |
195 | ${RELOCATING+. = ALIGN(2);} | |
196 | ${RELOCATING+ _edata = . ; } | |
0c9b4fee | 197 | ${RELOCATING+ PROVIDE (__data_end = .) ; } |
5ed365b4 | 198 | } ${RELOCATING+ > data ${RELOCATING+AT> text}} |
7c8bf1e8 | 199 | |
b4841801 | 200 | .bss ${RELOCATING+ ADDR(.data) + SIZEOF (.data)} ${RELOCATING-0} :${RELOCATING+ AT (ADDR (.bss))} |
7c8bf1e8 MM |
201 | { |
202 | ${RELOCATING+ PROVIDE (__bss_start = .) ; } | |
203 | *(.bss) | |
865acd35 | 204 | ${RELOCATING+ *(.bss*)} |
7c8bf1e8 MM |
205 | *(COMMON) |
206 | ${RELOCATING+ PROVIDE (__bss_end = .) ; } | |
0c9b4fee MM |
207 | } ${RELOCATING+ > data} |
208 | ||
209 | ${RELOCATING+ __data_load_start = LOADADDR(.data); } | |
210 | ${RELOCATING+ __data_load_end = __data_load_start + SIZEOF(.data); } | |
211 | ||
212 | /* Global data not cleared after reset. */ | |
7585b2b8 | 213 | .noinit ${RELOCATING+ ADDR(.bss) + SIZEOF (.bss)} ${RELOCATING-0}: ${RELOCATING+ AT (ADDR (.noinit))} |
0c9b4fee MM |
214 | { |
215 | ${RELOCATING+ PROVIDE (__noinit_start = .) ; } | |
216 | *(.noinit*) | |
217 | ${RELOCATING+ PROVIDE (__noinit_end = .) ; } | |
7c8bf1e8 | 218 | ${RELOCATING+ _end = . ; } |
0c9b4fee | 219 | ${RELOCATING+ PROVIDE (__heap_start = .) ; } |
7c8bf1e8 MM |
220 | } ${RELOCATING+ > data} |
221 | ||
ec2d9b29 | 222 | .eeprom ${RELOCATING-0}: |
7c8bf1e8 | 223 | { |
b176ded1 NC |
224 | /* See .data above... */ |
225 | KEEP(*(.eeprom*)) | |
7c8bf1e8 MM |
226 | ${RELOCATING+ __eeprom_end = . ; } |
227 | } ${RELOCATING+ > eeprom} | |
228 | ||
ef844a53 EW |
229 | .fuse ${RELOCATING-0}: |
230 | { | |
231 | KEEP(*(.fuse)) | |
232 | KEEP(*(.lfuse)) | |
233 | KEEP(*(.hfuse)) | |
234 | KEEP(*(.efuse)) | |
235 | } ${RELOCATING+ > fuse} | |
236 | ||
237 | .lock ${RELOCATING-0}: | |
238 | { | |
239 | KEEP(*(.lock*)) | |
240 | } ${RELOCATING+ > lock} | |
241 | ||
242 | .signature ${RELOCATING-0}: | |
243 | { | |
244 | KEEP(*(.signature*)) | |
245 | } ${RELOCATING+ > signature} | |
246 | ||
7c8bf1e8 MM |
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) } | |
ceb0a680 | 254 | .comment 0 : { *(.comment) } |
2cfa18a9 | 255 | .note.gnu.build-id : { *(.note.gnu.build-id) } |
ceb0a680 | 256 | EOF |
2a995fc1 | 257 | |
d061dfac | 258 | . $srcdir/scripttempl/DWARF.sc |
2a995fc1 | 259 | |
ceb0a680 | 260 | cat <<EOF |
7c8bf1e8 MM |
261 | } |
262 | EOF |