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