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