1#
2# Unusual variables checked by this code:
3#	NOP - four byte opcode for no-op (defaults to 0)
4#	NO_SMALL_DATA - no .sbss/.sbss2/.sdata/.sdata2 sections if not
5#		empty.
6#	SMALL_DATA_CTOR - .ctors contains small data.
7#	SMALL_DATA_DTOR - .dtors contains small data.
8#	DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
9#	INITIAL_READONLY_SECTIONS - at start of text segment
10#	OTHER_READONLY_SECTIONS - other than .text .init .rodata ...
11#		(e.g., .PARISC.milli)
12#	OTHER_TEXT_SECTIONS - these get put in .text when relocating
13#	OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ...
14#		(e.g., .PARISC.global)
15#	OTHER_RELRO_SECTIONS - other than .data.rel.ro ...
16#		(e.g. PPC32 .fixup, .got[12])
17#	OTHER_BSS_SECTIONS - other than .bss .sbss ...
18#	OTHER_SECTIONS - at the end
19#	EXECUTABLE_SYMBOLS - symbols that must be defined for an
20#		executable (e.g., _DYNAMIC_LINK)
21#       TEXT_START_ADDR - the first byte of the text segment, after any
22#               headers.
23#       TEXT_BASE_ADDRESS - the first byte of the text segment.
24#	TEXT_START_SYMBOLS - symbols that appear at the start of the
25#		.text section.
26#	DATA_START_SYMBOLS - symbols that appear at the start of the
27#		.data section.
28#	OTHER_GOT_SYMBOLS - symbols defined just before .got.
29#	OTHER_GOT_SECTIONS - sections just after .got.
30#	OTHER_SDATA_SECTIONS - sections just after .sdata.
31#	OTHER_BSS_SYMBOLS - symbols that appear at the start of the
32#		.bss section besides __bss_start.
33#	DATA_PLT - .plt should be in data segment, not text segment.
34#	PLT_BEFORE_GOT - .plt just before .got when .plt is in data segement.
35#	BSS_PLT - .plt should be in bss segment
36#	TEXT_DYNAMIC - .dynamic in text segment, not data segment.
37#	EMBEDDED - whether this is for an embedded system. 
38#	SHLIB_TEXT_START_ADDR - if set, add to SIZEOF_HEADERS to set
39#		start address of shared library.
40#	INPUT_FILES - INPUT command of files to always include
41#	WRITABLE_RODATA - if set, the .rodata section should be writable
42#	INIT_START, INIT_END -  statements just before and just after
43# 	combination of .init sections.
44#	FINI_START, FINI_END - statements just before and just after
45# 	combination of .fini sections.
46#	STACK_ADDR - start of a .stack section.
47#	OTHER_END_SYMBOLS - symbols to place right at the end of the script.
48#	SEPARATE_GOTPLT - if set, .got.plt should be separate output section,
49#		so that .got can be in the RELRO area.  It should be set to
50#		the number of bytes in the beginning of .got.plt which can be
51#		in the RELRO area as well.
52#
53# When adding sections, do note that the names of some sections are used
54# when specifying the start address of the next.
55#
56
57#  Many sections come in three flavours.  There is the 'real' section,
58#  like ".data".  Then there are the per-procedure or per-variable
59#  sections, generated by -ffunction-sections and -fdata-sections in GCC,
60#  and useful for --gc-sections, which for a variable "foo" might be
61#  ".data.foo".  Then there are the linkonce sections, for which the linker
62#  eliminates duplicates, which are named like ".gnu.linkonce.d.foo".
63#  The exact correspondences are:
64#
65#  Section	Linkonce section
66#  .text	.gnu.linkonce.t.foo
67#  .rodata	.gnu.linkonce.r.foo
68#  .data	.gnu.linkonce.d.foo
69#  .bss		.gnu.linkonce.b.foo
70#  .sdata	.gnu.linkonce.s.foo
71#  .sbss	.gnu.linkonce.sb.foo
72#  .sdata2	.gnu.linkonce.s2.foo
73#  .sbss2	.gnu.linkonce.sb2.foo
74#  .debug_info	.gnu.linkonce.wi.foo
75#  .tdata	.gnu.linkonce.td.foo
76#  .tbss	.gnu.linkonce.tb.foo
77#
78#  Each of these can also have corresponding .rel.* and .rela.* sections.
79
80test -z "$ENTRY" && ENTRY=_start
81test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
82test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
83if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi
84test -z "${ELFSIZE}" && ELFSIZE=32
85test -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8"
86test "$LD_FLAG" = "N" && DATA_ADDR=.
87test -n "$CREATE_SHLIB$CREATE_PIE" && test -n "$SHLIB_DATA_ADDR" && COMMONPAGESIZE=""
88test -z "$CREATE_SHLIB$CREATE_PIE" && test -n "$DATA_ADDR" && COMMONPAGESIZE=""
89test -n "$RELRO_NOW" && unset SEPARATE_GOTPLT
90DATA_SEGMENT_ALIGN="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))"
91DATA_SEGMENT_RELRO_END=""
92DATA_SEGMENT_RELRO_GOTPLT_END=""
93DATA_SEGMENT_END=""
94if test -n "${COMMONPAGESIZE}"; then
95  DATA_SEGMENT_ALIGN="ALIGN (${SEGMENT_SIZE}) - ((${MAXPAGESIZE} - .) & (${MAXPAGESIZE} - 1)); . = DATA_SEGMENT_ALIGN (${MAXPAGESIZE}, ${COMMONPAGESIZE})"
96  DATA_SEGMENT_END=". = DATA_SEGMENT_END (.);"
97  if test -n "${SEPARATE_GOTPLT}"; then
98    DATA_SEGMENT_RELRO_GOTPLT_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT}, .);"
99  else
100    DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (0, .);"
101  fi
102fi
103INTERP=".interp       ${RELOCATING-0} : { *(.interp) }"
104PLT=".plt          ${RELOCATING-0} : { *(.plt) }"
105if test -z "$GOT"; then
106  if test -z "$SEPARATE_GOTPLT"; then
107    GOT=".got          ${RELOCATING-0} : { *(.got.plt) *(.got) }"
108  else
109    GOT=".got          ${RELOCATING-0} : { *(.got) }"
110    GOTPLT="${RELOCATING+${DATA_SEGMENT_RELRO_GOTPLT_END}}
111  .got.plt      ${RELOCATING-0} : { *(.got.plt) }"
112  fi
113fi
114DYNAMIC=".dynamic      ${RELOCATING-0} : { *(.dynamic) }"
115RODATA=".rodata       ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
116DATARELRO=".data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) }"
117STACKNOTE="/DISCARD/ : { *(.note.GNU-stack) }"
118if test -z "${NO_SMALL_DATA}"; then
119  SBSS=".sbss         ${RELOCATING-0} :
120  {
121    ${RELOCATING+PROVIDE (__sbss_start = .);}
122    ${RELOCATING+PROVIDE (___sbss_start = .);}
123    ${CREATE_SHLIB+*(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)}
124    *(.dynsbss)
125    *(.sbss${RELOCATING+ .sbss.* .gnu.linkonce.sb.*})
126    *(.scommon)
127    ${RELOCATING+PROVIDE (__sbss_end = .);}
128    ${RELOCATING+PROVIDE (___sbss_end = .);}
129  }"
130  SBSS2=".sbss2        ${RELOCATING-0} : { *(.sbss2${RELOCATING+ .sbss2.* .gnu.linkonce.sb2.*}) }"
131  SDATA="/* We want the small data sections together, so single-instruction offsets
132     can access them all, and initialized data all before uninitialized, so
133     we can shorten the on-disk segment size.  */
134  .sdata        ${RELOCATING-0} : 
135  {
136    ${RELOCATING+${SDATA_START_SYMBOLS}}
137    ${CREATE_SHLIB+*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)}
138    *(.sdata${RELOCATING+ .sdata.* .gnu.linkonce.s.*})
139  }"
140  SDATA2=".sdata2       ${RELOCATING-0} : { *(.sdata2${RELOCATING+ .sdata2.* .gnu.linkonce.s2.*}) }"
141  REL_SDATA=".rel.sdata    ${RELOCATING-0} : { *(.rel.sdata${RELOCATING+ .rel.sdata.* .rel.gnu.linkonce.s.*}) }
142  .rela.sdata   ${RELOCATING-0} : { *(.rela.sdata${RELOCATING+ .rela.sdata.* .rela.gnu.linkonce.s.*}) }"
143  REL_SBSS=".rel.sbss     ${RELOCATING-0} : { *(.rel.sbss${RELOCATING+ .rel.sbss.* .rel.gnu.linkonce.sb.*}) }
144  .rela.sbss    ${RELOCATING-0} : { *(.rela.sbss${RELOCATING+ .rela.sbss.* .rela.gnu.linkonce.sb.*}) }"
145  REL_SDATA2=".rel.sdata2   ${RELOCATING-0} : { *(.rel.sdata2${RELOCATING+ .rel.sdata2.* .rel.gnu.linkonce.s2.*}) }
146  .rela.sdata2  ${RELOCATING-0} : { *(.rela.sdata2${RELOCATING+ .rela.sdata2.* .rela.gnu.linkonce.s2.*}) }"
147  REL_SBSS2=".rel.sbss2    ${RELOCATING-0} : { *(.rel.sbss2${RELOCATING+ .rel.sbss2.* .rel.gnu.linkonce.sb2.*}) }
148  .rela.sbss2   ${RELOCATING-0} : { *(.rela.sbss2${RELOCATING+ .rela.sbss2.* .rela.gnu.linkonce.sb2.*}) }"
149else
150  NO_SMALL_DATA=" "
151fi
152test -n "$SEPARATE_GOTPLT" && SEPARATE_GOTPLT=" "
153CTOR=".ctors        ${CONSTRUCTING-0} : 
154  {
155    ${CONSTRUCTING+${CTOR_START}}
156    /* gcc uses crtbegin.o to find the start of
157       the constructors, so we make sure it is
158       first.  Because this is a wildcard, it
159       doesn't matter if the user does not
160       actually link against crtbegin.o; the
161       linker won't look for a file to match a
162       wildcard.  The wildcard also means that it
163       doesn't matter which directory crtbegin.o
164       is in.  */
165
166    KEEP (*crtbegin*.o(.ctors))
167
168    /* We don't want to include the .ctor section from
169       from the crtend.o file until after the sorted ctors.
170       The .ctor section from the crtend file contains the
171       end of ctors marker and it must be last */
172
173    KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .ctors))
174    KEEP (*(SORT(.ctors.*)))
175    KEEP (*(.ctors))
176    ${CONSTRUCTING+${CTOR_END}}
177  }"
178DTOR=".dtors        ${CONSTRUCTING-0} :
179  {
180    ${CONSTRUCTING+${DTOR_START}}
181    KEEP (*crtbegin*.o(.dtors))
182    KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .dtors))
183    KEEP (*(SORT(.dtors.*)))
184    KEEP (*(.dtors))
185    ${CONSTRUCTING+${DTOR_END}}
186  }"
187STACK="  .stack        ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} :
188  {
189    ${RELOCATING+_stack = .;}
190    *(.stack)
191  }"
192
193# if this is for an embedded system, don't add SIZEOF_HEADERS.
194if [ -z "$EMBEDDED" ]; then
195   test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR} + SIZEOF_HEADERS"
196else
197   test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}"
198fi
199
200cat <<EOF
201OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
202	      "${LITTLE_OUTPUT_FORMAT}")
203OUTPUT_ARCH(${OUTPUT_ARCH})
204ENTRY(${ENTRY})
205
206${RELOCATING+${LIB_SEARCH_DIRS}}
207${RELOCATING+/* Do we need any of these for elf?
208   __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}}  */}
209${RELOCATING+${EXECUTABLE_SYMBOLS}}
210${RELOCATING+${INPUT_FILES}}
211${RELOCATING- /* For some reason, the Solaris linker makes bad executables
212  if gld -r is used and the intermediate file has sections starting
213  at non-zero addresses.  Could be a Solaris ld bug, could be a GNU ld
214  bug.  But for now assigning the zero vmas works.  */}
215
216SECTIONS
217{
218  /* Read-only sections, merged into text segment: */
219  ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+PROVIDE (__executable_start = ${TEXT_START_ADDR}); . = ${TEXT_BASE_ADDRESS};}}}
220  ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}}
221  ${CREATE_PIE+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}}
222  ${CREATE_SHLIB-${INTERP}}
223  ${INITIAL_READONLY_SECTIONS}
224  ${TEXT_DYNAMIC+${DYNAMIC}}
225  .hash         ${RELOCATING-0} : { *(.hash) }
226  .dynsym       ${RELOCATING-0} : { *(.dynsym) }
227  .dynstr       ${RELOCATING-0} : { *(.dynstr) }
228  .gnu.version  ${RELOCATING-0} : { *(.gnu.version) }
229  .gnu.version_d ${RELOCATING-0}: { *(.gnu.version_d) }
230  .gnu.version_r ${RELOCATING-0}: { *(.gnu.version_r) }
231
232EOF
233if [ "x$COMBRELOC" = x ]; then
234  COMBRELOCCAT=cat
235else
236  COMBRELOCCAT="cat > $COMBRELOC"
237fi
238eval $COMBRELOCCAT <<EOF
239  .rel.init     ${RELOCATING-0} : { *(.rel.init) }
240  .rela.init    ${RELOCATING-0} : { *(.rela.init) }
241  .rel.text     ${RELOCATING-0} : { *(.rel.text${RELOCATING+ .rel.text.* .rel.gnu.linkonce.t.*}) }
242  .rela.text    ${RELOCATING-0} : { *(.rela.text${RELOCATING+ .rela.text.* .rela.gnu.linkonce.t.*}) }
243  .rel.fini     ${RELOCATING-0} : { *(.rel.fini) }
244  .rela.fini    ${RELOCATING-0} : { *(.rela.fini) }
245  .rel.rodata   ${RELOCATING-0} : { *(.rel.rodata${RELOCATING+ .rel.rodata.* .rel.gnu.linkonce.r.*}) }
246  .rela.rodata  ${RELOCATING-0} : { *(.rela.rodata${RELOCATING+ .rela.rodata.* .rela.gnu.linkonce.r.*}) }
247  ${OTHER_READONLY_RELOC_SECTIONS}
248  .rel.data.rel.ro ${RELOCATING-0} : { *(.rel.data.rel.ro${RELOCATING+*}) }
249  .rela.data.rel.ro ${RELOCATING-0} : { *(.rel.data.rel.ro${RELOCATING+*}) }
250  .rel.data     ${RELOCATING-0} : { *(.rel.data${RELOCATING+ .rel.data.* .rel.gnu.linkonce.d.*}) }
251  .rela.data    ${RELOCATING-0} : { *(.rela.data${RELOCATING+ .rela.data.* .rela.gnu.linkonce.d.*}) }
252  .rel.tdata	${RELOCATING-0} : { *(.rel.tdata${RELOCATING+ .rel.tdata.* .rel.gnu.linkonce.td.*}) }
253  .rela.tdata	${RELOCATING-0} : { *(.rela.tdata${RELOCATING+ .rela.tdata.* .rela.gnu.linkonce.td.*}) }
254  .rel.tbss	${RELOCATING-0} : { *(.rel.tbss${RELOCATING+ .rel.tbss.* .rel.gnu.linkonce.tb.*}) }
255  .rela.tbss	${RELOCATING-0} : { *(.rela.tbss${RELOCATING+ .rela.tbss.* .rela.gnu.linkonce.tb.*}) }
256  .rel.ctors    ${RELOCATING-0} : { *(.rel.ctors) }
257  .rela.ctors   ${RELOCATING-0} : { *(.rela.ctors) }
258  .rel.dtors    ${RELOCATING-0} : { *(.rel.dtors) }
259  .rela.dtors   ${RELOCATING-0} : { *(.rela.dtors) }
260  .rel.got      ${RELOCATING-0} : { *(.rel.got) }
261  .rela.got     ${RELOCATING-0} : { *(.rela.got) }
262  ${OTHER_GOT_RELOC_SECTIONS}
263  ${REL_SDATA}
264  ${REL_SBSS}
265  ${REL_SDATA2}
266  ${REL_SBSS2}
267  .rel.bss      ${RELOCATING-0} : { *(.rel.bss${RELOCATING+ .rel.bss.* .rel.gnu.linkonce.b.*}) }
268  .rela.bss     ${RELOCATING-0} : { *(.rela.bss${RELOCATING+ .rela.bss.* .rela.gnu.linkonce.b.*}) }
269EOF
270if [ -n "$COMBRELOC" ]; then
271cat <<EOF
272  .rel.dyn      ${RELOCATING-0} :
273    {
274EOF
275sed -e '/^[ 	]*[{}][ 	]*$/d;/:[ 	]*$/d;/\.rela\./d;s/^.*: { *\(.*\)}$/      \1/' $COMBRELOC
276cat <<EOF
277    }
278  .rela.dyn     ${RELOCATING-0} :
279    {
280EOF
281sed -e '/^[ 	]*[{}][ 	]*$/d;/:[ 	]*$/d;/\.rel\./d;s/^.*: { *\(.*\)}/      \1/' $COMBRELOC
282cat <<EOF
283    }
284EOF
285fi
286cat <<EOF
287  .rel.plt      ${RELOCATING-0} : { *(.rel.plt) }
288  .rela.plt     ${RELOCATING-0} : { *(.rela.plt) }
289  ${OTHER_PLT_RELOC_SECTIONS}
290
291  .init         ${RELOCATING-0} : 
292  { 
293    ${RELOCATING+${INIT_START}}
294    KEEP (*(.init))
295    ${RELOCATING+${INIT_END}}
296  } =${NOP-0}
297
298  ${DATA_PLT-${BSS_PLT-${PLT}}}
299  .text         ${RELOCATING-0} :
300  {
301    ${RELOCATING+${TEXT_START_SYMBOLS}}
302    *(.text .stub${RELOCATING+ .text.* .gnu.linkonce.t.*})
303    KEEP (*(.text.*personality*))
304    /* .gnu.warning sections are handled specially by elf32.em.  */
305    *(.gnu.warning)
306    ${RELOCATING+${OTHER_TEXT_SECTIONS}}
307  } =${NOP-0}
308  .fini         ${RELOCATING-0} :
309  {
310    ${RELOCATING+${FINI_START}}
311    KEEP (*(.fini))
312    ${RELOCATING+${FINI_END}}
313  } =${NOP-0}
314  ${RELOCATING+PROVIDE (__etext = .);}
315  ${RELOCATING+PROVIDE (_etext = .);}
316  ${RELOCATING+PROVIDE (etext = .);}
317  ${WRITABLE_RODATA-${RODATA}}
318  .rodata1      ${RELOCATING-0} : { *(.rodata1) }
319  ${CREATE_SHLIB-${SDATA2}}
320  ${CREATE_SHLIB-${SBSS2}}
321  ${OTHER_READONLY_SECTIONS}
322  .eh_frame_hdr : { *(.eh_frame_hdr) }
323  .eh_frame     ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame)) }
324  .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }
325
326  /* Adjust the address for the data segment.  We want to adjust up to
327     the same address within the page on the next page up.  */
328  ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}}
329  ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}
330  ${CREATE_PIE+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}
331
332  /* Exception handling  */
333  .eh_frame     ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame)) }
334  .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }
335
336  /* Thread Local Storage sections  */
337  .tdata	${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) }
338  .tbss		${RELOCATING-0} : { *(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} }
339
340  .preinit_array   ${RELOCATING-0} : { KEEP (*(.preinit_array)) }
341  .init_array   ${RELOCATING-0} : { KEEP (*(.init_array)) }
342  .fini_array   ${RELOCATING-0} : { KEEP (*(.fini_array)) }
343
344  ${SMALL_DATA_CTOR-${RELOCATING+${CTOR}}}
345  ${SMALL_DATA_DTOR-${RELOCATING+${DTOR}}}
346  .jcr          ${RELOCATING-0} : { KEEP (*(.jcr)) }
347
348  ${RELOCATING+${DATARELRO}}
349  ${OTHER_RELRO_SECTIONS}
350  ${TEXT_DYNAMIC-${DYNAMIC}}
351  ${NO_SMALL_DATA+${RELRO_NOW+${GOT}}}
352  ${NO_SMALL_DATA+${RELRO_NOW-${SEPARATE_GOTPLT+${GOT}}}}
353  ${NO_SMALL_DATA+${RELRO_NOW-${SEPARATE_GOTPLT+${GOTPLT}}}}
354  ${RELOCATING+${DATA_SEGMENT_RELRO_END}}
355  ${NO_SMALL_DATA+${RELRO_NOW-${SEPARATE_GOTPLT-${GOT}}}}
356
357  ${DATA_PLT+${PLT_BEFORE_GOT-${PLT}}}
358
359  .data         ${RELOCATING-0} :
360  {
361    ${RELOCATING+${DATA_START_SYMBOLS}}
362    *(.data${RELOCATING+ .data.* .gnu.linkonce.d.*})
363    KEEP (*(.gnu.linkonce.d.*personality*))
364    ${CONSTRUCTING+SORT(CONSTRUCTORS)}
365  }
366  .data1        ${RELOCATING-0} : { *(.data1) }
367  ${WRITABLE_RODATA+${RODATA}}
368  ${OTHER_READWRITE_SECTIONS}
369  ${SMALL_DATA_CTOR+${RELOCATING+${CTOR}}}
370  ${SMALL_DATA_DTOR+${RELOCATING+${DTOR}}}
371  ${DATA_PLT+${PLT_BEFORE_GOT+${PLT}}}
372  ${RELOCATING+${OTHER_GOT_SYMBOLS}}
373  ${NO_SMALL_DATA-${GOT}}
374  ${OTHER_GOT_SECTIONS}
375  ${SDATA}
376  ${OTHER_SDATA_SECTIONS}
377  ${RELOCATING+_edata = .;}
378  ${RELOCATING+PROVIDE (edata = .);}
379  ${RELOCATING+__bss_start = .;}
380  ${RELOCATING+${OTHER_BSS_SYMBOLS}}
381  ${SBSS}
382  ${BSS_PLT+${PLT}}
383  .bss          ${RELOCATING-0} :
384  {
385   *(.dynbss)
386   *(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*})
387   *(COMMON)
388   /* Align here to ensure that the .bss section occupies space up to
389      _end.  Align after .bss to ensure correct alignment even if the
390      .bss section disappears because there are no input sections.  */
391   ${RELOCATING+. = ALIGN(${ALIGNMENT});}
392  }
393  ${OTHER_BSS_SECTIONS}
394  ${RELOCATING+. = ALIGN(${ALIGNMENT});}
395  ${RELOCATING+_end = .;}
396  ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
397  ${RELOCATING+PROVIDE (end = .);}
398  ${RELOCATING+${DATA_SEGMENT_END}}
399
400  /* Stabs debugging sections.  */
401  .stab          0 : { *(.stab) }
402  .stabstr       0 : { *(.stabstr) }
403  .stab.excl     0 : { *(.stab.excl) }
404  .stab.exclstr  0 : { *(.stab.exclstr) }
405  .stab.index    0 : { *(.stab.index) }
406  .stab.indexstr 0 : { *(.stab.indexstr) }
407
408  .comment       0 : { *(.comment) }
409
410  /* DWARF debug sections.
411     Symbols in the DWARF debugging sections are relative to the beginning
412     of the section so we begin them at 0.  */
413
414  /* DWARF 1 */
415  .debug          0 : { *(.debug) }
416  .line           0 : { *(.line) }
417
418  /* GNU DWARF 1 extensions */
419  .debug_srcinfo  0 : { *(.debug_srcinfo) }
420  .debug_sfnames  0 : { *(.debug_sfnames) }
421
422  /* DWARF 1.1 and DWARF 2 */
423  .debug_aranges  0 : { *(.debug_aranges) }
424  .debug_pubnames 0 : { *(.debug_pubnames) }
425
426  /* DWARF 2 */
427  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
428  .debug_abbrev   0 : { *(.debug_abbrev) }
429  .debug_line     0 : { *(.debug_line) }
430  .debug_frame    0 : { *(.debug_frame) }
431  .debug_str      0 : { *(.debug_str) }
432  .debug_loc      0 : { *(.debug_loc) }
433  .debug_macinfo  0 : { *(.debug_macinfo) }
434
435  /* SGI/MIPS DWARF 2 extensions */
436  .debug_weaknames 0 : { *(.debug_weaknames) }
437  .debug_funcnames 0 : { *(.debug_funcnames) }
438  .debug_typenames 0 : { *(.debug_typenames) }
439  .debug_varnames  0 : { *(.debug_varnames) }
440
441  ${STACK_ADDR+${STACK}}
442  ${OTHER_SECTIONS}
443  ${RELOCATING+${OTHER_END_SYMBOLS}}
444  ${RELOCATING+${STACKNOTE}}
445}
446EOF
447