Add .debug_gdb_scripts section to PE linker scripts.
[deliverable/binutils-gdb.git] / ld / scripttempl / avr.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
7c8bf1e8 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
7c8bf1e8
MM
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__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
25MEMORY
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
36SECTIONS
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
1bdc036f
SKS
116 /* avr-libc expects these data to reside in lower 64K. */
117 ${RELOCATING+ *libprintf_flt.a:*(.progmem.data)}
118 ${RELOCATING+ *libc.a:*(.progmem.data)}
119
8c661d24 120 ${RELOCATING+ *(.progmem*)}
861319c9 121
778ee4a6
NC
122 ${RELOCATING+. = ALIGN(2);}
123
28c9d252
NC
124 /* For future tablejump instruction arrays for 3 byte pc devices.
125 We don't relax jump/call instructions within these sections. */
126 *(.jumptables)
8c661d24 127 ${RELOCATING+ *(.jumptables*)}
28c9d252
NC
128
129 /* For code that needs to reside in the lower 128k progmem. */
130 *(.lowtext)
8c661d24 131 ${RELOCATING+ *(.lowtext*)}
28c9d252 132
0c9b4fee
MM
133 ${CONSTRUCTING+ __ctors_start = . ; }
134 ${CONSTRUCTING+ *(.ctors) }
135 ${CONSTRUCTING+ __ctors_end = . ; }
136 ${CONSTRUCTING+ __dtors_start = . ; }
137 ${CONSTRUCTING+ *(.dtors) }
138 ${CONSTRUCTING+ __dtors_end = . ; }
df406460
NC
139 KEEP(SORT(*)(.ctors))
140 KEEP(SORT(*)(.dtors))
0c9b4fee 141
28c9d252
NC
142 /* From this point on, we don't bother about wether the insns are
143 below or above the 16 bits boundary. */
0c9b4fee 144 *(.init0) /* Start here after reset. */
df406460 145 KEEP (*(.init0))
0c9b4fee 146 *(.init1)
df406460 147 KEEP (*(.init1))
0c9b4fee 148 *(.init2) /* Clear __zero_reg__, set up stack pointer. */
df406460 149 KEEP (*(.init2))
0c9b4fee 150 *(.init3)
df406460 151 KEEP (*(.init3))
0c9b4fee 152 *(.init4) /* Initialize data and BSS. */
df406460 153 KEEP (*(.init4))
0c9b4fee 154 *(.init5)
df406460 155 KEEP (*(.init5))
0c9b4fee 156 *(.init6) /* C++ constructors. */
df406460 157 KEEP (*(.init6))
0c9b4fee 158 *(.init7)
df406460 159 KEEP (*(.init7))
0c9b4fee 160 *(.init8)
df406460 161 KEEP (*(.init8))
0c9b4fee 162 *(.init9) /* Call main(). */
df406460 163 KEEP (*(.init9))
7c8bf1e8
MM
164 *(.text)
165 ${RELOCATING+. = ALIGN(2);}
865acd35 166 ${RELOCATING+ *(.text.*)}
7c8bf1e8 167 ${RELOCATING+. = ALIGN(2);}
0c9b4fee 168 *(.fini9) /* _exit() starts here. */
df406460 169 KEEP (*(.fini9))
0c9b4fee 170 *(.fini8)
df406460 171 KEEP (*(.fini8))
0c9b4fee 172 *(.fini7)
df406460 173 KEEP (*(.fini7))
0c9b4fee 174 *(.fini6) /* C++ destructors. */
df406460 175 KEEP (*(.fini6))
0c9b4fee 176 *(.fini5)
df406460 177 KEEP (*(.fini5))
0c9b4fee 178 *(.fini4)
df406460 179 KEEP (*(.fini4))
0c9b4fee 180 *(.fini3)
df406460 181 KEEP (*(.fini3))
0c9b4fee 182 *(.fini2)
df406460 183 KEEP (*(.fini2))
0c9b4fee 184 *(.fini1)
df406460 185 KEEP (*(.fini1))
0c9b4fee 186 *(.fini0) /* Infinite loop after program termination. */
df406460 187 KEEP (*(.fini0))
7c8bf1e8
MM
188 ${RELOCATING+ _etext = . ; }
189 } ${RELOCATING+ > text}
190
5ed365b4 191 .data ${RELOCATING-0} :
7c8bf1e8
MM
192 {
193 ${RELOCATING+ PROVIDE (__data_start = .) ; }
b4841801 194 *(.data)
8c661d24 195 ${RELOCATING+ *(.data*)}
df406460 196 *(.rodata) /* We need to include .rodata here if gcc is used */
865acd35 197 ${RELOCATING+ *(.rodata*)} /* with -fdata-sections. */
7c8bf1e8
MM
198 *(.gnu.linkonce.d*)
199 ${RELOCATING+. = ALIGN(2);}
200 ${RELOCATING+ _edata = . ; }
0c9b4fee 201 ${RELOCATING+ PROVIDE (__data_end = .) ; }
5ed365b4 202 } ${RELOCATING+ > data ${RELOCATING+AT> text}}
7c8bf1e8 203
b4841801 204 .bss ${RELOCATING+ ADDR(.data) + SIZEOF (.data)} ${RELOCATING-0} :${RELOCATING+ AT (ADDR (.bss))}
7c8bf1e8
MM
205 {
206 ${RELOCATING+ PROVIDE (__bss_start = .) ; }
207 *(.bss)
865acd35 208 ${RELOCATING+ *(.bss*)}
7c8bf1e8
MM
209 *(COMMON)
210 ${RELOCATING+ PROVIDE (__bss_end = .) ; }
0c9b4fee
MM
211 } ${RELOCATING+ > data}
212
213 ${RELOCATING+ __data_load_start = LOADADDR(.data); }
214 ${RELOCATING+ __data_load_end = __data_load_start + SIZEOF(.data); }
215
216 /* Global data not cleared after reset. */
7585b2b8 217 .noinit ${RELOCATING+ ADDR(.bss) + SIZEOF (.bss)} ${RELOCATING-0}: ${RELOCATING+ AT (ADDR (.noinit))}
0c9b4fee
MM
218 {
219 ${RELOCATING+ PROVIDE (__noinit_start = .) ; }
220 *(.noinit*)
221 ${RELOCATING+ PROVIDE (__noinit_end = .) ; }
7c8bf1e8 222 ${RELOCATING+ _end = . ; }
0c9b4fee 223 ${RELOCATING+ PROVIDE (__heap_start = .) ; }
7c8bf1e8
MM
224 } ${RELOCATING+ > data}
225
ec2d9b29 226 .eeprom ${RELOCATING-0}:
7c8bf1e8 227 {
b176ded1
NC
228 /* See .data above... */
229 KEEP(*(.eeprom*))
7c8bf1e8
MM
230 ${RELOCATING+ __eeprom_end = . ; }
231 } ${RELOCATING+ > eeprom}
232
ef844a53
EW
233 .fuse ${RELOCATING-0}:
234 {
235 KEEP(*(.fuse))
236 KEEP(*(.lfuse))
237 KEEP(*(.hfuse))
238 KEEP(*(.efuse))
239 } ${RELOCATING+ > fuse}
240
241 .lock ${RELOCATING-0}:
242 {
243 KEEP(*(.lock*))
244 } ${RELOCATING+ > lock}
245
246 .signature ${RELOCATING-0}:
247 {
248 KEEP(*(.signature*))
249 } ${RELOCATING+ > signature}
250
7c8bf1e8
MM
251 /* Stabs debugging sections. */
252 .stab 0 : { *(.stab) }
253 .stabstr 0 : { *(.stabstr) }
254 .stab.excl 0 : { *(.stab.excl) }
255 .stab.exclstr 0 : { *(.stab.exclstr) }
256 .stab.index 0 : { *(.stab.index) }
257 .stab.indexstr 0 : { *(.stab.indexstr) }
ceb0a680 258 .comment 0 : { *(.comment) }
2cfa18a9 259 .note.gnu.build-id : { *(.note.gnu.build-id) }
ceb0a680 260EOF
2a995fc1 261
d061dfac 262. $srcdir/scripttempl/DWARF.sc
2a995fc1 263
ceb0a680 264cat <<EOF
7c8bf1e8
MM
265}
266EOF
This page took 0.636305 seconds and 4 git commands to generate.