ld: Add tests for -Ur
[deliverable/binutils-gdb.git] / ld / scripttempl / avrtiny.sc
CommitLineData
2571583a 1# Copyright (C) 2014-2017 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
f36e8886 7cat <<EOF
2571583a 8/* Copyright (C) 2014-2017 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
f36e8886
BS
14OUTPUT_FORMAT("${OUTPUT_FORMAT}","${OUTPUT_FORMAT}","${OUTPUT_FORMAT}")
15OUTPUT_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__FUSE_REGION_LENGTH__ = DEFINED(__FUSE_REGION_LENGTH__) ? __FUSE_REGION_LENGTH__ : 2;
20__LOCK_REGION_LENGTH__ = DEFINED(__LOCK_REGION_LENGTH__) ? __LOCK_REGION_LENGTH__ : 2;
21__SIGNATURE_REGION_LENGTH__ = DEFINED(__SIGNATURE_REGION_LENGTH__) ? __SIGNATURE_REGION_LENGTH__ : 4;
fbf25dfd 22__RODATA_PM_OFFSET__ = DEFINED(__RODATA_PM_OFFSET__) ? __RODATA_PM_OFFSET__ : 0x4000;
cb072816 23
f36e8886
BS
24MEMORY
25{
cb072816
SKS
26 text (rx) : ORIGIN = $TEXT_ORIGIN, LENGTH = __TEXT_REGION_LENGTH__
27 data (rw!x) : ORIGIN = $DATA_ORIGIN, LENGTH = __DATA_REGION_LENGTH__
f36e8886
BS
28
29 /* Provide offsets for config, lock and signature to match
30 production file format. Ignore offsets in datasheet. */
31
cb072816
SKS
32 config (rw!x) : ORIGIN = 0x820000, LENGTH = __FUSE_REGION_LENGTH__
33 lock (rw!x) : ORIGIN = 0x830000, LENGTH = __LOCK_REGION_LENGTH__
34 signature (rw!x) : ORIGIN = 0x840000, LENGTH = __SIGNATURE_REGION_LENGTH__
f36e8886
BS
35}
36
37SECTIONS
38{
39 /* Read-only sections, merged into text segment: */
40 ${TEXT_DYNAMIC+${DYNAMIC}}
41 .hash ${RELOCATING-0} : { *(.hash) }
42 .dynsym ${RELOCATING-0} : { *(.dynsym) }
43 .dynstr ${RELOCATING-0} : { *(.dynstr) }
44 .gnu.version ${RELOCATING-0} : { *(.gnu.version) }
45 .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) }
46 .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) }
47
48 .rel.init ${RELOCATING-0} : { *(.rel.init) }
49 .rela.init ${RELOCATING-0} : { *(.rela.init) }
50 .rel.text ${RELOCATING-0} :
51 {
52 *(.rel.text)
53 ${RELOCATING+*(.rel.text.*)}
54 ${RELOCATING+*(.rel.gnu.linkonce.t*)}
55 }
56 .rela.text ${RELOCATING-0} :
57 {
58 *(.rela.text)
59 ${RELOCATING+*(.rela.text.*)}
60 ${RELOCATING+*(.rela.gnu.linkonce.t*)}
61 }
62 .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
63 .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
64 .rel.rodata ${RELOCATING-0} :
65 {
66 *(.rel.rodata)
67 ${RELOCATING+*(.rel.rodata.*)}
68 ${RELOCATING+*(.rel.gnu.linkonce.r*)}
69 }
70 .rela.rodata ${RELOCATING-0} :
71 {
72 *(.rela.rodata)
73 ${RELOCATING+*(.rela.rodata.*)}
74 ${RELOCATING+*(.rela.gnu.linkonce.r*)}
75 }
76 .rel.data ${RELOCATING-0} :
77 {
78 *(.rel.data)
79 ${RELOCATING+*(.rel.data.*)}
80 ${RELOCATING+*(.rel.gnu.linkonce.d*)}
81 }
82 .rela.data ${RELOCATING-0} :
83 {
84 *(.rela.data)
85 ${RELOCATING+*(.rela.data.*)}
86 ${RELOCATING+*(.rela.gnu.linkonce.d*)}
87 }
88 .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
89 .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
90 .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
91 .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
92 .rel.got ${RELOCATING-0} : { *(.rel.got) }
93 .rela.got ${RELOCATING-0} : { *(.rela.got) }
94 .rel.bss ${RELOCATING-0} : { *(.rel.bss) }
95 .rela.bss ${RELOCATING-0} : { *(.rela.bss) }
96 .rel.plt ${RELOCATING-0} : { *(.rel.plt) }
97 .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
98
99 /* Internal text space or external memory. */
0e03d18a 100 .text ${RELOCATING-0} :
f36e8886
BS
101 {
102 *(.vectors)
103 KEEP(*(.vectors))
104
105 /* For data that needs to reside in the lower 64k of progmem. */
51b26797 106 ${RELOCATING+ *(.progmem.gcc*)}
f36e8886 107
51b26797
DC
108 /* PR 13812: Placing the trampolines here gives a better chance
109 that they will be in range of the code that uses them. */
110 ${RELOCATING+. = ALIGN(2);}
f36e8886
BS
111 ${CONSTRUCTING+ __trampolines_start = . ; }
112 /* The jump trampolines for the 16-bit limited relocs will reside here. */
113 *(.trampolines)
51b26797 114 ${RELOCATING+ *(.trampolines*)}
f36e8886
BS
115 ${CONSTRUCTING+ __trampolines_end = . ; }
116
1bdc036f
SKS
117 /* avr-libc expects these data to reside in lower 64K. */
118 ${RELOCATING+ *libprintf_flt.a:*(.progmem.data)}
119 ${RELOCATING+ *libc.a:*(.progmem.data)}
120
51b26797
DC
121 ${RELOCATING+ *(.progmem*)}
122
123 ${RELOCATING+. = ALIGN(2);}
124
f36e8886
BS
125 /* For future tablejump instruction arrays for 3 byte pc devices.
126 We don't relax jump/call instructions within these sections. */
127 *(.jumptables)
51b26797 128 ${RELOCATING+ *(.jumptables*)}
f36e8886
BS
129
130 /* For code that needs to reside in the lower 128k progmem. */
131 *(.lowtext)
51b26797 132 ${RELOCATING+ *(.lowtext*)}
f36e8886
BS
133
134 ${CONSTRUCTING+ __ctors_start = . ; }
135 ${CONSTRUCTING+ *(.ctors) }
136 ${CONSTRUCTING+ __ctors_end = . ; }
137 ${CONSTRUCTING+ __dtors_start = . ; }
138 ${CONSTRUCTING+ *(.dtors) }
139 ${CONSTRUCTING+ __dtors_end = . ; }
140 KEEP(SORT(*)(.ctors))
141 KEEP(SORT(*)(.dtors))
142
143 /* From this point on, we don't bother about wether the insns are
144 below or above the 16 bits boundary. */
145 *(.init0) /* Start here after reset. */
146 KEEP (*(.init0))
147 *(.init1)
148 KEEP (*(.init1))
149 *(.init2) /* Clear __zero_reg__, set up stack pointer. */
150 KEEP (*(.init2))
151 *(.init3)
152 KEEP (*(.init3))
153 *(.init4) /* Initialize data and BSS. */
154 KEEP (*(.init4))
155 *(.init5)
156 KEEP (*(.init5))
157 *(.init6) /* C++ constructors. */
158 KEEP (*(.init6))
159 *(.init7)
160 KEEP (*(.init7))
161 *(.init8)
162 KEEP (*(.init8))
163 *(.init9) /* Call main(). */
164 KEEP (*(.init9))
165 *(.text)
166 ${RELOCATING+. = ALIGN(2);}
51b26797 167 ${RELOCATING+ *(.text.*)}
f36e8886
BS
168 ${RELOCATING+. = ALIGN(2);}
169 *(.fini9) /* _exit() starts here. */
170 KEEP (*(.fini9))
171 *(.fini8)
172 KEEP (*(.fini8))
173 *(.fini7)
174 KEEP (*(.fini7))
175 *(.fini6) /* C++ destructors. */
176 KEEP (*(.fini6))
177 *(.fini5)
178 KEEP (*(.fini5))
179 *(.fini4)
180 KEEP (*(.fini4))
181 *(.fini3)
182 KEEP (*(.fini3))
183 *(.fini2)
184 KEEP (*(.fini2))
185 *(.fini1)
186 KEEP (*(.fini1))
187 *(.fini0) /* Infinite loop after program termination. */
188 KEEP (*(.fini0))
189 ${RELOCATING+ _etext = . ; }
190 } ${RELOCATING+ > text}
191
fbf25dfd
GJL
192 .rodata ${RELOCATING+ ADDR(.text) + SIZEOF (.text) + __RODATA_PM_OFFSET__ } ${RELOCATING-0} :
193 {
194 *(.rodata)
195 ${RELOCATING+ *(.rodata*)}
196 *(.gnu.linkonce.r*)
197 } ${RELOCATING+AT> text}
198
51b26797 199 .data ${RELOCATING-0} :
f36e8886
BS
200 {
201 ${RELOCATING+ PROVIDE (__data_start = .) ; }
202 *(.data)
51b26797 203 ${RELOCATING+ *(.data*)}
f36e8886
BS
204 *(.gnu.linkonce.d*)
205 ${RELOCATING+. = ALIGN(2);}
206 ${RELOCATING+ _edata = . ; }
207 ${RELOCATING+ PROVIDE (__data_end = .) ; }
51b26797 208 } ${RELOCATING+ > data ${RELOCATING+AT> text}}
f36e8886 209
51b26797 210 .bss ${RELOCATING+ ADDR(.data) + SIZEOF (.data)} ${RELOCATING-0} :${RELOCATING+ AT (ADDR (.bss))}
f36e8886
BS
211 {
212 ${RELOCATING+ PROVIDE (__bss_start = .) ; }
213 *(.bss)
51b26797 214 ${RELOCATING+ *(.bss*)}
f36e8886
BS
215 *(COMMON)
216 ${RELOCATING+ PROVIDE (__bss_end = .) ; }
217 } ${RELOCATING+ > data}
218
219 ${RELOCATING+ __data_load_start = LOADADDR(.data); }
220 ${RELOCATING+ __data_load_end = __data_load_start + SIZEOF(.data); }
221
222 /* Global data not cleared after reset. */
7585b2b8 223 .noinit ${RELOCATING+ ADDR(.bss) + SIZEOF (.bss)} ${RELOCATING-0} : ${RELOCATING+ AT (ADDR (.noinit))}
f36e8886
BS
224 {
225 ${RELOCATING+ PROVIDE (__noinit_start = .) ; }
226 *(.noinit*)
227 ${RELOCATING+ PROVIDE (__noinit_end = .) ; }
228 ${RELOCATING+ _end = . ; }
229 ${RELOCATING+ PROVIDE (__heap_start = .) ; }
230 } ${RELOCATING+ > data}
231
232 .lock ${RELOCATING-0}:
233 {
234 KEEP(*(.lock*))
235 } ${RELOCATING+ > lock}
236
237 .signature ${RELOCATING-0}:
238 {
239 KEEP(*(.signature*))
240 } ${RELOCATING+ > signature}
241
242 .config ${RELOCATING-0}:
243 {
244 KEEP(*(.config*))
245 } ${RELOCATING+ > config}
246
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) }
254 .comment 0 : { *(.comment) }
51b26797
DC
255 .note.gnu.build-id : { *(.note.gnu.build-id) }
256EOF
f36e8886 257
51b26797 258. $srcdir/scripttempl/DWARF.sc
f36e8886 259
51b26797 260cat <<EOF
f36e8886
BS
261}
262EOF
This page took 0.16243 seconds and 4 git commands to generate.