2 # Unusual variables checked by this code:
3 # NOP - four byte opcode for no-op (defaults to 0)
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
12 # DATA_START_SYMBOLS - symbols that appear at the start of the
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.
18 # When adding sections, do note that the names of some sections are used
19 # when specifying the start address of the next.
21 test -z "$ENTRY" && ENTRY=_start
22 test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
23 test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
24 if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi
25 test "$LD_FLAG" = "N" && DATA_ADDR=.
27 CTOR=".ctors ${CONSTRUCTING-0} :
29 ${CONSTRUCTING+ PROVIDE (__CTOR_LIST__ = .); }
30 ${CONSTRUCTING+${CTOR_START}}
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
37 KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
38 KEEP (*(SORT(.ctors.*)))
41 ${CONSTRUCTING+${CTOR_END}}
42 ${CONSTRUCTING+ PROVIDE(__CTOR_END__ = .); }
43 } ${RELOCATING+ > ${TEXT_MEMORY}}"
45 DTOR=" .dtors ${CONSTRUCTING-0} :
47 ${CONSTRUCTING+ PROVIDE(__DTOR_LIST__ = .); }
50 KEEP (*crtbegin.o(.dtors))
51 KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
52 KEEP (*(SORT(.dtors.*)))
54 ${CONSTRUCTING+ PROVIDE(__DTOR_END__ = .); }
55 } ${RELOCATING+ > ${TEXT_MEMORY}}"
59 /* If the 'vectors_addr' symbol is defined, it indicates the start address
60 of interrupt vectors. This depends on the 68HC11 operating mode:
68 In general, the vectors address is 0xffc0. This can be overriden
69 with the '-defsym vectors_addr=0xbfc0' ld option.
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). */
75 PROVIDE (_vectors_addr = DEFINED (vectors_addr) ? vectors_addr : 0xffc0);
76 .vectors DEFINED (vectors_addr) ? vectors_addr : 0xffc0 :
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.
85 case $GENERIC_BOARD in
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. */
96 /* Fixed definition of the available memory banks.
97 See generic emulation script for a user defined configuration. */
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}
103 eeprom : ORIGIN = ${EEPROM_START_ADDR}, LENGTH = ${EEPROM_SIZE}
106 /* Setup the stack on the top of the data memory bank. */
107 PROVIDE (_stack = ${RAM_START_ADDR} + ${RAM_SIZE} - 1);
114 KEEP (*(.install0)) /* Section should setup the stack pointer. */
115 KEEP (*(.install1)) /* Place holder for applications. */
116 KEEP (*(.install2)) /* Optional installation of data sections in RAM. */
117 KEEP (*(.install3)) /* Place holder for applications. */
118 KEEP (*(.install4)) /* Section that calls the main. */
123 KEEP (*(.fini0)) /* Beginning of finish code (_exit symbol). */
124 KEEP (*(.fini1)) /* Place holder for applications. */
125 KEEP (*(.fini2)) /* C++ destructors. */
126 KEEP (*(.fini3)) /* Place holder for applications. */
127 KEEP (*(.fini4)) /* Runtime exit. */
130 PRE_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.
136 ___pre_comp_data_size = SIZEOF(.data);
137 __install_data_sections = ___pre_comp_data_size > 0 ?
138 __map_data_sections : 0;
143 .install0 0 : { *(.install0) }
144 .install1 0 : { *(.install1) }
145 .install2 0 : { *(.install2) }
146 .install3 0 : { *(.install3) }
147 .install4 0 : { *(.install4) }
151 .fini0 0 : { *(.fini0) }
152 .fini1 0 : { *(.fini1) }
153 .fini2 0 : { *(.fini2) }
154 .fini3 0 : { *(.fini3) }
155 .fini4 0 : { *(.fini4) }
159 .data1 0 : { *(.data1) }
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) }
170 .softregs 0 : { *(.softregs) }
174 ${RELOCATING+/* Linker script for 68HC11 executable (PROM). */}
175 ${RELOCATING-/* Linker script for 68HC11 object file (ld -r). */}
177 OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
178 "${LITTLE_OUTPUT_FORMAT}")
179 OUTPUT_ARCH(${OUTPUT_ARCH})
182 ${RELOCATING+${LIB_SEARCH_DIRS}}
183 ${RELOCATING+${EXECUTABLE_SYMBOLS}}
184 ${RELOCATING+${MEMORY_DEF}}
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) }
195 .rel.text ${RELOCATING-0} :
198 ${RELOCATING+*(.rel.text.*)}
199 ${RELOCATING+*(.rel.gnu.linkonce.t.*)}
201 .rela.text ${RELOCATING-0} :
204 ${RELOCATING+*(.rela.text.*)}
205 ${RELOCATING+*(.rela.gnu.linkonce.t.*)}
207 .rel.data ${RELOCATING-0} :
210 ${RELOCATING+*(.rel.data.*)}
211 ${RELOCATING+*(.rel.gnu.linkonce.d.*)}
213 .rela.data ${RELOCATING-0} :
216 ${RELOCATING+*(.rela.data.*)}
217 ${RELOCATING+*(.rela.gnu.linkonce.d.*)}
219 .rel.rodata ${RELOCATING-0} :
222 ${RELOCATING+*(.rel.rodata.*)}
223 ${RELOCATING+*(.rel.gnu.linkonce.r.*)}
225 .rela.rodata ${RELOCATING-0} :
228 ${RELOCATING+*(.rela.rodata.*)}
229 ${RELOCATING+*(.rela.gnu.linkonce.r.*)}
231 .rel.sdata ${RELOCATING-0} :
234 ${RELOCATING+*(.rel.sdata.*)}
235 ${RELOCATING+*(.rel.gnu.linkonce.s.*)}
237 .rela.sdata ${RELOCATING-0} :
240 ${RELOCATING+*(.rela.sdata.*)}
241 ${RELOCATING+*(.rela.gnu.linkonce.s.*)}
243 .rel.sbss ${RELOCATING-0} :
246 ${RELOCATING+*(.rel.sbss.*)}
247 ${RELOCATING+*(.rel.gnu.linkonce.sb.*)}
249 .rela.sbss ${RELOCATING-0} :
252 ${RELOCATING+*(.rela.sbss.*)}
253 ${RELOCATING+*(.rel.gnu.linkonce.sb.*)}
255 .rel.bss ${RELOCATING-0} :
258 ${RELOCATING+*(.rel.bss.*)}
259 ${RELOCATING+*(.rel.gnu.linkonce.b.*)}
261 .rela.bss ${RELOCATING-0} :
264 ${RELOCATING+*(.rela.bss.*)}
265 ${RELOCATING+*(.rela.gnu.linkonce.b.*)}
267 .rel.stext ${RELOCATING-0} : { *(.rel.stest) }
268 .rela.stext ${RELOCATING-0} : { *(.rela.stest) }
269 .rel.etext ${RELOCATING-0} : { *(.rel.etest) }
270 .rela.etext ${RELOCATING-0} : { *(.rela.etest) }
271 .rel.sdata ${RELOCATING-0} : { *(.rel.sdata) }
272 .rela.sdata ${RELOCATING-0} : { *(.rela.sdata) }
273 .rel.edata ${RELOCATING-0} : { *(.rel.edata) }
274 .rela.edata ${RELOCATING-0} : { *(.rela.edata) }
275 .rel.eit_v ${RELOCATING-0} : { *(.rel.eit_v) }
276 .rela.eit_v ${RELOCATING-0} : { *(.rela.eit_v) }
277 .rel.ebss ${RELOCATING-0} : { *(.rel.ebss) }
278 .rela.ebss ${RELOCATING-0} : { *(.rela.ebss) }
279 .rel.srodata ${RELOCATING-0} : { *(.rel.srodata) }
280 .rela.srodata ${RELOCATING-0} : { *(.rela.srodata) }
281 .rel.erodata ${RELOCATING-0} : { *(.rel.erodata) }
282 .rela.erodata ${RELOCATING-0} : { *(.rela.erodata) }
283 .rel.got ${RELOCATING-0} : { *(.rel.got) }
284 .rela.got ${RELOCATING-0} : { *(.rela.got) }
285 .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
286 .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
287 .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
288 .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
289 .rel.init ${RELOCATING-0} : { *(.rel.init) }
290 .rela.init ${RELOCATING-0} : { *(.rela.init) }
291 .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
292 .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
293 .rel.plt ${RELOCATING-0} : { *(.rel.plt) }
294 .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
296 /* Concatenate .page0 sections. Put them in the page0 memory bank
297 unless we are creating a relocatable file. */
301 ${RELOCATING+*(.softregs)}
302 } ${RELOCATING+ > page0}
304 /* Start of text section. */
305 .stext ${RELOCATING-0} :
308 } ${RELOCATING+ > ${TEXT_MEMORY}}
310 .init ${RELOCATING-0} :
313 } ${RELOCATING+=${NOP-0}}
315 ${RELOCATING-${INSTALL_RELOC}}
316 ${RELOCATING-${FINISH_RELOC}}
318 .text ${RELOCATING-0}:
320 /* Put startup code at beginning so that _start keeps same address. */
321 ${RELOCATING+${STARTUP_CODE}}
323 ${RELOCATING+*(.init)}
325 ${RELOCATING+*(.text.*)}
326 /* .gnu.warning sections are handled specially by elf32.em. */
328 ${RELOCATING+*(.gnu.linkonce.t.*)}
330 ${RELOCATING+${FINISH_CODE}}
332 ${RELOCATING+_etext = .;}
333 ${RELOCATING+PROVIDE (etext = .);}
335 } ${RELOCATING+ > ${TEXT_MEMORY}}
337 .eh_frame ${RELOCATING-0} :
340 } ${RELOCATING+ > ${TEXT_MEMORY}}
342 .rodata ${RELOCATING-0} :
345 ${RELOCATING+*(.rodata.*)}
346 ${RELOCATING+*(.gnu.linkonce.r*)}
347 } ${RELOCATING+ > ${TEXT_MEMORY}}
349 .rodata1 ${RELOCATING-0} :
352 } ${RELOCATING+ > ${TEXT_MEMORY}}
354 /* Constructor and destructor tables are in ROM. */
355 ${RELOCATING+${CTOR}}
356 ${RELOCATING+${DTOR}}
358 .jcr ${RELOCATING-0} :
361 } ${RELOCATING+ > ${TEXT_MEMORY}}
363 /* Start of the data section image in ROM. */
364 ${RELOCATING+__data_image = .;}
365 ${RELOCATING+PROVIDE (__data_image = .);}
367 /* All read-only sections that normally go in PROM must be above.
368 We construct the DATA image section in PROM at end of all these
369 read-only sections. The data image must be copied at init time.
370 Refer to GNU ld, Section 3.6.8.2 Output Section LMA. */
371 .data ${RELOCATING-0} : ${RELOCATING+AT (__data_image)}
373 ${RELOCATING+__data_section_start = .;}
374 ${RELOCATING+PROVIDE (__data_section_start = .);}
376 ${RELOCATING+${DATA_START_SYMBOLS}}
377 ${RELOCATING+*(.sdata)}
379 ${RELOCATING+*(.data.*)}
380 ${RELOCATING+*(.data1)}
381 ${RELOCATING+*(.gnu.linkonce.d.*)}
382 ${CONSTRUCTING+CONSTRUCTORS}
384 ${RELOCATING+_edata = .;}
385 ${RELOCATING+PROVIDE (edata = .);}
386 } ${RELOCATING+ > ${DATA_MEMORY}}
388 ${RELOCATING+__data_section_size = SIZEOF(.data);}
389 ${RELOCATING+PROVIDE (__data_section_size = SIZEOF(.data));}
390 ${RELOCATING+__data_image_end = __data_image + __data_section_size;}
392 ${RELOCATING+${PRE_COMPUTE_DATA_SIZE}}
394 /* .install ${RELOCATING-0}:
397 } ${RELOCATING+ > ${TEXT_MEMORY}} */
399 /* Relocation for some bss and data sections. */
400 ${RELOCATING-${BSS_DATA_RELOC}}
401 ${RELOCATING-${SOFT_REGS_RELOC}}
403 .bss ${RELOCATING-0} :
405 ${RELOCATING+__bss_start = .;}
406 ${RELOCATING+*(.sbss)}
407 ${RELOCATING+*(.scommon)}
411 ${RELOCATING+*(.bss.*)}
412 ${RELOCATING+*(.gnu.linkonce.b.*)}
414 ${RELOCATING+PROVIDE (_end = .);}
415 } ${RELOCATING+ > ${DATA_MEMORY}}
416 ${RELOCATING+__bss_size = SIZEOF(.bss);}
417 ${RELOCATING+PROVIDE (__bss_size = SIZEOF(.bss));}
419 .eeprom ${RELOCATING-0} :
423 } ${RELOCATING+ > ${EEPROM_MEMORY}}
425 ${RELOCATING+${VECTORS}}
427 /* Stabs debugging sections. */
428 .stab 0 : { *(.stab) }
429 .stabstr 0 : { *(.stabstr) }
430 .stab.excl 0 : { *(.stab.excl) }
431 .stab.exclstr 0 : { *(.stab.exclstr) }
432 .stab.index 0 : { *(.stab.index) }
433 .stab.indexstr 0 : { *(.stab.indexstr) }
435 .comment 0 : { *(.comment) }
437 /* DWARF debug sections.
438 Symbols in the DWARF debugging sections are relative to the beginning
439 of the section so we begin them at 0.
440 Treatment of DWARF debug section must be at end of the linker
441 script to avoid problems when there are undefined symbols. It's necessary
442 to avoid that the DWARF section is relocated before such undefined
443 symbols are found. */
446 .debug 0 : { *(.debug) }
447 .line 0 : { *(.line) }
449 /* GNU DWARF 1 extensions */
450 .debug_srcinfo 0 : { *(.debug_srcinfo) }
451 .debug_sfnames 0 : { *(.debug_sfnames) }
453 /* DWARF 1.1 and DWARF 2 */
454 .debug_aranges 0 : { *(.debug_aranges) }
455 .debug_pubnames 0 : { *(.debug_pubnames) }
458 .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
459 .debug_abbrev 0 : { *(.debug_abbrev) }
460 .debug_line 0 : { *(.debug_line) }
461 .debug_frame 0 : { *(.debug_frame) }
462 .debug_str 0 : { *(.debug_str) }
463 .debug_loc 0 : { *(.debug_loc) }
464 .debug_macinfo 0 : { *(.debug_macinfo) }