* gdb.texinfo (Packets): Fix typos "alligned".
[deliverable/binutils-gdb.git] / ld / scripttempl / elfm68hc11.sc
CommitLineData
60bcf0fa
NC
1#
2# Unusual variables checked by this code:
563e308f 3# NOP - four byte opcode for no-op (defaults to 0)
60bcf0fa
NC
4# DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
5# OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ...
6# (e.g., .PARISC.global)
7# OTHER_SECTIONS - at the end
8# EXECUTABLE_SYMBOLS - symbols that must be defined for an
9# executable (e.g., _DYNAMIC_LINK)
10# TEXT_START_SYMBOLS - symbols that appear at the start of the
11# .text section.
12# DATA_START_SYMBOLS - symbols that appear at the start of the
13# .data section.
14# OTHER_BSS_SYMBOLS - symbols that appear at the start of the
15# .bss section besides __bss_start.
16# EMBEDDED - whether this is for an embedded system.
17#
18# When adding sections, do note that the names of some sections are used
19# when specifying the start address of the next.
20#
21test -z "$ENTRY" && ENTRY=_start
22test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
23test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
24if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi
25test "$LD_FLAG" = "N" && DATA_ADDR=.
26
27CTOR=".ctors ${CONSTRUCTING-0} :
28 {
de0b1853 29 ${CONSTRUCTING+ PROVIDE (__CTOR_LIST__ = .); }
60bcf0fa
NC
30 ${CONSTRUCTING+${CTOR_START}}
31 *(.ctors)
32 /* We don't want to include the .ctor section from
33 from the crtend.o file until after the sorted ctors.
34 The .ctor section from the crtend file contains the
35 end of ctors marker and it must be last
36
37 KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
38 KEEP (*(SORT(.ctors.*)))
39 KEEP (*(.ctors)) */
40
41 ${CONSTRUCTING+${CTOR_END}}
de0b1853 42 ${CONSTRUCTING+ PROVIDE(__CTOR_END__ = .); }
ecfdd20c 43 } ${RELOCATING+ > ${TEXT_MEMORY}}"
60bcf0fa
NC
44
45DTOR=" .dtors ${CONSTRUCTING-0} :
46 {
de0b1853 47 ${CONSTRUCTING+ PROVIDE(__DTOR_LIST__ = .); }
60bcf0fa
NC
48 *(.dtors)
49 /*
50 KEEP (*crtbegin.o(.dtors))
51 KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
52 KEEP (*(SORT(.dtors.*)))
53 KEEP (*(.dtors)) */
de0b1853 54 ${CONSTRUCTING+ PROVIDE(__DTOR_END__ = .); }
ecfdd20c 55 } ${RELOCATING+ > ${TEXT_MEMORY}}"
60bcf0fa
NC
56
57
58VECTORS="
59 /* If the 'vectors_addr' symbol is defined, it indicates the start address
60 of interrupt vectors. This depends on the 68HC11 operating mode:
61
62 Addr
63 Single chip 0xffc0
64 Extended mode 0xffc0
65 Bootstrap 0x00c0
66 Test 0xbfc0
67
68 In general, the vectors address is 0xffc0. This can be overriden
69 with the '-defsym vectors_addr=0xbfc0' ld option.
70
71 Note: for the bootstrap mode, the interrupt vectors are at 0xbfc0 but
72 they are redirected to 0x00c0 by the internal PROM. Application's vectors
73 must also consist of jump instructions (see Motorola's manual). */
74
75 PROVIDE (_vectors_addr = DEFINED (vectors_addr) ? vectors_addr : 0xffc0);
76 .vectors DEFINED (vectors_addr) ? vectors_addr : 0xffc0 :
77 {
78 *(.vectors)
79 }"
80
81#
82# We provide two emulations: a fixed on that defines some memory banks
83# and a configurable one that includes a user provided memory definition.
84#
85case $GENERIC_BOARD in
86 yes|1|YES)
87 MEMORY_DEF="
88/* Get memory banks definition from some user configuration file.
89 This file must be located in some linker directory (search path
90 with -L<dir>). See fixed memory banks emulation script. */
91INCLUDE memory.x;
92"
93 ;;
94 *)
95MEMORY_DEF="
96/* Fixed definition of the available memory banks.
97 See generic emulation script for a user defined configuration. */
98MEMORY
99{
100 page0 (rwx) : ORIGIN = 0x0, LENGTH = 256
101 text (rx) : ORIGIN = ${ROM_START_ADDR}, LENGTH = ${ROM_SIZE}
102 data : ORIGIN = ${RAM_START_ADDR}, LENGTH = ${RAM_SIZE}
a66c0f2c 103 eeprom : ORIGIN = ${EEPROM_START_ADDR}, LENGTH = ${EEPROM_SIZE}
60bcf0fa
NC
104}
105
106/* Setup the stack on the top of the data memory bank. */
107PROVIDE (_stack = ${RAM_START_ADDR} + ${RAM_SIZE} - 1);
108"
109 ;;
110esac
111
112STARTUP_CODE="
113 /* Startup code. */
114 *(.install0) /* Section should setup the stack pointer. */
115 *(.install1) /* Place holder for applications. */
116 *(.install2) /* Optional installation of data sections in RAM. */
117 *(.install3) /* Place holder for applications. */
118 *(.install4) /* Section that calls the main. */
119"
120
de0b1853
SC
121FINISH_CODE="
122 /* Finish code. */
123 *(.fini0) /* Beginning of finish code (_exit symbol). */
124 *(.fini1) /* Place holder for applications. */
125 *(.fini2) /* C++ destructors. */
126 *(.fini3) /* Place holder for applications. */
127 *(.fini4) /* Runtime exit. */
128"
129
60bcf0fa
NC
130PRE_COMPUTE_DATA_SIZE="
131/* SCz: this does not work yet... This is supposed to force the loading
132 of _map_data.o (from libgcc.a) when the .data section is not empty.
133 By doing so, this should bring the code that copies the .data section
134 from ROM to RAM at init time.
135
136 ___pre_comp_data_size = SIZEOF(.data);
137 __install_data_sections = ___pre_comp_data_size > 0 ?
138 __map_data_sections : 0;
139*/
140"
141
142INSTALL_RELOC="
143 .install0 0 : { *(.install0) }
144 .install1 0 : { *(.install1) }
145 .install2 0 : { *(.install2) }
146 .install3 0 : { *(.install3) }
147 .install4 0 : { *(.install4) }
148"
149
de0b1853
SC
150FINISH_RELOC="
151 .fini0 0 : { *(.fini0) }
152 .fini1 0 : { *(.fini1) }
153 .fini2 0 : { *(.fini2) }
154 .fini3 0 : { *(.fini3) }
155 .fini4 0 : { *(.fini4) }
156"
157
60bcf0fa
NC
158BSS_DATA_RELOC="
159 .data1 0 : { *(.data1) }
160
161 /* We want the small data sections together, so single-instruction offsets
162 can access them all, and initialized data all before uninitialized, so
163 we can shorten the on-disk segment size. */
164 .sdata 0 : { *(.sdata) }
165 .sbss 0 : { *(.sbss) }
166 .scommon 0 : { *(.scommon) }
167"
168
a66c0f2c
SC
169SOFT_REGS_RELOC="
170 .softregs 0 : { *(.softregs) }
171"
172
60bcf0fa
NC
173cat <<EOF
174${RELOCATING+/* Linker script for 68HC11 executable (PROM). */}
175${RELOCATING-/* Linker script for 68HC11 object file (ld -r). */}
176
177OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
178 "${LITTLE_OUTPUT_FORMAT}")
179OUTPUT_ARCH(${OUTPUT_ARCH})
180ENTRY(${ENTRY})
181
182${RELOCATING+${LIB_SEARCH_DIRS}}
183${RELOCATING+${EXECUTABLE_SYMBOLS}}
184${RELOCATING+${MEMORY_DEF}}
185
186SECTIONS
187{
188 .hash ${RELOCATING-0} : { *(.hash) }
189 .dynsym ${RELOCATING-0} : { *(.dynsym) }
190 .dynstr ${RELOCATING-0} : { *(.dynstr) }
191 .gnu.version ${RELOCATING-0} : { *(.gnu.version) }
192 .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) }
193 .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) }
194
de0b1853
SC
195 .rel.text ${RELOCATING-0} :
196 {
197 *(.rel.text)
198 ${RELOCATING+*(.rel.text.*)}
199 ${RELOCATING+*(.rel.gnu.linkonce.t.*)}
200 }
201 .rela.text ${RELOCATING-0} :
202 {
203 *(.rela.text)
204 ${RELOCATING+*(.rela.text.*)}
205 ${RELOCATING+*(.rela.gnu.linkonce.t.*)}
206 }
207 .rel.data ${RELOCATING-0} :
208 {
209 *(.rel.data)
210 ${RELOCATING+*(.rel.data.*)}
211 ${RELOCATING+*(.rel.gnu.linkonce.d.*)}
212 }
213 .rela.data ${RELOCATING-0} :
214 {
215 *(.rela.data)
216 ${RELOCATING+*(.rela.data.*)}
217 ${RELOCATING+*(.rela.gnu.linkonce.d.*)}
218 }
219 .rel.rodata ${RELOCATING-0} :
220 {
221 *(.rel.rodata)
222 ${RELOCATING+*(.rel.rodata.*)}
223 ${RELOCATING+*(.rel.gnu.linkonce.r.*)}
224 }
225 .rela.rodata ${RELOCATING-0} :
226 {
227 *(.rela.rodata)
228 ${RELOCATING+*(.rela.rodata.*)}
229 ${RELOCATING+*(.rela.gnu.linkonce.r.*)}
230 }
231 .rel.sdata ${RELOCATING-0} :
232 {
233 *(.rel.sdata)
234 ${RELOCATING+*(.rel.sdata.*)}
235 ${RELOCATING+*(.rel.gnu.linkonce.s.*)}
236 }
237 .rela.sdata ${RELOCATING-0} :
238 {
239 *(.rela.sdata)
240 ${RELOCATING+*(.rela.sdata.*)}
241 ${RELOCATING+*(.rela.gnu.linkonce.s.*)}
242 }
243 .rel.sbss ${RELOCATING-0} :
244 {
245 *(.rel.sbss)
246 ${RELOCATING+*(.rel.sbss.*)}
247 ${RELOCATING+*(.rel.gnu.linkonce.sb.*)}
248 }
249 .rela.sbss ${RELOCATING-0} :
250 {
251 *(.rela.sbss)
252 ${RELOCATING+*(.rela.sbss.*)}
253 ${RELOCATING+*(.rel.gnu.linkonce.sb.*)}
254 }
255 .rel.bss ${RELOCATING-0} :
256 {
257 *(.rel.bss)
258 ${RELOCATING+*(.rel.bss.*)}
259 ${RELOCATING+*(.rel.gnu.linkonce.b.*)}
260 }
261 .rela.bss ${RELOCATING-0} :
262 {
263 *(.rela.bss)
264 ${RELOCATING+*(.rela.bss.*)}
265 ${RELOCATING+*(.rela.gnu.linkonce.b.*)}
266 }
60bcf0fa
NC
267 .rela.stext ${RELOCATING-0} : { *(.rela.stest) }
268 .rela.etext ${RELOCATING-0} : { *(.rela.etest) }
269 .rela.sdata ${RELOCATING-0} : { *(.rela.sdata) }
270 .rela.edata ${RELOCATING-0} : { *(.rela.edata) }
271 .rela.eit_v ${RELOCATING-0} : { *(.rela.eit_v) }
60bcf0fa
NC
272 .rela.ebss ${RELOCATING-0} : { *(.rela.ebss) }
273 .rela.srodata ${RELOCATING-0} : { *(.rela.srodata) }
274 .rela.erodata ${RELOCATING-0} : { *(.rela.erodata) }
275 .rela.got ${RELOCATING-0} : { *(.rela.got) }
276 .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
277 .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
278 .rela.init ${RELOCATING-0} : { *(.rela.init) }
279 .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
60bcf0fa
NC
280 .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
281
60bcf0fa
NC
282 .rel.stext ${RELOCATING-0} : { *(.rel.stest) }
283 .rel.etext ${RELOCATING-0} : { *(.rel.etest) }
284 .rel.sdata ${RELOCATING-0} : { *(.rel.sdata) }
285 .rel.edata ${RELOCATING-0} : { *(.rel.edata) }
60bcf0fa
NC
286 .rel.ebss ${RELOCATING-0} : { *(.rel.ebss) }
287 .rel.eit_v ${RELOCATING-0} : { *(.rel.eit_v) }
288 .rel.srodata ${RELOCATING-0} : { *(.rel.srodata) }
289 .rel.erodata ${RELOCATING-0} : { *(.rel.erodata) }
290 .rel.got ${RELOCATING-0} : { *(.rel.got) }
291 .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
292 .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
293 .rel.init ${RELOCATING-0} : { *(.rel.init) }
294 .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
60bcf0fa
NC
295 .rel.plt ${RELOCATING-0} : { *(.rel.plt) }
296
297 /* Concatenate .page0 sections. Put them in the page0 memory bank
298 unless we are creating a relocatable file. */
299 .page0 :
300 {
301 *(.page0)
a66c0f2c 302 ${RELOCATING+*(.softregs)}
60bcf0fa
NC
303 } ${RELOCATING+ > page0}
304
305 /* Start of text section. */
306 .stext ${RELOCATING-0} :
307 {
308 *(.stext)
309 } ${RELOCATING+ > ${TEXT_MEMORY}}
310
311 .init ${RELOCATING-0} :
312 {
313 *(.init)
314 } ${RELOCATING+=${NOP-0}}
315
316 ${RELOCATING-${INSTALL_RELOC}}
de0b1853 317 ${RELOCATING-${FINISH_RELOC}}
60bcf0fa
NC
318
319 .text ${RELOCATING-0}:
320 {
321 /* Put startup code at beginning so that _start keeps same address. */
322 ${RELOCATING+${STARTUP_CODE}}
323
324 ${RELOCATING+*(.init)}
325 *(.text)
de0b1853 326 ${RELOCATING+*(.text.*)}
60bcf0fa
NC
327 /* .gnu.warning sections are handled specially by elf32.em. */
328 *(.gnu.warning)
de0b1853
SC
329 ${RELOCATING+*(.gnu.linkonce.t.*)}
330
331 ${RELOCATING+${FINISH_CODE}}
60bcf0fa
NC
332
333 ${RELOCATING+_etext = .;}
334 ${RELOCATING+PROVIDE (etext = .);}
335
336 } ${RELOCATING+ > ${TEXT_MEMORY}}
337
338 .eh_frame ${RELOCATING-0} :
339 {
24098abb 340 KEEP (*(.eh_frame))
60bcf0fa
NC
341 } ${RELOCATING+ > ${TEXT_MEMORY}}
342
343 .rodata ${RELOCATING-0} :
344 {
345 *(.rodata)
de0b1853
SC
346 ${RELOCATING+*(.rodata.*)}
347 ${RELOCATING+*(.gnu.linkonce.r*)}
60bcf0fa
NC
348 } ${RELOCATING+ > ${TEXT_MEMORY}}
349
350 .rodata1 ${RELOCATING-0} :
351 {
352 *(.rodata1)
353 } ${RELOCATING+ > ${TEXT_MEMORY}}
354
de0b1853
SC
355 /* Constructor and destructor tables are in ROM. */
356 ${RELOCATING+${CTOR}}
357 ${RELOCATING+${DTOR}}
358
24098abb
RH
359 .jcr ${RELOCATING-0} :
360 {
361 KEEP (*(.jcr))
362 } ${RELOCATING+ > ${TEXT_MEMORY}}
363
60bcf0fa
NC
364 /* Start of the data section image in ROM. */
365 ${RELOCATING+__data_image = .;}
366 ${RELOCATING+PROVIDE (__data_image = .);}
367
368 /* All read-only sections that normally go in PROM must be above.
369 We construct the DATA image section in PROM at end of all these
370 read-only sections. The data image must be copied at init time.
371 Refer to GNU ld, Section 3.6.8.2 Output Section LMA. */
372 .data ${RELOCATING-0} : ${RELOCATING+AT (__data_image)}
373 {
374 ${RELOCATING+__data_section_start = .;}
375 ${RELOCATING+PROVIDE (__data_section_start = .);}
376
377 ${RELOCATING+${DATA_START_SYMBOLS}}
378 ${RELOCATING+*(.sdata)}
379 *(.data)
de0b1853 380 ${RELOCATING+*(.data.*)}
60bcf0fa 381 ${RELOCATING+*(.data1)}
de0b1853 382 ${RELOCATING+*(.gnu.linkonce.d.*)}
60bcf0fa
NC
383 ${CONSTRUCTING+CONSTRUCTORS}
384
385 ${RELOCATING+_edata = .;}
386 ${RELOCATING+PROVIDE (edata = .);}
387 } ${RELOCATING+ > ${DATA_MEMORY}}
388
389 ${RELOCATING+__data_section_size = SIZEOF(.data);}
390 ${RELOCATING+PROVIDE (__data_section_size = SIZEOF(.data));}
391 ${RELOCATING+__data_image_end = __data_image + __data_section_size;}
392
393 ${RELOCATING+${PRE_COMPUTE_DATA_SIZE}}
394
395 /* .install ${RELOCATING-0}:
396 {
397 . = _data_image_end;
398 } ${RELOCATING+ > ${TEXT_MEMORY}} */
399
400 /* Relocation for some bss and data sections. */
401 ${RELOCATING-${BSS_DATA_RELOC}}
a66c0f2c 402 ${RELOCATING-${SOFT_REGS_RELOC}}
60bcf0fa
NC
403
404 .bss ${RELOCATING-0} :
405 {
406 ${RELOCATING+__bss_start = .;}
407 ${RELOCATING+*(.sbss)}
408 ${RELOCATING+*(.scommon)}
409
410 *(.dynbss)
411 *(.bss)
de0b1853
SC
412 ${RELOCATING+*(.bss.*)}
413 ${RELOCATING+*(.gnu.linkonce.b.*)}
60bcf0fa
NC
414 *(COMMON)
415 ${RELOCATING+PROVIDE (_end = .);}
416 } ${RELOCATING+ > ${DATA_MEMORY}}
236d5abf
NC
417 ${RELOCATING+__bss_size = SIZEOF(.bss);}
418 ${RELOCATING+PROVIDE (__bss_size = SIZEOF(.bss));}
60bcf0fa 419
a66c0f2c
SC
420 .eeprom ${RELOCATING-0} :
421 {
422 *(.eeprom)
423 *(.eeprom.*)
424 } ${RELOCATING+ > ${EEPROM_MEMORY}}
425
60bcf0fa
NC
426 ${RELOCATING+${VECTORS}}
427
428 /* Stabs debugging sections. */
429 .stab 0 : { *(.stab) }
430 .stabstr 0 : { *(.stabstr) }
431 .stab.excl 0 : { *(.stab.excl) }
432 .stab.exclstr 0 : { *(.stab.exclstr) }
433 .stab.index 0 : { *(.stab.index) }
434 .stab.indexstr 0 : { *(.stab.indexstr) }
435
436 .comment 0 : { *(.comment) }
437
438 /* DWARF debug sections.
439 Symbols in the DWARF debugging sections are relative to the beginning
440 of the section so we begin them at 0.
441 Treatment of DWARF debug section must be at end of the linker
442 script to avoid problems when there are undefined symbols. It's necessary
443 to avoid that the DWARF section is relocated before such undefined
444 symbols are found. */
445
446 /* DWARF 1 */
447 .debug 0 : { *(.debug) }
448 .line 0 : { *(.line) }
449
450 /* GNU DWARF 1 extensions */
451 .debug_srcinfo 0 : { *(.debug_srcinfo) }
452 .debug_sfnames 0 : { *(.debug_sfnames) }
453
454 /* DWARF 1.1 and DWARF 2 */
455 .debug_aranges 0 : { *(.debug_aranges) }
456 .debug_pubnames 0 : { *(.debug_pubnames) }
457
458 /* DWARF 2 */
3a9d486c 459 .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
60bcf0fa
NC
460 .debug_abbrev 0 : { *(.debug_abbrev) }
461 .debug_line 0 : { *(.debug_line) }
462 .debug_frame 0 : { *(.debug_frame) }
463 .debug_str 0 : { *(.debug_str) }
464 .debug_loc 0 : { *(.debug_loc) }
465 .debug_macinfo 0 : { *(.debug_macinfo) }
466}
467EOF
This page took 0.12748 seconds and 4 git commands to generate.