2 # Unusual variables checked by this code:
3 # NOP - two 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+ __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+ __CTOR_END__ = .; }
43 } ${RELOCATING+ > ${DATA_MEMORY}}"
45 DTOR=" .dtors ${CONSTRUCTING-0} :
47 ${CONSTRUCTING+ __DTOR_LIST__ = .; }
50 KEEP (*crtbegin.o(.dtors))
51 KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
52 KEEP (*(SORT(.dtors.*)))
54 ${CONSTRUCTING+ __DTOR_END__ = .; }
55 } ${RELOCATING+ > ${DATA_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}
105 /* Setup the stack on the top of the data memory bank. */
106 PROVIDE (_stack = ${RAM_START_ADDR} + ${RAM_SIZE} - 1);
113 *(.install0) /* Section should setup the stack pointer. */
114 *(.install1) /* Place holder for applications. */
115 *(.install2) /* Optional installation of data sections in RAM. */
116 *(.install3) /* Place holder for applications. */
117 *(.install4) /* Section that calls the main. */
120 PRE_COMPUTE_DATA_SIZE="
121 /* SCz: this does not work yet... This is supposed to force the loading
122 of _map_data.o (from libgcc.a) when the .data section is not empty.
123 By doing so, this should bring the code that copies the .data section
124 from ROM to RAM at init time.
126 ___pre_comp_data_size = SIZEOF(.data);
127 __install_data_sections = ___pre_comp_data_size > 0 ?
128 __map_data_sections : 0;
133 .install0 0 : { *(.install0) }
134 .install1 0 : { *(.install1) }
135 .install2 0 : { *(.install2) }
136 .install3 0 : { *(.install3) }
137 .install4 0 : { *(.install4) }
141 .data1 0 : { *(.data1) }
143 /* We want the small data sections together, so single-instruction offsets
144 can access them all, and initialized data all before uninitialized, so
145 we can shorten the on-disk segment size. */
146 .sdata 0 : { *(.sdata) }
147 .sbss 0 : { *(.sbss) }
148 .scommon 0 : { *(.scommon) }
152 ${RELOCATING+/* Linker script for 68HC11 executable (PROM). */}
153 ${RELOCATING-/* Linker script for 68HC11 object file (ld -r). */}
155 OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
156 "${LITTLE_OUTPUT_FORMAT}")
157 OUTPUT_ARCH(${OUTPUT_ARCH})
160 ${RELOCATING+${LIB_SEARCH_DIRS}}
161 ${RELOCATING+${EXECUTABLE_SYMBOLS}}
162 ${RELOCATING+${MEMORY_DEF}}
166 .hash ${RELOCATING-0} : { *(.hash) }
167 .dynsym ${RELOCATING-0} : { *(.dynsym) }
168 .dynstr ${RELOCATING-0} : { *(.dynstr) }
169 .gnu.version ${RELOCATING-0} : { *(.gnu.version) }
170 .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) }
171 .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) }
173 .rela.text ${RELOCATING-0} : { *(.rela.text) *(.rela.gnu.linkonce.t*) }
174 .rela.data ${RELOCATING-0} : { *(.rela.data) *(.rela.gnu.linkonce.d*) }
175 .rela.rodata ${RELOCATING-0} : { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
176 .rela.stext ${RELOCATING-0} : { *(.rela.stest) }
177 .rela.etext ${RELOCATING-0} : { *(.rela.etest) }
178 .rela.sdata ${RELOCATING-0} : { *(.rela.sdata) }
179 .rela.edata ${RELOCATING-0} : { *(.rela.edata) }
180 .rela.eit_v ${RELOCATING-0} : { *(.rela.eit_v) }
181 .rela.sbss ${RELOCATING-0} : { *(.rela.sbss) }
182 .rela.ebss ${RELOCATING-0} : { *(.rela.ebss) }
183 .rela.srodata ${RELOCATING-0} : { *(.rela.srodata) }
184 .rela.erodata ${RELOCATING-0} : { *(.rela.erodata) }
185 .rela.got ${RELOCATING-0} : { *(.rela.got) }
186 .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
187 .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
188 .rela.init ${RELOCATING-0} : { *(.rela.init) }
189 .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
190 .rela.bss ${RELOCATING-0} : { *(.rela.bss) }
191 .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
193 .rel.data ${RELOCATING-0} : { *(.rel.data) *(.rel.gnu.linkonce.d*) }
194 .rel.rodata ${RELOCATING-0} : { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
195 .rel.stext ${RELOCATING-0} : { *(.rel.stest) }
196 .rel.etext ${RELOCATING-0} : { *(.rel.etest) }
197 .rel.sdata ${RELOCATING-0} : { *(.rel.sdata) }
198 .rel.edata ${RELOCATING-0} : { *(.rel.edata) }
199 .rel.sbss ${RELOCATING-0} : { *(.rel.sbss) }
200 .rel.ebss ${RELOCATING-0} : { *(.rel.ebss) }
201 .rel.eit_v ${RELOCATING-0} : { *(.rel.eit_v) }
202 .rel.srodata ${RELOCATING-0} : { *(.rel.srodata) }
203 .rel.erodata ${RELOCATING-0} : { *(.rel.erodata) }
204 .rel.got ${RELOCATING-0} : { *(.rel.got) }
205 .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
206 .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
207 .rel.init ${RELOCATING-0} : { *(.rel.init) }
208 .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
209 .rel.bss ${RELOCATING-0} : { *(.rel.bss) }
210 .rel.plt ${RELOCATING-0} : { *(.rel.plt) }
212 /* Concatenate .page0 sections. Put them in the page0 memory bank
213 unless we are creating a relocatable file. */
217 } ${RELOCATING+ > page0}
219 /* Start of text section. */
220 .stext ${RELOCATING-0} :
223 } ${RELOCATING+ > ${TEXT_MEMORY}}
225 .init ${RELOCATING-0} :
228 } ${RELOCATING+=${NOP-0}}
230 ${RELOCATING-${INSTALL_RELOC}}
232 .text ${RELOCATING-0}:
234 /* Put startup code at beginning so that _start keeps same address. */
235 ${RELOCATING+${STARTUP_CODE}}
237 ${RELOCATING+*(.init)}
240 /* .gnu.warning sections are handled specially by elf32.em. */
244 ${RELOCATING+_etext = .;}
245 ${RELOCATING+PROVIDE (etext = .);}
247 } ${RELOCATING+ > ${TEXT_MEMORY}}
249 .eh_frame ${RELOCATING-0} :
252 } ${RELOCATING+ > ${TEXT_MEMORY}}
254 .rodata ${RELOCATING-0} :
258 } ${RELOCATING+ > ${TEXT_MEMORY}}
260 .rodata1 ${RELOCATING-0} :
263 } ${RELOCATING+ > ${TEXT_MEMORY}}
265 /* Start of the data section image in ROM. */
266 ${RELOCATING+__data_image = .;}
267 ${RELOCATING+PROVIDE (__data_image = .);}
269 /* All read-only sections that normally go in PROM must be above.
270 We construct the DATA image section in PROM at end of all these
271 read-only sections. The data image must be copied at init time.
272 Refer to GNU ld, Section 3.6.8.2 Output Section LMA. */
273 .data ${RELOCATING-0} : ${RELOCATING+AT (__data_image)}
275 ${RELOCATING+__data_section_start = .;}
276 ${RELOCATING+PROVIDE (__data_section_start = .);}
278 ${RELOCATING+${DATA_START_SYMBOLS}}
279 ${RELOCATING+*(.sdata)}
281 ${RELOCATING+*(.data1)}
283 ${CONSTRUCTING+CONSTRUCTORS}
285 ${RELOCATING+_edata = .;}
286 ${RELOCATING+PROVIDE (edata = .);}
287 } ${RELOCATING+ > ${DATA_MEMORY}}
289 ${RELOCATING+__data_section_size = SIZEOF(.data);}
290 ${RELOCATING+PROVIDE (__data_section_size = SIZEOF(.data));}
291 ${RELOCATING+__data_image_end = __data_image + __data_section_size;}
293 ${RELOCATING+${PRE_COMPUTE_DATA_SIZE}}
295 /* .install ${RELOCATING-0}:
298 } ${RELOCATING+ > ${TEXT_MEMORY}} */
300 /* Relocation for some bss and data sections. */
301 ${RELOCATING-${BSS_DATA_RELOC}}
303 .bss ${RELOCATING-0} :
305 ${RELOCATING+__bss_start = .;}
306 ${RELOCATING+*(.sbss)}
307 ${RELOCATING+*(.scommon)}
312 ${RELOCATING+PROVIDE (_end = .);}
313 } ${RELOCATING+ > ${DATA_MEMORY}}
314 ${RELOCATING+__bss_size = SIZEOF(.bss);}
315 ${RELOCATING+PROVIDE (__bss_size = SIZEOF(.bss));}
317 ${RELOCATING+${CTOR}}
318 ${RELOCATING+${DTOR}}
320 ${RELOCATING+${VECTORS}}
322 /* Stabs debugging sections. */
323 .stab 0 : { *(.stab) }
324 .stabstr 0 : { *(.stabstr) }
325 .stab.excl 0 : { *(.stab.excl) }
326 .stab.exclstr 0 : { *(.stab.exclstr) }
327 .stab.index 0 : { *(.stab.index) }
328 .stab.indexstr 0 : { *(.stab.indexstr) }
330 .comment 0 : { *(.comment) }
332 /* DWARF debug sections.
333 Symbols in the DWARF debugging sections are relative to the beginning
334 of the section so we begin them at 0.
335 Treatment of DWARF debug section must be at end of the linker
336 script to avoid problems when there are undefined symbols. It's necessary
337 to avoid that the DWARF section is relocated before such undefined
338 symbols are found. */
341 .debug 0 : { *(.debug) }
342 .line 0 : { *(.line) }
344 /* GNU DWARF 1 extensions */
345 .debug_srcinfo 0 : { *(.debug_srcinfo) }
346 .debug_sfnames 0 : { *(.debug_sfnames) }
348 /* DWARF 1.1 and DWARF 2 */
349 .debug_aranges 0 : { *(.debug_aranges) }
350 .debug_pubnames 0 : { *(.debug_pubnames) }
353 .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
354 .debug_abbrev 0 : { *(.debug_abbrev) }
355 .debug_line 0 : { *(.debug_line) }
356 .debug_frame 0 : { *(.debug_frame) }
357 .debug_str 0 : { *(.debug_str) }
358 .debug_loc 0 : { *(.debug_loc) }
359 .debug_macinfo 0 : { *(.debug_macinfo) }