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