1 # Copyright (C) 2014-2016 Free Software Foundation, Inc.
3 # Copying and distribution of this file, with or without modification,
4 # are permitted in any medium without royalty provided the copyright
5 # notice and this notice are preserved.
7 # This file is variant of elf.sc. For nds32, because the data will be
8 # classified into different sections according to their size, this script
9 # describe these sections map. The order is ".sdata_d, .sdata_w, .sdata_h,
10 # .sdata_b, , sdata_f, .sbss_f, .sbss_b, .sbss_h, .sbss_w, .sbss_d". In
11 # this order we do not have to consider the alignment issue between these
14 if test -n "$NOP"; then
20 test -z "$RODATA_NAME" && RODATA_NAME=rodata
21 test -z "$SDATA_NAME" && SDATA_NAME=sdata
22 test -z "$SBSS_NAME" && SBSS_NAME=sbss
23 test -z "$BSS_NAME" && BSS_NAME=bss
24 test -z "$ENTRY" && ENTRY=${USER_LABEL_PREFIX}_start
25 test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
26 test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
27 if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi
28 test -z "${ELFSIZE}" && ELFSIZE=32
29 test -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8"
30 test "$LD_FLAG" = "N" && DATA_ADDR=.
31 test -z "${ETEXT_NAME}" && ETEXT_NAME=${USER_LABEL_PREFIX}etext
32 test -n "$CREATE_SHLIB$CREATE_PIE" && test -n "$SHLIB_DATA_ADDR" && COMMONPAGESIZE=""
33 test -z "$CREATE_SHLIB$CREATE_PIE" && test -n "$DATA_ADDR" && COMMONPAGESIZE=""
34 test -n "$RELRO_NOW" && unset SEPARATE_GOTPLT
35 test -z "$ATTRS_SECTIONS" && ATTRS_SECTIONS=".gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }"
36 DATA_SEGMENT_ALIGN="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))"
37 DATA_SEGMENT_RELRO_END=""
39 if test -n "${COMMONPAGESIZE}"; then
40 DATA_SEGMENT_ALIGN="ALIGN (${SEGMENT_SIZE}) - ((${MAXPAGESIZE} - .) & (${MAXPAGESIZE} - 1)); . = DATA_SEGMENT_ALIGN (${MAXPAGESIZE}, ${COMMONPAGESIZE})"
41 DATA_SEGMENT_END=". = DATA_SEGMENT_END (.);"
42 DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT-0}, .);"
44 if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}"; then
45 INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp) }"
47 if test -z "$PLT"; then
48 IPLT=".iplt ${RELOCATING-0} : { *(.iplt) }"
49 PLT=".plt ${RELOCATING-0} : { *(.plt)${IREL_IN_PLT+ *(.iplt)} }
52 test -n "${DATA_PLT-${BSS_PLT-text}}" && TEXT_PLT=
53 if test -z "$GOT"; then
54 if test -z "$SEPARATE_GOTPLT"; then
55 GOT=".got ${RELOCATING-0} : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) }"
57 GOT=".got ${RELOCATING-0} : { *(.got) *(.igot) }"
58 GOTPLT=".got.plt ${RELOCATING-0} : { *(.got.plt) *(.igot.plt) }"
61 REL_IFUNC=".rel.ifunc ${RELOCATING-0} : { *(.rel.ifunc) }"
62 RELA_IFUNC=".rela.ifunc ${RELOCATING-0} : { *(.rela.ifunc) }"
63 REL_IPLT=".rel.iplt ${RELOCATING-0} :
65 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_start = .);}}
67 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_end = .);}}
69 RELA_IPLT=".rela.iplt ${RELOCATING-0} :
71 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_start = .);}}
73 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_end = .);}}
75 DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
76 RODATA=".${RODATA_NAME} ${RELOCATING-0} : { *(.${RODATA_NAME}${RELOCATING+ .${RODATA_NAME}.* .gnu.linkonce.r.*}) }"
77 DATARELRO=".data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }"
78 DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }"
79 if test -z "${NO_SMALL_DATA}"; then
80 SBSS=".sbss_b ${RELOCATING-0} :
82 *(.sbss_b${RELOCATING+ .sbss_b.*})
83 *(.scommon_b${RELOCATING+ .scommon_b.*})
84 ${RELOCATING+. = ALIGN(2);}
86 .sbss_h ${RELOCATING-0} :
88 *(.sbss_h${RELOCATING+ .sbss_h.*})
89 *(.scommon_h${RELOCATING+ .scommon_h.*})
90 ${RELOCATING+. = ALIGN(4);}
92 .sbss_w ${RELOCATING-0} :
94 *(.sbss_w${RELOCATING+ .sbss_w.*})
95 *(.scommon_w${RELOCATING+ .scommon_w.*})
98 ${RELOCATING+. = ALIGN(8);}
100 .sbss_d ${RELOCATING-0} :
102 *(.sbss_d${RELOCATING+ .sbss_d.*})
103 *(.scommon_d${RELOCATING+ .scommon_d.*})
104 ${RELOCATING+PROVIDE (__sbss_end = .);}
105 ${RELOCATING+PROVIDE (___sbss_end = .);}
107 SBSS2=".${SBSS_NAME}2 ${RELOCATING-0} : { *(.${SBSS_NAME}2${RELOCATING+ .${SBSS_NAME}2.* .gnu.linkonce.sb2.*}) }"
108 SDATA="/* We want the small data sections together, so single-instruction offsets
109 can access them all, and initialized data all before uninitialized, so
110 we can shorten the on-disk segment size. */
111 .${SDATA_NAME} ${RELOCATING-0} :
113 ${RELOCATING+${SDATA_START_SYMBOLS}}
114 ${CREATE_SHLIB+*(.${SDATA_NAME}2 .${SDATA_NAME}2.* .gnu.linkonce.s2.*)}
115 *(.${SDATA_NAME}${RELOCATING+ .${SDATA_NAME}.* .gnu.linkonce.s.*})
117 .sdata_d ${RELOCATING-0} :
119 *(.sdata_d${RELOCATING+ .sdata_d.*})
121 .sdata_w ${RELOCATING-0} :
123 *(.sdata_w${RELOCATING+ .sdata_w.*})
125 .sdata_h ${RELOCATING-0} :
127 *(.sdata_h${RELOCATING+ .sdata_h.*})
129 .sdata_b ${RELOCATING-0} :
131 *(.sdata_b${RELOCATING+ .sdata_b.*})
133 .sdata_f ${RELOCATING-0} :
135 *(.sdata_f${RELOCATING+ .sdata_f.*})
137 SDATA2=".${SDATA_NAME}2 ${RELOCATING-0} :
139 ${RELOCATING+${SDATA2_START_SYMBOLS}}
140 *(.${SDATA_NAME}2${RELOCATING+ .${SDATA_NAME}2.* .gnu.linkonce.s2.*})
142 REL_SDATA=".rel.${SDATA_NAME} ${RELOCATING-0} : { *(.rel.${SDATA_NAME}${RELOCATING+ .rel.${SDATA_NAME}.* .rel.gnu.linkonce.s.*}) }
143 .rela.${SDATA_NAME} ${RELOCATING-0} : { *(.rela.${SDATA_NAME}${RELOCATING+ .rela.${SDATA_NAME}.* .rela.gnu.linkonce.s.*}) }"
144 REL_SBSS=".rel.${SBSS_NAME} ${RELOCATING-0} : { *(.rel.${SBSS_NAME}${RELOCATING+ .rel.${SBSS_NAME}.* .rel.gnu.linkonce.sb.*}) }
145 .rela.${SBSS_NAME} ${RELOCATING-0} : { *(.rela.${SBSS_NAME}${RELOCATING+ .rela.${SBSS_NAME}.* .rela.gnu.linkonce.sb.*}) }"
146 REL_SDATA2=".rel.${SDATA_NAME}2 ${RELOCATING-0} : { *(.rel.${SDATA_NAME}2${RELOCATING+ .rel.${SDATA_NAME}2.* .rel.gnu.linkonce.s2.*}) }
147 .rela.${SDATA_NAME}2 ${RELOCATING-0} : { *(.rela.${SDATA_NAME}2${RELOCATING+ .rela.${SDATA_NAME}2.* .rela.gnu.linkonce.s2.*}) }"
148 REL_SBSS2=".rel.${SBSS_NAME}2 ${RELOCATING-0} : { *(.rel.${SBSS_NAME}2${RELOCATING+ .rel.${SBSS_NAME}2.* .rel.gnu.linkonce.sb2.*}) }
149 .rela.${SBSS_NAME}2 ${RELOCATING-0} : { *(.rela.${SBSS_NAME}2${RELOCATING+ .rela.${SBSS_NAME}2.* .rela.gnu.linkonce.sb2.*}) }"
153 if test -z "${DATA_GOT}"; then
154 if test -n "${NO_SMALL_DATA}"; then
158 if test -z "${SDATA_GOT}"; then
159 if test -z "${NO_SMALL_DATA}"; then
163 test -n "$SEPARATE_GOTPLT" && SEPARATE_GOTPLT=" "
164 test "${LARGE_SECTIONS}" = "yes" && REL_LARGE="
165 .rel.ldata ${RELOCATING-0} : { *(.rel.ldata${RELOCATING+ .rel.ldata.* .rel.gnu.linkonce.l.*}) }
166 .rela.ldata ${RELOCATING-0} : { *(.rela.ldata${RELOCATING+ .rela.ldata.* .rela.gnu.linkonce.l.*}) }
167 .rel.lbss ${RELOCATING-0} : { *(.rel.lbss${RELOCATING+ .rel.lbss.* .rel.gnu.linkonce.lb.*}) }
168 .rela.lbss ${RELOCATING-0} : { *(.rela.lbss${RELOCATING+ .rela.lbss.* .rela.gnu.linkonce.lb.*}) }
169 .rel.lrodata ${RELOCATING-0} : { *(.rel.lrodata${RELOCATING+ .rel.lrodata.* .rel.gnu.linkonce.lr.*}) }
170 .rela.lrodata ${RELOCATING-0} : { *(.rela.lrodata${RELOCATING+ .rela.lrodata.* .rela.gnu.linkonce.lr.*}) }"
171 test "${LARGE_SECTIONS}" = "yes" && LARGE_BSS="
172 .lbss ${RELOCATING-0} :
175 *(.lbss${RELOCATING+ .lbss.* .gnu.linkonce.lb.*})
178 test "${LARGE_SECTIONS}" = "yes" && LARGE_SECTIONS="
179 .lrodata ${RELOCATING-0} ${RELOCATING+ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))} :
181 *(.lrodata${RELOCATING+ .lrodata.* .gnu.linkonce.lr.*})
183 .ldata ${RELOCATING-0} ${RELOCATING+ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))} :
185 *(.ldata${RELOCATING+ .ldata.* .gnu.linkonce.l.*})
186 ${RELOCATING+. = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
188 if test "${ENABLE_INITFINI_ARRAY}" = "yes"; then
189 SORT_INIT_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))"
190 SORT_FINI_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))"
191 CTORS_IN_INIT_ARRAY="EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors"
192 DTORS_IN_FINI_ARRAY="EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors"
194 SORT_INIT_ARRAY="KEEP (*(SORT(.init_array.*)))"
195 SORT_FINI_ARRAY="KEEP (*(SORT(.fini_array.*)))"
199 INIT_ARRAY=".init_array ${RELOCATING-0} :
201 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_start = .);}}
203 KEEP (*(.init_array ${CTORS_IN_INIT_ARRAY}))
204 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_end = .);}}
206 FINI_ARRAY=".fini_array ${RELOCATING-0} :
208 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_start = .);}}
210 KEEP (*(.fini_array ${DTORS_IN_FINI_ARRAY}))
211 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_end = .);}}
213 CTOR=".ctors ${CONSTRUCTING-0} :
215 ${CONSTRUCTING+${CTOR_START}}
216 /* gcc uses crtbegin.o to find the start of
217 the constructors, so we make sure it is
218 first. Because this is a wildcard, it
219 doesn't matter if the user does not
220 actually link against crtbegin.o; the
221 linker won't look for a file to match a
222 wildcard. The wildcard also means that it
223 doesn't matter which directory crtbegin.o
226 KEEP (*crtbegin.o(.ctors))
227 KEEP (*crtbegin?.o(.ctors))
229 /* We don't want to include the .ctor section from
230 the crtend.o file until after the sorted ctors.
231 The .ctor section from the crtend file contains the
232 end of ctors marker and it must be last */
234 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors))
235 KEEP (*(SORT(.ctors.*)))
237 ${CONSTRUCTING+${CTOR_END}}
239 DTOR=".dtors ${CONSTRUCTING-0} :
241 ${CONSTRUCTING+${DTOR_START}}
242 KEEP (*crtbegin.o(.dtors))
243 KEEP (*crtbegin?.o(.dtors))
244 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors))
245 KEEP (*(SORT(.dtors.*)))
247 ${CONSTRUCTING+${DTOR_END}}
249 STACK=" .stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} :
251 ${RELOCATING+${USER_LABEL_PREFIX}_stack = .;}
255 TEXT_START_ADDR="SEGMENT_START(\"text-segment\", ${TEXT_START_ADDR})"
256 SHLIB_TEXT_START_ADDR="SEGMENT_START(\"text-segment\", ${SHLIB_TEXT_START_ADDR:-0})"
258 if [ -z "$SEPARATE_CODE" ]; then
259 SIZEOF_HEADERS_CODE=" + SIZEOF_HEADERS"
264 # If this is for an embedded system, don't add SIZEOF_HEADERS.
265 if [ -z "$EMBEDDED" ]; then
266 test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}${SIZEOF_HEADERS_CODE}"
269 test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}"
270 NDS32_INIT=".nds32_init : { KEEP(*(.nds32_init)) }"
274 /* Copyright (C) 2014-2016 Free Software Foundation, Inc.
276 Copying and distribution of this script, with or without modification,
277 are permitted in any medium without royalty provided the copyright
278 notice and this notice are preserved. */
280 OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
281 "${LITTLE_OUTPUT_FORMAT}")
282 OUTPUT_ARCH(${OUTPUT_ARCH})
283 ${RELOCATING+ENTRY(${ENTRY})}
285 ${RELOCATING+${LIB_SEARCH_DIRS}}
286 ${RELOCATING+${EXECUTABLE_SYMBOLS}}
287 ${RELOCATING+${INPUT_FILES}}
288 ${RELOCATING- /* For some reason, the Solaris linker makes bad executables
289 if gld -r is used and the intermediate file has sections starting
290 at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld
291 bug. But for now assigning the zero vmas works. */}
295 /* Read-only sections, merged into text segment: */
296 ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+PROVIDE (__executable_start = ${TEXT_START_ADDR}); . = ${TEXT_BASE_ADDRESS};}}}
297 /* Sections saved crt0 and crt1. */
299 ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR}${SIZEOF_HEADERS_CODE};}}
300 ${CREATE_PIE+${RELOCATING+PROVIDE (__executable_start = ${SHLIB_TEXT_START_ADDR}); . = ${SHLIB_TEXT_START_ADDR}${SIZEOF_HEADERS_CODE};}}
306 ${INITIAL_READONLY_SECTIONS}
307 .note.gnu.build-id : { *(.note.gnu.build-id) }
311 test -n "${SEPARATE_CODE}" || emit_early_ro
313 test -n "${RELOCATING+0}" || unset NON_ALLOC_DYN
314 test -z "${NON_ALLOC_DYN}" || TEXT_DYNAMIC=
315 cat > ldscripts/dyntmp.$$ <<EOF
316 ${TEXT_DYNAMIC+${DYNAMIC}}
317 .hash ${RELOCATING-0} : { *(.hash) }
318 .gnu.hash ${RELOCATING-0} : { *(.gnu.hash) }
319 .dynsym ${RELOCATING-0} : { *(.dynsym) }
320 .dynstr ${RELOCATING-0} : { *(.dynstr) }
321 .gnu.version ${RELOCATING-0} : { *(.gnu.version) }
322 .gnu.version_d ${RELOCATING-0}: { *(.gnu.version_d) }
323 .gnu.version_r ${RELOCATING-0}: { *(.gnu.version_r) }
326 if [ "x$COMBRELOC" = x ]; then
327 COMBRELOCCAT="cat >> ldscripts/dyntmp.$$"
329 COMBRELOCCAT="cat > $COMBRELOC"
331 eval $COMBRELOCCAT <<EOF
332 ${INITIAL_RELOC_SECTIONS}
333 .rel.init ${RELOCATING-0} : { *(.rel.init) }
334 .rela.init ${RELOCATING-0} : { *(.rela.init) }
335 .rel.text ${RELOCATING-0} : { *(.rel.text${RELOCATING+ .rel.text.* .rel.gnu.linkonce.t.*}) }
336 .rela.text ${RELOCATING-0} : { *(.rela.text${RELOCATING+ .rela.text.* .rela.gnu.linkonce.t.*}) }
337 .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
338 .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
339 .rel.${RODATA_NAME} ${RELOCATING-0} : { *(.rel.${RODATA_NAME}${RELOCATING+ .rel.${RODATA_NAME}.* .rel.gnu.linkonce.r.*}) }
340 .rela.${RODATA_NAME} ${RELOCATING-0} : { *(.rela.${RODATA_NAME}${RELOCATING+ .rela.${RODATA_NAME}.* .rela.gnu.linkonce.r.*}) }
341 ${OTHER_READONLY_RELOC_SECTIONS}
342 .rel.data.rel.ro ${RELOCATING-0} : { *(.rel.data.rel.ro${RELOCATING+ .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*}) }
343 .rela.data.rel.ro ${RELOCATING-0} : { *(.rela.data.rel.ro${RELOCATING+ .rela.data.rel.ro.* .rela.gnu.linkonce.d.rel.ro.*}) }
344 .rel.data ${RELOCATING-0} : { *(.rel.data${RELOCATING+ .rel.data.* .rel.gnu.linkonce.d.*}) }
345 .rela.data ${RELOCATING-0} : { *(.rela.data${RELOCATING+ .rela.data.* .rela.gnu.linkonce.d.*}) }
346 ${OTHER_READWRITE_RELOC_SECTIONS}
347 .rel.tdata ${RELOCATING-0} : { *(.rel.tdata${RELOCATING+ .rel.tdata.* .rel.gnu.linkonce.td.*}) }
348 .rela.tdata ${RELOCATING-0} : { *(.rela.tdata${RELOCATING+ .rela.tdata.* .rela.gnu.linkonce.td.*}) }
349 .rel.tbss ${RELOCATING-0} : { *(.rel.tbss${RELOCATING+ .rel.tbss.* .rel.gnu.linkonce.tb.*}) }
350 .rela.tbss ${RELOCATING-0} : { *(.rela.tbss${RELOCATING+ .rela.tbss.* .rela.gnu.linkonce.tb.*}) }
351 .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
352 .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
353 .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
354 .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
355 .rel.got ${RELOCATING-0} : { *(.rel.got) }
356 .rela.got ${RELOCATING-0} : { *(.rela.got) }
357 ${OTHER_GOT_RELOC_SECTIONS}
362 .rel.${BSS_NAME} ${RELOCATING-0} : { *(.rel.${BSS_NAME}${RELOCATING+ .rel.${BSS_NAME}.* .rel.gnu.linkonce.b.*}) }
363 .rela.${BSS_NAME} ${RELOCATING-0} : { *(.rela.${BSS_NAME}${RELOCATING+ .rela.${BSS_NAME}.* .rela.gnu.linkonce.b.*}) }
365 ${IREL_IN_PLT+$REL_IFUNC}
366 ${IREL_IN_PLT+$RELA_IFUNC}
367 ${IREL_IN_PLT-$REL_IPLT}
368 ${IREL_IN_PLT-$RELA_IPLT}
371 if [ -n "$COMBRELOC" ]; then
372 cat >> ldscripts/dyntmp.$$ <<EOF
373 .rel.dyn ${RELOCATING-0} :
376 sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rela\./d;/__rela_iplt_/d;s/^.*: { *\(.*\)}$/ \1/' $COMBRELOC >> ldscripts/dyntmp.$$
377 cat >> ldscripts/dyntmp.$$ <<EOF
379 .rela.dyn ${RELOCATING-0} :
382 sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rel\./d;/__rel_iplt_/d;s/^.*: { *\(.*\)}/ \1/' $COMBRELOC >> ldscripts/dyntmp.$$
383 cat >> ldscripts/dyntmp.$$ <<EOF
388 cat >> ldscripts/dyntmp.$$ <<EOF
389 .rel.plt ${RELOCATING-0} :
392 ${IREL_IN_PLT+${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_start = .);}}}
393 ${IREL_IN_PLT+${RELOCATING+*(.rel.iplt)}}
394 ${IREL_IN_PLT+${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_end = .);}}}
396 .rela.plt ${RELOCATING-0} :
399 ${IREL_IN_PLT+${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_start = .);}}}
400 ${IREL_IN_PLT+${RELOCATING+*(.rela.iplt)}}
401 ${IREL_IN_PLT+${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_end = .);}}}
403 ${OTHER_PLT_RELOC_SECTIONS}
408 if test -z "${NO_REL_RELOCS}${NO_RELA_RELOCS}"; then
409 cat ldscripts/dyntmp.$$
411 if test -z "${NO_REL_RELOCS}"; then
412 sed -e '/^[ ]*\.rela\.[^}]*$/,/}/d;/^[ ]*\.rela\./d;/__rela_iplt_/d' ldscripts/dyntmp.$$
414 if test -z "${NO_RELA_RELOCS}"; then
415 sed -e '/^[ ]*\.rel\.[^}]*$/,/}/d;/^[ ]*\.rel\./d;/__rel_iplt_/d' ldscripts/dyntmp.$$
418 rm -f ldscripts/dyntmp.$$
421 test -n "${NON_ALLOC_DYN}${SEPARATE_CODE}" || emit_dyn
424 .init ${RELOCATING-0} :
426 ${RELOCATING+${INIT_START}}
427 KEEP (*(SORT_NONE(.init)))
428 ${RELOCATING+${INIT_END}}
431 ${TEXT_PLT+${PLT_NEXT_DATA-${PLT}}}
432 ${TINY_READONLY_SECTION}
433 .text ${RELOCATING-0} :
435 ${RELOCATING+${TEXT_START_SYMBOLS}}
436 ${RELOCATING+*(.text.unlikely .text.*_unlikely .text.unlikely.*)}
437 ${RELOCATING+*(.text.exit .text.exit.*)}
438 ${RELOCATING+*(.text.startup .text.startup.*)}
439 ${RELOCATING+*(.text.hot .text.hot.*)}
440 *(.text .stub${RELOCATING+ .text.* .gnu.linkonce.t.*})
441 /* .gnu.warning sections are handled specially by elf32.em. */
443 ${RELOCATING+${OTHER_TEXT_SECTIONS}}
445 .fini ${RELOCATING-0} :
447 ${RELOCATING+${FINI_START}}
448 KEEP (*(SORT_NONE(.fini)))
449 ${RELOCATING+${FINI_END}}
451 ${RELOCATING+PROVIDE (__${ETEXT_NAME} = .);}
452 ${RELOCATING+PROVIDE (_${ETEXT_NAME} = .);}
453 ${RELOCATING+PROVIDE (${ETEXT_NAME} = .);}
456 if test -n "${SEPARATE_CODE}"; then
457 if test -n "${RODATA_ADDR}"; then
459 SEGMENT_START(\"rodata-segment\", ${RODATA_ADDR}) + SIZEOF_HEADERS"
461 RODATA_ADDR="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))"
462 RODATA_ADDR="SEGMENT_START(\"rodata-segment\", ${RODATA_ADDR})"
464 if test -n "${SHLIB_RODATA_ADDR}"; then
466 SEGMENT_START(\"rodata-segment\", ${SHLIB_RODATA_ADDR}) + SIZEOF_HEADERS"
468 SHLIB_RODATA_ADDR="SEGMENT_START(\"rodata-segment\", ${SHLIB_RODATA_ADDR})"
469 SHLIB_RODATA_ADDR="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))"
472 /* Adjust the address for the rodata segment. We want to adjust up to
473 the same address within the page on the next page up. */
474 ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${RODATA_ADDR};}}}
475 ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_RODATA_ADDR};}}
476 ${CREATE_PIE+${RELOCATING+. = ${SHLIB_RODATA_ADDR};}}
483 ${WRITABLE_RODATA-${RODATA}}
484 .${RODATA_NAME}1 ${RELOCATING-0} : { *(.${RODATA_NAME}1) }
485 ${CREATE_SHLIB-${SDATA2}}
486 ${CREATE_SHLIB-${SBSS2}}
487 ${OTHER_READONLY_SECTIONS}
488 .eh_frame_hdr : { *(.eh_frame_hdr) }
489 .eh_frame ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame)) }
490 .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table
491 .gcc_except_table.*) }
492 /* These sections are generated by the Sun/Oracle C++ compiler. */
493 .exception_ranges ${RELOCATING-0} : ONLY_IF_RO { *(.exception_ranges
494 .exception_ranges*) }
495 ${TEXT_PLT+${PLT_NEXT_DATA+${PLT}}}
497 /* Adjust the address for the data segment. We want to adjust up to
498 the same address within the page on the next page up. */
499 ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}}
500 ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}
501 ${CREATE_PIE+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}
503 /* Exception handling */
504 .eh_frame ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame)) }
505 .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
506 .exception_ranges ${RELOCATING-0} : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
508 /* Thread Local Storage sections */
509 .tdata ${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) }
510 .tbss ${RELOCATING-0} : { *(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} }
512 .preinit_array ${RELOCATING-0} :
514 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_start = .);}}
515 KEEP (*(.preinit_array))
516 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_end = .);}}
518 ${RELOCATING+${INIT_ARRAY}}
519 ${RELOCATING+${FINI_ARRAY}}
520 ${SMALL_DATA_CTOR-${RELOCATING+${CTOR}}}
521 ${SMALL_DATA_DTOR-${RELOCATING+${DTOR}}}
522 .jcr ${RELOCATING-0} : { KEEP (*(.jcr)) }
524 ${RELOCATING+${DATARELRO}}
525 ${OTHER_RELRO_SECTIONS}
526 ${TEXT_DYNAMIC-${DYNAMIC}}
527 ${DATA_GOT+${RELRO_NOW+${GOT}}}
528 ${DATA_GOT+${RELRO_NOW+${GOTPLT}}}
529 ${DATA_GOT+${RELRO_NOW-${SEPARATE_GOTPLT+${GOT}}}}
530 ${RELOCATING+${DATA_SEGMENT_RELRO_END}}
531 ${INITIAL_READWRITE_SECTIONS}
532 ${DATA_GOT+${RELRO_NOW-${SEPARATE_GOTPLT-${GOT}}}}
533 ${DATA_GOT+${RELRO_NOW-${GOTPLT}}}
535 ${DATA_PLT+${PLT_BEFORE_GOT-${PLT}}}
537 /* For _SDA_BASE_ aligment. */
538 ${RELOCATING+. = ALIGN(4);}
540 .data ${RELOCATING-0} :
542 ${RELOCATING+${DATA_START_SYMBOLS}}
543 *(.data${RELOCATING+ .data.* .gnu.linkonce.d.*})
544 ${CONSTRUCTING+SORT(CONSTRUCTORS)}
546 .data1 ${RELOCATING-0} : { *(.data1) }
547 ${WRITABLE_RODATA+${RODATA}}
548 ${OTHER_READWRITE_SECTIONS}
549 ${SMALL_DATA_CTOR+${RELOCATING+${CTOR}}}
550 ${SMALL_DATA_DTOR+${RELOCATING+${DTOR}}}
551 ${RELOCATING+. = ALIGN(4);}
552 ${DATA_PLT+${PLT_BEFORE_GOT+${PLT}}}
553 ${SDATA_GOT+${RELOCATING+${OTHER_GOT_SYMBOLS+. = .; ${OTHER_GOT_SYMBOLS}}}}
555 ${SDATA_GOT+${OTHER_GOT_SECTIONS}}
557 ${OTHER_SDATA_SECTIONS}
558 ${RELOCATING+. = ALIGN(4);}
559 ${RELOCATING+${DATA_END_SYMBOLS-${USER_LABEL_PREFIX}_edata = .; PROVIDE (${USER_LABEL_PREFIX}edata = .);}}
561 ${RELOCATING+${USER_LABEL_PREFIX}__bss_start = .;}
562 ${RELOCATING+${OTHER_BSS_SYMBOLS}}
565 .${BSS_NAME} ${RELOCATING-0} :
568 *(.${BSS_NAME}${RELOCATING+ .${BSS_NAME}.* .gnu.linkonce.b.*})
570 /* Align here to ensure that the .bss section occupies space up to
571 _end. Align after .bss to ensure correct alignment even if the
572 .bss section disappears because there are no input sections.
573 FIXME: Why do we need it? When there is no .bss section, we don't
574 pad the .data section. */
575 ${RELOCATING+. = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
577 ${OTHER_BSS_SECTIONS}
578 ${LARGE_BSS_AFTER_BSS+${LARGE_BSS}}
579 ${RELOCATING+_end = .;}
580 ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
581 ${RELOCATING+. = ALIGN(${ALIGNMENT});}
584 LARGE_DATA_ADDR=". = SEGMENT_START(\"ldata-segment\", ${LARGE_DATA_ADDR-.});"
585 SHLIB_LARGE_DATA_ADDR=". = SEGMENT_START(\"ldata-segment\", ${SHLIB_LARGE_DATA_ADDR-.});"
588 ${RELOCATING+${CREATE_SHLIB-${CREATE_PIE-${LARGE_DATA_ADDR}}}}
589 ${RELOCATING+${CREATE_SHLIB+${SHLIB_LARGE_DATA_ADDR}}}
590 ${RELOCATING+${CREATE_PIE+${SHLIB_LARGE_DATA_ADDR}}}
592 ${LARGE_BSS_AFTER_BSS-${LARGE_BSS}}
593 ${RELOCATING+. = ALIGN(${ALIGNMENT});}
594 ${RELOCATING+${OTHER_END_SYMBOLS}}
595 ${RELOCATING+${END_SYMBOLS-${USER_LABEL_PREFIX}_end = .; PROVIDE (${USER_LABEL_PREFIX}end = .);}}
596 ${RELOCATING+${DATA_SEGMENT_END}}
599 test -z "${NON_ALLOC_DYN}" || emit_dyn
602 /* Stabs debugging sections. */
603 .stab 0 : { *(.stab) }
604 .stabstr 0 : { *(.stabstr) }
605 .stab.excl 0 : { *(.stab.excl) }
606 .stab.exclstr 0 : { *(.stab.exclstr) }
607 .stab.index 0 : { *(.stab.index) }
608 .stab.indexstr 0 : { *(.stab.indexstr) }
610 .comment 0 : { *(.comment) }
614 . $srcdir/scripttempl/DWARF.sc
621 ${STACK_ADDR+${STACK}}
624 ${RELOCATING+${OTHER_SYMBOLS}}
625 ${RELOCATING+${DISCARDED}}