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 # Unusual variables checked by this code:
8 # NOP - four byte opcode for no-op (defaults to 0)
9 # NO_SMALL_DATA - no .sbss/.sbss2/.sdata/.sdata2 sections if not
11 # SMALL_DATA_CTOR - .ctors contains small data.
12 # SMALL_DATA_DTOR - .dtors contains small data.
13 # DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
14 # INITIAL_READONLY_SECTIONS - at start of text segment
15 # OTHER_READONLY_SECTIONS - other than .text .init .rodata ...
16 # (e.g., .PARISC.milli)
17 # OTHER_TEXT_SECTIONS - these get put in .text when relocating
18 # OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ...
19 # (e.g., .PARISC.global)
20 # OTHER_RELRO_SECTIONS - other than .data.rel.ro ...
21 # (e.g. PPC32 .fixup, .got[12])
22 # OTHER_BSS_SECTIONS - other than .bss .sbss ...
23 # ATTRS_SECTIONS - at the end
24 # OTHER_SECTIONS - at the end
25 # EXECUTABLE_SYMBOLS - symbols that must be defined for an
26 # executable (e.g., _DYNAMIC_LINK)
27 # TEXT_START_ADDR - the first byte of the text segment, after any
29 # TEXT_BASE_ADDRESS - the first byte of the text segment.
30 # TEXT_START_SYMBOLS - symbols that appear at the start of the
32 # DATA_START_SYMBOLS - symbols that appear at the start of the
34 # DATA_END_SYMBOLS - symbols that appear at the end of the
35 # writeable data sections.
36 # OTHER_GOT_SYMBOLS - symbols defined just before .got.
37 # OTHER_GOT_SECTIONS - sections just after .got.
38 # OTHER_SDATA_SECTIONS - sections just after .sdata.
39 # OTHER_BSS_SYMBOLS - symbols that appear at the start of the
40 # .bss section besides __bss_start.
41 # DATA_PLT - .plt should be in data segment, not text segment.
42 # PLT_BEFORE_GOT - .plt just before .got when .plt is in data segement.
43 # BSS_PLT - .plt should be in bss segment
44 # NO_REL_RELOCS - Don't include .rel.* sections in script
45 # NO_RELA_RELOCS - Don't include .rela.* sections in script
46 # NON_ALLOC_DYN - Place dynamic sections after data segment.
47 # TEXT_DYNAMIC - .dynamic in text segment, not data segment.
48 # EMBEDDED - whether this is for an embedded system.
49 # SHLIB_TEXT_START_ADDR - if set, add to SIZEOF_HEADERS to set
50 # start address of shared library.
51 # INPUT_FILES - INPUT command of files to always include
52 # WRITABLE_RODATA - if set, the .rodata section should be writable
53 # INIT_START, INIT_END - statements just before and just after
54 # combination of .init sections.
55 # FINI_START, FINI_END - statements just before and just after
56 # combination of .fini sections.
57 # STACK_ADDR - start of a .stack section.
58 # OTHER_SYMBOLS - symbols to place right at the end of the script.
59 # ETEXT_NAME - name of a symbol for the end of the text section,
61 # SEPARATE_GOTPLT - if set, .got.plt should be separate output section,
62 # so that .got can be in the RELRO area. It should be set to
63 # the number of bytes in the beginning of .got.plt which can be
64 # in the RELRO area as well.
65 # USER_LABEL_PREFIX - prefix to add to user-visible symbols.
67 # When adding sections, do note that the names of some sections are used
68 # when specifying the start address of the next.
71 # Many sections come in three flavours. There is the 'real' section,
72 # like ".data". Then there are the per-procedure or per-variable
73 # sections, generated by -ffunction-sections and -fdata-sections in GCC,
74 # and useful for --gc-sections, which for a variable "foo" might be
75 # ".data.foo". Then there are the linkonce sections, for which the linker
76 # eliminates duplicates, which are named like ".gnu.linkonce.d.foo".
77 # The exact correspondences are:
79 # Section Linkonce section
80 # .text .gnu.linkonce.t.foo
81 # .rodata .gnu.linkonce.r.foo
82 # .data .gnu.linkonce.d.foo
83 # .bss .gnu.linkonce.b.foo
84 # .sdata .gnu.linkonce.s.foo
85 # .sbss .gnu.linkonce.sb.foo
86 # .sdata2 .gnu.linkonce.s2.foo
87 # .sbss2 .gnu.linkonce.sb2.foo
88 # .debug_info .gnu.linkonce.wi.foo
89 # .tdata .gnu.linkonce.td.foo
90 # .tbss .gnu.linkonce.tb.foo
91 # .lrodata .gnu.linkonce.lr.foo
92 # .ldata .gnu.linkonce.l.foo
93 # .lbss .gnu.linkonce.lb.foo
95 # plus exception-handling information for Tensilica's XCC compiler:
96 # .xt_except_table .gnu.linkonce.e.foo
97 # .xt_except_desc .gnu.linkonce.h.foo
99 # plus Xtensa-specific literal sections:
100 # .literal .gnu.linkonce.literal.foo
101 # .lit4 .gnu.linkonce.lit4.foo
103 # plus Xtensa-specific "property table" sections:
104 # .xt.lit .gnu.linkonce.p.foo
105 # .xt.insn .gnu.linkonce.x.foo (obsolete)
106 # .xt.prop .gnu.linkonce.prop.foo
108 # Each of these can also have corresponding .rel.* and .rela.* sections.
110 test -z "$ENTRY" && ENTRY=_start
111 test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
112 test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
113 if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi
114 test -z "${ELFSIZE}" && ELFSIZE=32
115 test -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8"
116 test "$LD_FLAG" = "N" && DATA_ADDR=.
117 test -z "${ETEXT_NAME}" && ETEXT_NAME=etext
118 test -n "$CREATE_SHLIB$CREATE_PIE" && test -n "$SHLIB_DATA_ADDR" && COMMONPAGESIZE=""
119 test -z "$CREATE_SHLIB$CREATE_PIE" && test -n "$DATA_ADDR" && COMMONPAGESIZE=""
120 test -n "$RELRO_NOW" && unset SEPARATE_GOTPLT
121 test -z "$ATTRS_SECTIONS" && ATTRS_SECTIONS=".gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }"
122 DATA_SEGMENT_ALIGN="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))"
123 DATA_SEGMENT_RELRO_END=""
125 if test -n "${COMMONPAGESIZE}"; then
126 DATA_SEGMENT_ALIGN="ALIGN (${SEGMENT_SIZE}) - ((${MAXPAGESIZE} - .) & (${MAXPAGESIZE} - 1)); . = DATA_SEGMENT_ALIGN (${MAXPAGESIZE}, ${COMMONPAGESIZE})"
127 DATA_SEGMENT_END=". = DATA_SEGMENT_END (.);"
128 DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT-0}, .);"
130 if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}"; then
131 INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp) }"
133 if test -z "$PLT"; then
134 PLT=".plt ${RELOCATING-0} : { *(.plt) }"
136 test -n "${DATA_PLT-${BSS_PLT-text}}" && TEXT_PLT=yes
137 if test -z "$GOT"; then
138 if test -z "$SEPARATE_GOTPLT"; then
139 GOT=".got ${RELOCATING-0} : { *(.got.plt) *(.got) }"
141 GOT=".got ${RELOCATING-0} : { *(.got) }"
142 GOTPLT=".got.plt ${RELOCATING-0} : { *(.got.plt) }"
145 DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
146 RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
147 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.*) }"
148 DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }"
149 INIT_LIT=".init.literal 0 : { *(.init.literal) }"
150 INIT=".init 0 : { *(.init) }"
151 FINI_LIT=".fini.literal 0 : { *(.fini.literal) }"
152 FINI=".fini 0 : { *(.fini) }"
153 if test -z "${NO_SMALL_DATA}"; then
154 SBSS=".sbss ${RELOCATING-0} :
156 ${RELOCATING+${SBSS_START_SYMBOLS}}
157 ${CREATE_SHLIB+*(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)}
159 *(.sbss${RELOCATING+ .sbss.* .gnu.linkonce.sb.*})
161 ${RELOCATING+${SBSS_END_SYMBOLS}}
163 SBSS2=".sbss2 ${RELOCATING-0} : { *(.sbss2${RELOCATING+ .sbss2.* .gnu.linkonce.sb2.*}) }"
164 SDATA="/* We want the small data sections together, so single-instruction offsets
165 can access them all, and initialized data all before uninitialized, so
166 we can shorten the on-disk segment size. */
167 .sdata ${RELOCATING-0} :
169 ${RELOCATING+${SDATA_START_SYMBOLS}}
170 ${CREATE_SHLIB+*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)}
171 *(.sdata${RELOCATING+ .sdata.* .gnu.linkonce.s.*})
173 SDATA2=".sdata2 ${RELOCATING-0} :
175 ${RELOCATING+${SDATA2_START_SYMBOLS}}
176 *(.sdata2${RELOCATING+ .sdata2.* .gnu.linkonce.s2.*})
178 REL_SDATA=".rel.sdata ${RELOCATING-0} : { *(.rel.sdata${RELOCATING+ .rel.sdata.* .rel.gnu.linkonce.s.*}) }
179 .rela.sdata ${RELOCATING-0} : { *(.rela.sdata${RELOCATING+ .rela.sdata.* .rela.gnu.linkonce.s.*}) }"
180 REL_SBSS=".rel.sbss ${RELOCATING-0} : { *(.rel.sbss${RELOCATING+ .rel.sbss.* .rel.gnu.linkonce.sb.*}) }
181 .rela.sbss ${RELOCATING-0} : { *(.rela.sbss${RELOCATING+ .rela.sbss.* .rela.gnu.linkonce.sb.*}) }"
182 REL_SDATA2=".rel.sdata2 ${RELOCATING-0} : { *(.rel.sdata2${RELOCATING+ .rel.sdata2.* .rel.gnu.linkonce.s2.*}) }
183 .rela.sdata2 ${RELOCATING-0} : { *(.rela.sdata2${RELOCATING+ .rela.sdata2.* .rela.gnu.linkonce.s2.*}) }"
184 REL_SBSS2=".rel.sbss2 ${RELOCATING-0} : { *(.rel.sbss2${RELOCATING+ .rel.sbss2.* .rel.gnu.linkonce.sb2.*}) }
185 .rela.sbss2 ${RELOCATING-0} : { *(.rela.sbss2${RELOCATING+ .rela.sbss2.* .rela.gnu.linkonce.sb2.*}) }"
189 if test -z "${DATA_GOT}"; then
190 if test -n "${NO_SMALL_DATA}"; then
194 if test -z "${SDATA_GOT}"; then
195 if test -z "${NO_SMALL_DATA}"; then
199 test -n "$SEPARATE_GOTPLT" && SEPARATE_GOTPLT=" "
200 test "${LARGE_SECTIONS}" = "yes" && REL_LARGE="
201 .rel.ldata ${RELOCATING-0} : { *(.rel.ldata${RELOCATING+ .rel.ldata.* .rel.gnu.linkonce.l.*}) }
202 .rela.ldata ${RELOCATING-0} : { *(.rela.ldata${RELOCATING+ .rela.ldata.* .rela.gnu.linkonce.l.*}) }
203 .rel.lbss ${RELOCATING-0} : { *(.rel.lbss${RELOCATING+ .rel.lbss.* .rel.gnu.linkonce.lb.*}) }
204 .rela.lbss ${RELOCATING-0} : { *(.rela.lbss${RELOCATING+ .rela.lbss.* .rela.gnu.linkonce.lb.*}) }
205 .rel.lrodata ${RELOCATING-0} : { *(.rel.lrodata${RELOCATING+ .rel.lrodata.* .rel.gnu.linkonce.lr.*}) }
206 .rela.lrodata ${RELOCATING-0} : { *(.rela.lrodata${RELOCATING+ .rela.lrodata.* .rela.gnu.linkonce.lr.*}) }"
207 test "${LARGE_SECTIONS}" = "yes" && OTHER_BSS_SECTIONS="
208 ${OTHER_BSS_SECTIONS}
209 .lbss ${RELOCATING-0} :
212 *(.lbss${RELOCATING+ .lbss.* .gnu.linkonce.lb.*})
215 test "${LARGE_SECTIONS}" = "yes" && LARGE_SECTIONS="
216 .lrodata ${RELOCATING-0} ${RELOCATING+ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))} :
218 *(.lrodata${RELOCATING+ .lrodata.* .gnu.linkonce.lr.*})
220 .ldata ${RELOCATING-0} ${RELOCATING+ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))} :
222 *(.ldata${RELOCATING+ .ldata.* .gnu.linkonce.l.*})
223 ${RELOCATING+. = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
225 INIT_ARRAY=".init_array ${RELOCATING-0} :
227 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_start = .);}}
228 KEEP (*(SORT(.init_array.*)))
229 KEEP (*(.init_array))
230 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_end = .);}}
232 FINI_ARRAY=".fini_array ${RELOCATING-0} :
234 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_start = .);}}
235 KEEP (*(SORT(.fini_array.*)))
236 KEEP (*(.fini_array))
237 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_end = .);}}
239 CTOR=".ctors ${CONSTRUCTING-0} :
241 ${CONSTRUCTING+${CTOR_START}}
242 /* gcc uses crtbegin.o to find the start of
243 the constructors, so we make sure it is
244 first. Because this is a wildcard, it
245 doesn't matter if the user does not
246 actually link against crtbegin.o; the
247 linker won't look for a file to match a
248 wildcard. The wildcard also means that it
249 doesn't matter which directory crtbegin.o
252 KEEP (*crtbegin.o(.ctors))
253 KEEP (*crtbegin?.o(.ctors))
255 /* We don't want to include the .ctor section from
256 the crtend.o file until after the sorted ctors.
257 The .ctor section from the crtend file contains the
258 end of ctors marker and it must be last */
260 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors))
261 KEEP (*(SORT(.ctors.*)))
263 ${CONSTRUCTING+${CTOR_END}}
265 DTOR=".dtors ${CONSTRUCTING-0} :
267 ${CONSTRUCTING+${DTOR_START}}
268 KEEP (*crtbegin.o(.dtors))
269 KEEP (*crtbegin?.o(.dtors))
270 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors))
271 KEEP (*(SORT(.dtors.*)))
273 ${CONSTRUCTING+${DTOR_END}}
275 STACK=" .stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} :
277 ${RELOCATING+_stack = .;}
281 # If this is for an embedded system, don't add SIZEOF_HEADERS.
282 if [ -z "$EMBEDDED" ]; then
283 test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR} + SIZEOF_HEADERS"
285 test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}"
289 /* Copyright (C) 2014-2016 Free Software Foundation, Inc.
291 Copying and distribution of this script, with or without modification,
292 are permitted in any medium without royalty provided the copyright
293 notice and this notice are preserved. */
295 ${RELOCATING+ENTRY(${ENTRY})}
297 ${RELOCATING+${LIB_SEARCH_DIRS}}
298 ${RELOCATING+${EXECUTABLE_SYMBOLS}}
299 ${RELOCATING+${INPUT_FILES}}
300 ${RELOCATING- /* For some reason, the Solaris linker makes bad executables
301 if gld -r is used and the intermediate file has sections starting
302 at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld
303 bug. But for now assigning the zero vmas works. */}
307 /* Read-only sections, merged into text segment: */
308 ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+PROVIDE (__executable_start = ${TEXT_START_ADDR}); . = ${TEXT_BASE_ADDRESS};}}}
309 ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}}
310 ${CREATE_PIE+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}}
311 ${INITIAL_READONLY_SECTIONS}
312 .note.gnu.build-id : { *(.note.gnu.build-id) }
315 test -n "${RELOCATING+0}" || unset NON_ALLOC_DYN
316 test -z "${NON_ALLOC_DYN}" || TEXT_DYNAMIC=
317 cat > ldscripts/dyntmp.$$ <<EOF
318 ${TEXT_DYNAMIC+${DYNAMIC}}
319 .hash ${RELOCATING-0} : { *(.hash) }
320 .gnu.hash ${RELOCATING-0} : { *(.gnu.hash) }
321 .dynsym ${RELOCATING-0} : { *(.dynsym) }
322 .dynstr ${RELOCATING-0} : { *(.dynstr) }
323 .gnu.version ${RELOCATING-0} : { *(.gnu.version) }
324 .gnu.version_d ${RELOCATING-0}: { *(.gnu.version_d) }
325 .gnu.version_r ${RELOCATING-0}: { *(.gnu.version_r) }
328 if [ "x$COMBRELOC" = x ]; then
329 COMBRELOCCAT="cat >> ldscripts/dyntmp.$$"
331 COMBRELOCCAT="cat > $COMBRELOC"
333 eval $COMBRELOCCAT <<EOF
334 .rel.init ${RELOCATING-0} : { *(.rel.init) }
335 .rela.init ${RELOCATING-0} : { *(.rela.init) }
336 .rel.text ${RELOCATING-0} : { *(.rel.text${RELOCATING+ .rel.text.* .rel.gnu.linkonce.t.*}) }
337 .rela.text ${RELOCATING-0} : { *(.rela.text${RELOCATING+ .rela.text.* .rela.gnu.linkonce.t.*}) }
338 .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
339 .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
340 .rel.rodata ${RELOCATING-0} : { *(.rel.rodata${RELOCATING+ .rel.rodata.* .rel.gnu.linkonce.r.*}) }
341 .rela.rodata ${RELOCATING-0} : { *(.rela.rodata${RELOCATING+ .rela.rodata.* .rela.gnu.linkonce.r.*}) }
342 ${OTHER_READONLY_RELOC_SECTIONS}
343 .rel.data.rel.ro ${RELOCATING-0} : { *(.rel.data.rel.ro${RELOCATING+ .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*}) }
344 .rela.data.rel.ro ${RELOCATING-0} : { *(.rela.data.rel.ro${RELOCATING+ .rela.data.rel.ro.* .rela.gnu.linkonce.d.rel.ro.*}) }
345 .rel.data ${RELOCATING-0} : { *(.rel.data${RELOCATING+ .rel.data.* .rel.gnu.linkonce.d.*}) }
346 .rela.data ${RELOCATING-0} : { *(.rela.data${RELOCATING+ .rela.data.* .rela.gnu.linkonce.d.*}) }
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 ${RELOCATING-0} : { *(.rel.bss${RELOCATING+ .rel.bss.* .rel.gnu.linkonce.b.*}) }
363 .rela.bss ${RELOCATING-0} : { *(.rela.bss${RELOCATING+ .rela.bss.* .rela.gnu.linkonce.b.*}) }
367 if [ -n "$COMBRELOC" ]; then
368 cat >> ldscripts/dyntmp.$$ <<EOF
369 .rel.dyn ${RELOCATING-0} :
372 sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rela\./d;s/^.*: { *\(.*\)}$/ \1/' $COMBRELOC >> ldscripts/dyntmp.$$
373 cat >> ldscripts/dyntmp.$$ <<EOF
375 .rela.dyn ${RELOCATING-0} :
378 sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rel\./d;s/^.*: { *\(.*\)}/ \1/' $COMBRELOC >> ldscripts/dyntmp.$$
379 cat >> ldscripts/dyntmp.$$ <<EOF
384 cat >> ldscripts/dyntmp.$$ <<EOF
385 .rel.plt ${RELOCATING-0} : { *(.rel.plt) }
386 .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
387 ${OTHER_PLT_RELOC_SECTIONS}
390 if test -z "${NON_ALLOC_DYN}"; then
391 if test -z "${NO_REL_RELOCS}${NO_RELA_RELOCS}"; then
392 cat ldscripts/dyntmp.$$
394 if test -z "${NO_REL_RELOCS}"; then
395 sed -e '/^[ ]*\.rela\.[^}]*$/,/}/d' -e '/^[ ]*\.rela\./d' ldscripts/dyntmp.$$
397 if test -z "${NO_RELA_RELOCS}"; then
398 sed -e '/^[ ]*\.rel\.[^}]*$/,/}/d' -e '/^[ ]*\.rel\./d' ldscripts/dyntmp.$$
401 rm -f ldscripts/dyntmp.$$
405 ${RELOCATING-$INIT_LIT}
409 ${TINY_READONLY_SECTION}
410 .text ${RELOCATING-0} :
414 ${RELOCATING+${INIT_START}}
415 ${RELOCATING+KEEP (*(.init.literal))}
416 ${RELOCATING+KEEP (*(SORT_NONE(.init)))}
417 ${RELOCATING+${INIT_END}}
419 ${RELOCATING+${TEXT_START_SYMBOLS}}
420 *(.literal .text .stub${RELOCATING+ .literal.* .text.* .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*})
421 /* .gnu.warning sections are handled specially by elf32.em. */
423 ${RELOCATING+${OTHER_TEXT_SECTIONS}}
425 ${RELOCATING+${FINI_START}}
426 ${RELOCATING+KEEP (*(.fini.literal))}
427 ${RELOCATING+KEEP (*(SORT_NONE(.fini)))}
428 ${RELOCATING+${FINI_END}}
431 ${RELOCATING-$FINI_LIT}
434 ${RELOCATING+PROVIDE (__${ETEXT_NAME} = .);}
435 ${RELOCATING+PROVIDE (_${ETEXT_NAME} = .);}
436 ${RELOCATING+PROVIDE (${ETEXT_NAME} = .);}
437 ${WRITABLE_RODATA-${RODATA}}
438 .rodata1 ${RELOCATING-0} : { *(.rodata1) }
439 ${CREATE_SHLIB-${SDATA2}}
440 ${CREATE_SHLIB-${SBSS2}}
441 ${OTHER_READONLY_SECTIONS}
442 .eh_frame_hdr : { *(.eh_frame_hdr) }
443 .eh_frame ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame)) }
444 .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
446 /* Adjust the address for the data segment. We want to adjust up to
447 the same address within the page on the next page up. */
448 ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}}
449 ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}
450 ${CREATE_PIE+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}
452 /* Exception handling */
453 .eh_frame ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame)) }
454 .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
456 /* Thread Local Storage sections */
457 .tdata ${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) }
458 .tbss ${RELOCATING-0} : { *(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} }
460 .preinit_array ${RELOCATING-0} :
462 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_start = .);}}
463 KEEP (*(.preinit_array))
464 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_end = .);}}
466 ${RELOCATING+${INIT_ARRAY}}
467 ${RELOCATING+${FINI_ARRAY}}
468 ${SMALL_DATA_CTOR-${RELOCATING+${CTOR}}}
469 ${SMALL_DATA_DTOR-${RELOCATING+${DTOR}}}
470 .jcr ${RELOCATING-0} : { KEEP (*(.jcr)) }
472 ${RELOCATING+${DATARELRO}}
473 ${OTHER_RELRO_SECTIONS}
474 ${TEXT_DYNAMIC-${DYNAMIC}}
475 ${DATA_GOT+${RELRO_NOW+${GOT}}}
476 ${DATA_GOT+${RELRO_NOW+${GOTPLT}}}
477 ${DATA_GOT+${RELRO_NOW-${SEPARATE_GOTPLT+${GOT}}}}
478 ${RELOCATING+${DATA_SEGMENT_RELRO_END}}
479 ${DATA_GOT+${RELRO_NOW-${SEPARATE_GOTPLT-${GOT}}}}
480 ${DATA_GOT+${RELRO_NOW-${GOTPLT}}}
482 ${DATA_PLT+${PLT_BEFORE_GOT-${PLT}}}
484 .data ${RELOCATING-0} :
486 ${RELOCATING+${DATA_START_SYMBOLS}}
487 *(.data${RELOCATING+ .data.* .gnu.linkonce.d.*})
488 ${CONSTRUCTING+SORT(CONSTRUCTORS)}
490 .data1 ${RELOCATING-0} : { *(.data1) }
491 ${WRITABLE_RODATA+${RODATA}}
492 ${OTHER_READWRITE_SECTIONS}
493 ${SMALL_DATA_CTOR+${RELOCATING+${CTOR}}}
494 ${SMALL_DATA_DTOR+${RELOCATING+${DTOR}}}
495 ${DATA_PLT+${PLT_BEFORE_GOT+${PLT}}}
496 ${SDATA_GOT+${RELOCATING+${OTHER_GOT_SYMBOLS}}}
498 ${SDATA_GOT+${OTHER_GOT_SECTIONS}}
500 ${OTHER_SDATA_SECTIONS}
501 ${RELOCATING+${DATA_END_SYMBOLS-${USER_LABEL_PREFIX}_edata = .; PROVIDE (${USER_LABEL_PREFIX}edata = .);}}
502 ${RELOCATING+__bss_start = .;}
503 ${RELOCATING+${OTHER_BSS_SYMBOLS}}
506 .bss ${RELOCATING-0} :
509 *(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*})
511 /* Align here to ensure that the .bss section occupies space up to
512 _end. Align after .bss to ensure correct alignment even if the
513 .bss section disappears because there are no input sections.
514 FIXME: Why do we need it? When there is no .bss section, we don't
515 pad the .data section. */
516 ${RELOCATING+. = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
518 ${OTHER_BSS_SECTIONS}
519 ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
520 ${RELOCATING+. = ALIGN(${ALIGNMENT});}
522 ${RELOCATING+. = ALIGN(${ALIGNMENT});}
523 ${RELOCATING+${OTHER_END_SYMBOLS}}
524 ${RELOCATING+${END_SYMBOLS-${USER_LABEL_PREFIX}_end = .; PROVIDE (${USER_LABEL_PREFIX}end = .);}}
525 ${RELOCATING+${DATA_SEGMENT_END}}
528 if test -n "${NON_ALLOC_DYN}"; then
529 if test -z "${NO_REL_RELOCS}${NO_RELA_RELOCS}"; then
530 cat ldscripts/dyntmp.$$
532 if test -z "${NO_REL_RELOCS}"; then
533 sed -e '/^[ ]*\.rela\.[^}]*$/,/}/d' -e '/^[ ]*\.rela\./d' ldscripts/dyntmp.$$
535 if test -z "${NO_RELA_RELOCS}"; then
536 sed -e '/^[ ]*\.rel\.[^}]*$/,/}/d' -e '/^[ ]*\.rel\./d' ldscripts/dyntmp.$$
539 rm -f ldscripts/dyntmp.$$
543 /* Stabs debugging sections. */
544 .stab 0 : { *(.stab) }
545 .stabstr 0 : { *(.stabstr) }
546 .stab.excl 0 : { *(.stab.excl) }
547 .stab.exclstr 0 : { *(.stab.exclstr) }
548 .stab.index 0 : { *(.stab.index) }
549 .stab.indexstr 0 : { *(.stab.indexstr) }
551 .comment 0 : { *(.comment) }
555 . $srcdir/scripttempl/DWARF.sc
561 ${STACK_ADDR+${STACK}}
564 ${RELOCATING+${OTHER_SYMBOLS}}
565 ${RELOCATING+${DISCARDED}}