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