Add linker relaxation support for the AVR
[deliverable/binutils-gdb.git] / ld / scripttempl / avr.sc
CommitLineData
7c8bf1e8
MM
1cat <<EOF
2OUTPUT_FORMAT("${OUTPUT_FORMAT}","${OUTPUT_FORMAT}","${OUTPUT_FORMAT}")
3OUTPUT_ARCH(${ARCH})
4
5MEMORY
6{
7 text (rx) : ORIGIN = 0, LENGTH = $TEXT_LENGTH
8 data (rw!x) : ORIGIN = 0x800060, LENGTH = $DATA_LENGTH
9 eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K
10}
11
12SECTIONS
13{
14 /* Read-only sections, merged into text segment: */
15 ${TEXT_DYNAMIC+${DYNAMIC}}
16 .hash ${RELOCATING-0} : { *(.hash) }
17 .dynsym ${RELOCATING-0} : { *(.dynsym) }
18 .dynstr ${RELOCATING-0} : { *(.dynstr) }
19 .gnu.version ${RELOCATING-0} : { *(.gnu.version) }
20 .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) }
21 .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) }
22
0c9b4fee 23 .rel.init ${RELOCATING-0} : { *(.rel.init) }
7c8bf1e8
MM
24 .rela.init ${RELOCATING-0} : { *(.rela.init) }
25 .rel.text ${RELOCATING-0} :
26 {
27 *(.rel.text)
28 ${RELOCATING+*(.rel.text.*)}
29 ${RELOCATING+*(.rel.gnu.linkonce.t*)}
30 }
31 .rela.text ${RELOCATING-0} :
32 {
33 *(.rela.text)
34 ${RELOCATING+*(.rela.text.*)}
35 ${RELOCATING+*(.rela.gnu.linkonce.t*)}
36 }
0c9b4fee 37 .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
7c8bf1e8
MM
38 .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
39 .rel.rodata ${RELOCATING-0} :
40 {
41 *(.rel.rodata)
42 ${RELOCATING+*(.rel.rodata.*)}
43 ${RELOCATING+*(.rel.gnu.linkonce.r*)}
44 }
45 .rela.rodata ${RELOCATING-0} :
46 {
47 *(.rela.rodata)
48 ${RELOCATING+*(.rela.rodata.*)}
49 ${RELOCATING+*(.rela.gnu.linkonce.r*)}
50 }
51 .rel.data ${RELOCATING-0} :
52 {
53 *(.rel.data)
54 ${RELOCATING+*(.rel.data.*)}
55 ${RELOCATING+*(.rel.gnu.linkonce.d*)}
56 }
57 .rela.data ${RELOCATING-0} :
58 {
59 *(.rela.data)
60 ${RELOCATING+*(.rela.data.*)}
61 ${RELOCATING+*(.rela.gnu.linkonce.d*)}
62 }
63 .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
64 .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
65 .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
66 .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
67 .rel.got ${RELOCATING-0} : { *(.rel.got) }
68 .rela.got ${RELOCATING-0} : { *(.rela.got) }
69 .rel.bss ${RELOCATING-0} : { *(.rel.bss) }
70 .rela.bss ${RELOCATING-0} : { *(.rela.bss) }
71 .rel.plt ${RELOCATING-0} : { *(.rel.plt) }
72 .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
73
74 /* Internal text space or external memory */
75 .text :
76 {
0c9b4fee 77 *(.vectors)
df406460 78 KEEP(*(.vectors))
0c9b4fee
MM
79
80 ${CONSTRUCTING+ __ctors_start = . ; }
81 ${CONSTRUCTING+ *(.ctors) }
82 ${CONSTRUCTING+ __ctors_end = . ; }
83 ${CONSTRUCTING+ __dtors_start = . ; }
84 ${CONSTRUCTING+ *(.dtors) }
85 ${CONSTRUCTING+ __dtors_end = . ; }
df406460
NC
86 KEEP(SORT(*)(.ctors))
87 KEEP(SORT(*)(.dtors))
0c9b4fee 88
df406460 89 /* For data that needs to reside in the lower 64k of progmem */
7c8bf1e8
MM
90 *(.progmem.gcc*)
91 *(.progmem*)
92 ${RELOCATING+. = ALIGN(2);}
df406460
NC
93
94 /* for future tablejump instruction arrays for 3 byte pc devices */
95 *(.jumptables)
96 *(.jumptables*)
97 /* for code that needs to reside in the lower 128k progmem */
98 *(.lowtext)
99 *(.lowtext*)
100
0c9b4fee 101 *(.init0) /* Start here after reset. */
df406460 102 KEEP (*(.init0))
0c9b4fee 103 *(.init1)
df406460 104 KEEP (*(.init1))
0c9b4fee 105 *(.init2) /* Clear __zero_reg__, set up stack pointer. */
df406460 106 KEEP (*(.init2))
0c9b4fee 107 *(.init3)
df406460 108 KEEP (*(.init3))
0c9b4fee 109 *(.init4) /* Initialize data and BSS. */
df406460 110 KEEP (*(.init4))
0c9b4fee 111 *(.init5)
df406460 112 KEEP (*(.init5))
0c9b4fee 113 *(.init6) /* C++ constructors. */
df406460 114 KEEP (*(.init6))
0c9b4fee 115 *(.init7)
df406460 116 KEEP (*(.init7))
0c9b4fee 117 *(.init8)
df406460 118 KEEP (*(.init8))
0c9b4fee 119 *(.init9) /* Call main(). */
df406460 120 KEEP (*(.init9))
7c8bf1e8
MM
121 *(.text)
122 ${RELOCATING+. = ALIGN(2);}
123 *(.text.*)
124 ${RELOCATING+. = ALIGN(2);}
0c9b4fee 125 *(.fini9) /* _exit() starts here. */
df406460 126 KEEP (*(.fini9))
0c9b4fee 127 *(.fini8)
df406460 128 KEEP (*(.fini8))
0c9b4fee 129 *(.fini7)
df406460 130 KEEP (*(.fini7))
0c9b4fee 131 *(.fini6) /* C++ destructors. */
df406460 132 KEEP (*(.fini6))
0c9b4fee 133 *(.fini5)
df406460 134 KEEP (*(.fini5))
0c9b4fee 135 *(.fini4)
df406460 136 KEEP (*(.fini4))
0c9b4fee 137 *(.fini3)
df406460 138 KEEP (*(.fini3))
0c9b4fee 139 *(.fini2)
df406460 140 KEEP (*(.fini2))
0c9b4fee 141 *(.fini1)
df406460 142 KEEP (*(.fini1))
0c9b4fee 143 *(.fini0) /* Infinite loop after program termination. */
df406460 144 KEEP (*(.fini0))
7c8bf1e8
MM
145 ${RELOCATING+ _etext = . ; }
146 } ${RELOCATING+ > text}
147
148 .data ${RELOCATING-0} : ${RELOCATING+AT (ADDR (.text) + SIZEOF (.text))}
149 {
150 ${RELOCATING+ PROVIDE (__data_start = .) ; }
151 *(.data)
df406460
NC
152 *(.data*)
153 *(.rodata) /* We need to include .rodata here if gcc is used */
154 *(.rodata*) /* with -fdata-sections. */
7c8bf1e8
MM
155 *(.gnu.linkonce.d*)
156 ${RELOCATING+. = ALIGN(2);}
157 ${RELOCATING+ _edata = . ; }
0c9b4fee 158 ${RELOCATING+ PROVIDE (__data_end = .) ; }
7c8bf1e8
MM
159 } ${RELOCATING+ > data}
160
161 .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} :
162 {
163 ${RELOCATING+ PROVIDE (__bss_start = .) ; }
164 *(.bss)
df406460 165 *(.bss*)
7c8bf1e8
MM
166 *(COMMON)
167 ${RELOCATING+ PROVIDE (__bss_end = .) ; }
0c9b4fee
MM
168 } ${RELOCATING+ > data}
169
170 ${RELOCATING+ __data_load_start = LOADADDR(.data); }
171 ${RELOCATING+ __data_load_end = __data_load_start + SIZEOF(.data); }
172
173 /* Global data not cleared after reset. */
174 .noinit ${RELOCATING+ SIZEOF(.bss) + ADDR(.bss)} :
175 {
176 ${RELOCATING+ PROVIDE (__noinit_start = .) ; }
177 *(.noinit*)
178 ${RELOCATING+ PROVIDE (__noinit_end = .) ; }
7c8bf1e8 179 ${RELOCATING+ _end = . ; }
0c9b4fee 180 ${RELOCATING+ PROVIDE (__heap_start = .) ; }
7c8bf1e8
MM
181 } ${RELOCATING+ > data}
182
183 .eeprom ${RELOCATING-0}:
7c8bf1e8
MM
184 {
185 *(.eeprom*)
186 ${RELOCATING+ __eeprom_end = . ; }
187 } ${RELOCATING+ > eeprom}
188
189 /* Stabs debugging sections. */
190 .stab 0 : { *(.stab) }
191 .stabstr 0 : { *(.stabstr) }
192 .stab.excl 0 : { *(.stab.excl) }
193 .stab.exclstr 0 : { *(.stab.exclstr) }
194 .stab.index 0 : { *(.stab.index) }
195 .stab.indexstr 0 : { *(.stab.indexstr) }
196 .comment 0 : { *(.comment) }
197
198 /* DWARF debug sections.
199 Symbols in the DWARF debugging sections are relative to the beginning
200 of the section so we begin them at 0. */
201
202 /* DWARF 1 */
203 .debug 0 : { *(.debug) }
204 .line 0 : { *(.line) }
205
206 /* GNU DWARF 1 extensions */
207 .debug_srcinfo 0 : { *(.debug_srcinfo) }
208 .debug_sfnames 0 : { *(.debug_sfnames) }
209
210 /* DWARF 1.1 and DWARF 2 */
211 .debug_aranges 0 : { *(.debug_aranges) }
212 .debug_pubnames 0 : { *(.debug_pubnames) }
213
214 /* DWARF 2 */
215 .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
216 .debug_abbrev 0 : { *(.debug_abbrev) }
217 .debug_line 0 : { *(.debug_line) }
218 .debug_frame 0 : { *(.debug_frame) }
219 .debug_str 0 : { *(.debug_str) }
220 .debug_loc 0 : { *(.debug_loc) }
221 .debug_macinfo 0 : { *(.debug_macinfo) }
222}
223EOF
224
This page took 0.181142 seconds and 4 git commands to generate.