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