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