]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - ld/scripttempl/elf.sc
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / ld / scripttempl / elf.sc
1 # Copyright (C) 2014-2021 Free Software Foundation, Inc.
2 #
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.
6 #
7 # Unusual variables checked by this code:
8 # NOP - four byte opcode for no-op (defaults to none)
9 # NO_SMALL_DATA - no .sbss/.sbss2/.sdata/.sdata2 sections if not
10 # empty.
11 # HAVE_NOINIT - Include a .noinit output section in the script.
12 # HAVE_PERSISTENT - Include a .persistent output section in the script.
13 # SMALL_DATA_CTOR - .ctors contains small data.
14 # SMALL_DATA_DTOR - .dtors contains small data.
15 # DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
16 # INITIAL_READONLY_SECTIONS - at start of text segment
17 # OTHER_READONLY_SECTIONS - other than .text .init .rodata ...
18 # (e.g., .PARISC.milli)
19 # OTHER_TEXT_SECTIONS - these get put in .text when relocating
20 # INITIAL_READWRITE_SECTIONS - at start of data segment (after relro)
21 # OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ...
22 # (e.g., .PARISC.global)
23 # OTHER_RELRO_SECTIONS - other than .data.rel.ro ...
24 # (e.g. PPC32 .fixup, .got[12])
25 # OTHER_RELRO_SECTIONS_2 - as above, but after .dynamic in text segment
26 # OTHER_BSS_SECTIONS - other than .bss .sbss ...
27 # ATTRS_SECTIONS - at the end
28 # OTHER_SECTIONS - at the end
29 # EXECUTABLE_SYMBOLS - symbols that must be defined for an
30 # executable (e.g., _DYNAMIC_LINK)
31 # TEXT_START_ADDR - the first byte of the text segment, after any
32 # headers.
33 # TEXT_BASE_ADDRESS - the first byte of the text segment.
34 # TEXT_START_SYMBOLS - symbols that appear at the start of the
35 # .text section.
36 # DATA_START_SYMBOLS - symbols that appear at the start of the
37 # .data section.
38 # DATA_END_SYMBOLS - symbols that appear at the end of the
39 # writeable data sections.
40 # OTHER_GOT_SYMBOLS - symbols defined just before .got.
41 # OTHER_GOT_SECTIONS - sections just after .got.
42 # OTHER_PLT_SECTIONS - sections just after .plt.
43 # OTHER_SDATA_SECTIONS - sections just after .sdata.
44 # OTHER_BSS_SYMBOLS - symbols that appear at the start of the
45 # .bss section besides __bss_start.
46 # PLT_NEXT_DATA - .plt next to data segment when .plt is in text segment.
47 # DATA_PLT - .plt should be in data segment, not text segment.
48 # PLT_BEFORE_GOT - .plt just before .got when .plt is in data segement.
49 # BSS_PLT - .plt should be in bss segment
50 # NO_REL_RELOCS - Don't include .rel.* sections in script
51 # NO_RELA_RELOCS - Don't include .rela.* sections in script
52 # NON_ALLOC_DYN - Place dynamic sections after data segment.
53 # TEXT_DYNAMIC - .dynamic in text segment, not data segment.
54 # EMBEDDED - whether this is for an embedded system.
55 # SHLIB_TEXT_START_ADDR - if set, add to SIZEOF_HEADERS to set
56 # start address of shared library.
57 # INPUT_FILES - INPUT command of files to always include
58 # WRITABLE_RODATA - if set, the .rodata section should be writable
59 # INIT_START, INIT_END - statements just before and just after
60 # combination of .init sections.
61 # FINI_START, FINI_END - statements just before and just after
62 # combination of .fini sections.
63 # STACK_ADDR - start of a .stack section.
64 # OTHER_SYMBOLS - symbols to place right at the end of the script.
65 # ETEXT_NAME - name of a symbol for the end of the text section,
66 # normally etext.
67 # ETEXT_LAST_IN_RODATA_SEGMENT - emit ETEXT_NAME after all sections in
68 # the read-only data segment (which may or may not be equal to
69 # the code segment), instead of after just the code parts.
70 # SEPARATE_CODE - if set, .text and similar sections containing
71 # actual machine instructions must be in wholly disjoint
72 # pages from any other data, including headers
73 # SEPARATE_GOTPLT - if set, .got.plt should be separate output section,
74 # so that .got can be in the RELRO area. It should be set to
75 # the number of bytes in the beginning of .got.plt which can be
76 # in the RELRO area as well.
77 # USER_LABEL_PREFIX - prefix to add to user-visible symbols.
78 # RODATA_NAME, SDATA_NAME, SBSS_NAME, BSS_NAME - base parts of names
79 # for standard sections, without initial "." or suffixes.
80 #
81 # When adding sections, do note that the names of some sections are used
82 # when specifying the start address of the next.
83 #
84
85 # Many sections come in three flavours. There is the 'real' section,
86 # like ".data". Then there are the per-procedure or per-variable
87 # sections, generated by -ffunction-sections and -fdata-sections in GCC,
88 # and useful for --gc-sections, which for a variable "foo" might be
89 # ".data.foo". Then there are the linkonce sections, for which the linker
90 # eliminates duplicates, which are named like ".gnu.linkonce.d.foo".
91 # The exact correspondences are:
92 #
93 # Section Linkonce section
94 # .text .gnu.linkonce.t.foo
95 # .rodata .gnu.linkonce.r.foo
96 # .data .gnu.linkonce.d.foo
97 # .bss .gnu.linkonce.b.foo
98 # .sdata .gnu.linkonce.s.foo
99 # .sbss .gnu.linkonce.sb.foo
100 # .sdata2 .gnu.linkonce.s2.foo
101 # .sbss2 .gnu.linkonce.sb2.foo
102 # .debug_info .gnu.linkonce.wi.foo
103 # .tdata .gnu.linkonce.td.foo
104 # .tbss .gnu.linkonce.tb.foo
105 # .lrodata .gnu.linkonce.lr.foo
106 # .ldata .gnu.linkonce.l.foo
107 # .lbss .gnu.linkonce.lb.foo
108 # .noinit .gnu.linkonce.n.foo
109 # .persistent .gnu.linkonce.p.foo
110 #
111 # Each of these can also have corresponding .rel.* and .rela.* sections.
112
113 if test -n "$NOP"; then
114 FILL="=$NOP"
115 else
116 FILL=
117 fi
118
119 test -n "$CREATE_SHLIB$CREATE_PIE" && CREATE_PIC=" "
120 test -z "$RODATA_NAME" && RODATA_NAME=rodata
121 test -z "$SDATA_NAME" && SDATA_NAME=sdata
122 test -z "$SBSS_NAME" && SBSS_NAME=sbss
123 test -z "$BSS_NAME" && BSS_NAME=bss
124 test -z "$ENTRY" && ENTRY=${USER_LABEL_PREFIX}_start
125 test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
126 test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
127 if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi
128 test -z "${ELFSIZE}" && ELFSIZE=32
129 test -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8"
130 test "$LD_FLAG" = "N" && DATA_ADDR=.
131 test -z "${ETEXT_NAME}" && ETEXT_NAME=${USER_LABEL_PREFIX}etext
132 test -n "$RELRO_NOW" && unset SEPARATE_GOTPLT
133 test -z "$ATTRS_SECTIONS" && ATTRS_SECTIONS=".gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }"
134 if test -z "$DATA_SEGMENT_ALIGN"; then
135 test -n "$CREATE_SHLIB$CREATE_PIE" && test -n "$SHLIB_DATA_ADDR" && COMMONPAGESIZE=""
136 test -z "$CREATE_SHLIB$CREATE_PIE" && test -n "$DATA_ADDR" && COMMONPAGESIZE=""
137 DATA_SEGMENT_ALIGN="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))"
138 DATA_SEGMENT_RELRO_END=""
139 DATA_SEGMENT_END=""
140 if test -n "${COMMONPAGESIZE}"; then
141 if test "${SEGMENT_SIZE}" != "${MAXPAGESIZE}"; then
142 DATA_SEGMENT_ALIGN="ALIGN (${SEGMENT_SIZE}) - ((${MAXPAGESIZE} - .) & (${MAXPAGESIZE} - 1)); . = DATA_SEGMENT_ALIGN (${MAXPAGESIZE}, ${COMMONPAGESIZE})"
143 else
144 DATA_SEGMENT_ALIGN="DATA_SEGMENT_ALIGN (${MAXPAGESIZE}, ${COMMONPAGESIZE})"
145 fi
146 DATA_SEGMENT_END=". = DATA_SEGMENT_END (.);"
147 DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT-0}, .);"
148 fi
149 fi
150 if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}"; then
151 INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp) }"
152 fi
153 if test -z "$PLT"; then
154 IPLT=".iplt ${RELOCATING-0} : { *(.iplt) }"
155 PLT=".plt ${RELOCATING-0} : { *(.plt)${RELOCATING+${IREL_IN_PLT+ *(.iplt)}} }
156 ${IREL_IN_PLT-$IPLT}"
157 fi
158 test -n "${DATA_PLT-${BSS_PLT-text}}" && TEXT_PLT=
159 if test -z "$GOT"; then
160 if test -z "$SEPARATE_GOTPLT"; then
161 GOT=".got ${RELOCATING-0} : {${RELOCATING+ *(.got.plt) *(.igot.plt)} *(.got)${RELOCATING+ *(.igot)} }"
162 else
163 GOT=".got ${RELOCATING-0} : { *(.got)${RELOCATING+ *(.igot)} }"
164 GOTPLT=".got.plt ${RELOCATING-0} : { *(.got.plt)${RELOCATING+ *(.igot.plt)} }"
165 fi
166 fi
167 REL_IFUNC=".rel.ifunc ${RELOCATING-0} : { *(.rel.ifunc) }"
168 RELA_IFUNC=".rela.ifunc ${RELOCATING-0} : { *(.rela.ifunc) }"
169 REL_IPLT=".rel.iplt ${RELOCATING-0} :
170 {
171 ${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_start = .);}}
172 *(.rel.iplt)
173 ${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_end = .);}}
174 }"
175 RELA_IPLT=".rela.iplt ${RELOCATING-0} :
176 {
177 ${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_start = .);}}
178 *(.rela.iplt)
179 ${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_end = .);}}
180 }"
181 DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
182 RODATA=".${RODATA_NAME} ${RELOCATING-0} : { *(.${RODATA_NAME}${RELOCATING+ .${RODATA_NAME}.* .gnu.linkonce.r.*}) }"
183 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.*) }"
184 DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }"
185 if test -z "${NO_SMALL_DATA}"; then
186 SBSS=".${SBSS_NAME} ${RELOCATING-0} :
187 {
188 ${RELOCATING+${SBSS_START_SYMBOLS}}
189 ${CREATE_SHLIB+*(.${SBSS_NAME}2 .${SBSS_NAME}2.* .gnu.linkonce.sb2.*)}
190 ${RELOCATING+*(.dyn${SBSS_NAME})}
191 *(.${SBSS_NAME}${RELOCATING+ .${SBSS_NAME}.* .gnu.linkonce.sb.*})
192 ${RELOCATING+*(.scommon)}
193 ${RELOCATING+${SBSS_END_SYMBOLS}}
194 }"
195 SBSS2=".${SBSS_NAME}2 ${RELOCATING-0} : { *(.${SBSS_NAME}2${RELOCATING+ .${SBSS_NAME}2.* .gnu.linkonce.sb2.*}) }"
196 SDATA="/* We want the small data sections together, so single-instruction offsets
197 can access them all, and initialized data all before uninitialized, so
198 we can shorten the on-disk segment size. */
199 .${SDATA_NAME} ${RELOCATING-0} :
200 {
201 ${RELOCATING+${SDATA_START_SYMBOLS}}
202 ${CREATE_SHLIB+*(.${SDATA_NAME}2 .${SDATA_NAME}2.* .gnu.linkonce.s2.*)}
203 *(.${SDATA_NAME}${RELOCATING+ .${SDATA_NAME}.* .gnu.linkonce.s.*})
204 }"
205 SDATA2=".${SDATA_NAME}2 ${RELOCATING-0} :
206 {
207 ${RELOCATING+${SDATA2_START_SYMBOLS}}
208 *(.${SDATA_NAME}2${RELOCATING+ .${SDATA_NAME}2.* .gnu.linkonce.s2.*})
209 }"
210 REL_SDATA=".rel.${SDATA_NAME} ${RELOCATING-0} : { *(.rel.${SDATA_NAME}${RELOCATING+ .rel.${SDATA_NAME}.* .rel.gnu.linkonce.s.*}) }
211 .rela.${SDATA_NAME} ${RELOCATING-0} : { *(.rela.${SDATA_NAME}${RELOCATING+ .rela.${SDATA_NAME}.* .rela.gnu.linkonce.s.*}) }"
212 REL_SBSS=".rel.${SBSS_NAME} ${RELOCATING-0} : { *(.rel.${SBSS_NAME}${RELOCATING+ .rel.${SBSS_NAME}.* .rel.gnu.linkonce.sb.*}) }
213 .rela.${SBSS_NAME} ${RELOCATING-0} : { *(.rela.${SBSS_NAME}${RELOCATING+ .rela.${SBSS_NAME}.* .rela.gnu.linkonce.sb.*}) }"
214 REL_SDATA2=".rel.${SDATA_NAME}2 ${RELOCATING-0} : { *(.rel.${SDATA_NAME}2${RELOCATING+ .rel.${SDATA_NAME}2.* .rel.gnu.linkonce.s2.*}) }
215 .rela.${SDATA_NAME}2 ${RELOCATING-0} : { *(.rela.${SDATA_NAME}2${RELOCATING+ .rela.${SDATA_NAME}2.* .rela.gnu.linkonce.s2.*}) }"
216 REL_SBSS2=".rel.${SBSS_NAME}2 ${RELOCATING-0} : { *(.rel.${SBSS_NAME}2${RELOCATING+ .rel.${SBSS_NAME}2.* .rel.gnu.linkonce.sb2.*}) }
217 .rela.${SBSS_NAME}2 ${RELOCATING-0} : { *(.rela.${SBSS_NAME}2${RELOCATING+ .rela.${SBSS_NAME}2.* .rela.gnu.linkonce.sb2.*}) }"
218 else
219 NO_SMALL_DATA=" "
220 fi
221 if test -z "${SDATA_GOT}${DATA_GOT}"; then
222 if test -n "${NO_SMALL_DATA}"; then
223 DATA_GOT=" "
224 fi
225 fi
226 if test -z "${SDATA_GOT}${DATA_GOT}"; then
227 if test -z "${NO_SMALL_DATA}"; then
228 SDATA_GOT=" "
229 fi
230 fi
231 test -n "$SEPARATE_GOTPLT" && SEPARATE_GOTPLT=" "
232 test "${LARGE_SECTIONS}" = "yes" && REL_LARGE="
233 .rel.ldata ${RELOCATING-0} : { *(.rel.ldata${RELOCATING+ .rel.ldata.* .rel.gnu.linkonce.l.*}) }
234 .rela.ldata ${RELOCATING-0} : { *(.rela.ldata${RELOCATING+ .rela.ldata.* .rela.gnu.linkonce.l.*}) }
235 .rel.lbss ${RELOCATING-0} : { *(.rel.lbss${RELOCATING+ .rel.lbss.* .rel.gnu.linkonce.lb.*}) }
236 .rela.lbss ${RELOCATING-0} : { *(.rela.lbss${RELOCATING+ .rela.lbss.* .rela.gnu.linkonce.lb.*}) }
237 .rel.lrodata ${RELOCATING-0} : { *(.rel.lrodata${RELOCATING+ .rel.lrodata.* .rel.gnu.linkonce.lr.*}) }
238 .rela.lrodata ${RELOCATING-0} : { *(.rela.lrodata${RELOCATING+ .rela.lrodata.* .rela.gnu.linkonce.lr.*}) }"
239 test "${LARGE_SECTIONS}" = "yes" && LARGE_BSS="
240 .lbss ${RELOCATING-0} :
241 {
242 ${RELOCATING+*(.dynlbss)}
243 *(.lbss${RELOCATING+ .lbss.* .gnu.linkonce.lb.*})
244 ${RELOCATING+*(LARGE_COMMON)}
245 }"
246 test "${LARGE_SECTIONS}" = "yes" && LARGE_SECTIONS="
247 .lrodata ${RELOCATING-0} ${RELOCATING+ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))} :
248 {
249 *(.lrodata${RELOCATING+ .lrodata.* .gnu.linkonce.lr.*})
250 }
251 .ldata ${RELOCATING-0} ${RELOCATING+ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))} :
252 {
253 *(.ldata${RELOCATING+ .ldata.* .gnu.linkonce.l.*})
254 ${RELOCATING+. = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
255 }"
256 if test "${ENABLE_INITFINI_ARRAY}" = "yes"; then
257 SORT_INIT_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))"
258 SORT_FINI_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))"
259 CTORS_IN_INIT_ARRAY="EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors"
260 DTORS_IN_FINI_ARRAY="EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors"
261 else
262 SORT_INIT_ARRAY="KEEP (*(SORT(.init_array.*)))"
263 SORT_FINI_ARRAY="KEEP (*(SORT(.fini_array.*)))"
264 CTORS_IN_INIT_ARRAY=
265 DTORS_IN_FINI_ARRAY=
266 fi
267 PREINIT_ARRAY=".preinit_array :
268 {
269 ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_start = .);}
270 KEEP (*(.preinit_array))
271 ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_end = .);}
272 }"
273 INIT_ARRAY=".init_array :
274 {
275 ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_start = .);}
276 ${SORT_INIT_ARRAY}
277 KEEP (*(.init_array ${CTORS_IN_INIT_ARRAY}))
278 ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_end = .);}
279 }"
280 FINI_ARRAY=".fini_array :
281 {
282 ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_start = .);}
283 ${SORT_FINI_ARRAY}
284 KEEP (*(.fini_array ${DTORS_IN_FINI_ARRAY}))
285 ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_end = .);}
286 }"
287 CTOR=".ctors ${CONSTRUCTING-0} :
288 {
289 ${CONSTRUCTING+${CTOR_START}}
290 /* gcc uses crtbegin.o to find the start of
291 the constructors, so we make sure it is
292 first. Because this is a wildcard, it
293 doesn't matter if the user does not
294 actually link against crtbegin.o; the
295 linker won't look for a file to match a
296 wildcard. The wildcard also means that it
297 doesn't matter which directory crtbegin.o
298 is in. */
299
300 KEEP (*crtbegin.o(.ctors))
301 KEEP (*crtbegin?.o(.ctors))
302
303 /* We don't want to include the .ctor section from
304 the crtend.o file until after the sorted ctors.
305 The .ctor section from the crtend file contains the
306 end of ctors marker and it must be last */
307
308 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors))
309 KEEP (*(SORT(.ctors.*)))
310 KEEP (*(.ctors))
311 ${CONSTRUCTING+${CTOR_END}}
312 }"
313 DTOR=".dtors ${CONSTRUCTING-0} :
314 {
315 ${CONSTRUCTING+${DTOR_START}}
316 KEEP (*crtbegin.o(.dtors))
317 KEEP (*crtbegin?.o(.dtors))
318 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors))
319 KEEP (*(SORT(.dtors.*)))
320 KEEP (*(.dtors))
321 ${CONSTRUCTING+${DTOR_END}}
322 }"
323 STACK=".stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} :
324 {
325 ${RELOCATING+${USER_LABEL_PREFIX}_stack = .;}
326 *(.stack)
327 ${RELOCATING+${STACK_SENTINEL}}
328 }"
329 test "${HAVE_NOINIT}" = "yes" && NOINIT="
330 /* This section contains data that is not initialized during load,
331 or during the application's initialization sequence. */
332 .noinit (NOLOAD) :
333 {
334 ${RELOCATING+. = ALIGN(${ALIGNMENT});}
335 ${RELOCATING+PROVIDE (__noinit_start = .);}
336 *(.noinit${RELOCATING+ .noinit.* .gnu.linkonce.n.*})
337 ${RELOCATING+. = ALIGN(${ALIGNMENT});}
338 ${RELOCATING+PROVIDE (__noinit_end = .);}
339 }"
340 test "${HAVE_PERSISTENT}" = "yes" && PERSISTENT="
341 /* This section contains data that is initialized during load,
342 but not during the application's initialization sequence. */
343 .persistent :
344 {
345 ${RELOCATING+. = ALIGN(${ALIGNMENT});}
346 ${RELOCATING+PROVIDE (__persistent_start = .);}
347 *(.persistent${RELOCATING+ .persistent.* .gnu.linkonce.p.*})
348 ${RELOCATING+. = ALIGN(${ALIGNMENT});}
349 ${RELOCATING+PROVIDE (__persistent_end = .);}
350 }"
351
352 TEXT_START_ADDR="SEGMENT_START(\"text-segment\", ${TEXT_START_ADDR})"
353 SHLIB_TEXT_START_ADDR="SEGMENT_START(\"text-segment\", ${SHLIB_TEXT_START_ADDR:-0})"
354
355 # Don't bother with separate code segment when there are data sections
356 # between .plt and .text.
357 if test -z "$TINY_READONLY_SECTION"; then
358 case "$LD_FLAG" in
359 *textonly*)
360 SEPARATE_TEXT=" "
361 TEXT_SEGMENT_ALIGN=". = ALIGN(${MAXPAGESIZE});"
362 ;;
363 esac
364 fi
365
366 if [ -z "$SEPARATE_CODE" ]; then
367 SIZEOF_HEADERS_CODE=" + SIZEOF_HEADERS"
368 else
369 SIZEOF_HEADERS_CODE=
370 fi
371
372 # If this is for an embedded system, don't add SIZEOF_HEADERS.
373 if [ -z "$EMBEDDED" ]; then
374 test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}${SIZEOF_HEADERS_CODE}"
375 else
376 test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}"
377 fi
378
379 cat <<EOF
380 /* Copyright (C) 2014-2021 Free Software Foundation, Inc.
381
382 Copying and distribution of this script, with or without modification,
383 are permitted in any medium without royalty provided the copyright
384 notice and this notice are preserved. */
385
386 OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
387 "${LITTLE_OUTPUT_FORMAT}")
388 OUTPUT_ARCH(${OUTPUT_ARCH})
389 ${RELOCATING+ENTRY(${ENTRY})}
390
391 ${RELOCATING+${LIB_SEARCH_DIRS}}
392 ${RELOCATING+${CREATE_SHLIB-${EXECUTABLE_SYMBOLS}}}
393 ${RELOCATING+${INPUT_FILES}}
394 ${RELOCATING- /* For some reason, the Solaris linker makes bad executables
395 if gld -r is used and the intermediate file has sections starting
396 at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld
397 bug. But for now assigning the zero vmas works. */}
398
399 SECTIONS
400 {
401 ${RELOCATING+${SEPARATE_TEXT-/* Read-only sections, merged into text segment: */}}
402 ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+PROVIDE (__executable_start = ${TEXT_START_ADDR}); . = ${TEXT_BASE_ADDRESS};}}}
403 ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR}${SIZEOF_HEADERS_CODE};}}
404 ${CREATE_PIE+${RELOCATING+PROVIDE (__executable_start = ${SHLIB_TEXT_START_ADDR}); . = ${SHLIB_TEXT_START_ADDR}${SIZEOF_HEADERS_CODE};}}
405 EOF
406
407 emit_early_ro()
408 {
409 cat <<EOF
410 ${INITIAL_READONLY_SECTIONS}
411 .note.gnu.build-id ${RELOCATING-0}: { *(.note.gnu.build-id) }
412 EOF
413 }
414
415 test -n "${SEPARATE_CODE}" || emit_early_ro
416
417 test -n "${RELOCATING+0}" || unset NON_ALLOC_DYN
418 test -z "${NON_ALLOC_DYN}" || TEXT_DYNAMIC=
419 cat > ldscripts/dyntmp.$$ <<EOF
420 ${TEXT_DYNAMIC+${DYNAMIC}}
421 .hash ${RELOCATING-0} : { *(.hash) }
422 .gnu.hash ${RELOCATING-0} : { *(.gnu.hash) }
423 .dynsym ${RELOCATING-0} : { *(.dynsym) }
424 .dynstr ${RELOCATING-0} : { *(.dynstr) }
425 .gnu.version ${RELOCATING-0} : { *(.gnu.version) }
426 .gnu.version_d ${RELOCATING-0}: { *(.gnu.version_d) }
427 .gnu.version_r ${RELOCATING-0}: { *(.gnu.version_r) }
428 EOF
429
430 if [ "x$COMBRELOC" = x ]; then
431 COMBRELOCCAT="cat >> ldscripts/dyntmp.$$"
432 else
433 COMBRELOCCAT="cat > $COMBRELOC"
434 fi
435 eval $COMBRELOCCAT <<EOF
436 ${INITIAL_RELOC_SECTIONS}
437 .rel.init ${RELOCATING-0} : { *(.rel.init) }
438 .rela.init ${RELOCATING-0} : { *(.rela.init) }
439 .rel.text ${RELOCATING-0} : { *(.rel.text${RELOCATING+ .rel.text.* .rel.gnu.linkonce.t.*}) }
440 .rela.text ${RELOCATING-0} : { *(.rela.text${RELOCATING+ .rela.text.* .rela.gnu.linkonce.t.*}) }
441 .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
442 .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
443 .rel.${RODATA_NAME} ${RELOCATING-0} : { *(.rel.${RODATA_NAME}${RELOCATING+ .rel.${RODATA_NAME}.* .rel.gnu.linkonce.r.*}) }
444 .rela.${RODATA_NAME} ${RELOCATING-0} : { *(.rela.${RODATA_NAME}${RELOCATING+ .rela.${RODATA_NAME}.* .rela.gnu.linkonce.r.*}) }
445 ${OTHER_READONLY_RELOC_SECTIONS}
446 .rel.data.rel.ro ${RELOCATING-0} : { *(.rel.data.rel.ro${RELOCATING+ .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*}) }
447 .rela.data.rel.ro ${RELOCATING-0} : { *(.rela.data.rel.ro${RELOCATING+ .rela.data.rel.ro.* .rela.gnu.linkonce.d.rel.ro.*}) }
448 .rel.data ${RELOCATING-0} : { *(.rel.data${RELOCATING+ .rel.data.* .rel.gnu.linkonce.d.*}) }
449 .rela.data ${RELOCATING-0} : { *(.rela.data${RELOCATING+ .rela.data.* .rela.gnu.linkonce.d.*}) }
450 ${OTHER_READWRITE_RELOC_SECTIONS}
451 .rel.tdata ${RELOCATING-0} : { *(.rel.tdata${RELOCATING+ .rel.tdata.* .rel.gnu.linkonce.td.*}) }
452 .rela.tdata ${RELOCATING-0} : { *(.rela.tdata${RELOCATING+ .rela.tdata.* .rela.gnu.linkonce.td.*}) }
453 .rel.tbss ${RELOCATING-0} : { *(.rel.tbss${RELOCATING+ .rel.tbss.* .rel.gnu.linkonce.tb.*}) }
454 .rela.tbss ${RELOCATING-0} : { *(.rela.tbss${RELOCATING+ .rela.tbss.* .rela.gnu.linkonce.tb.*}) }
455 .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
456 .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
457 .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
458 .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
459 .rel.got ${RELOCATING-0} : { *(.rel.got) }
460 .rela.got ${RELOCATING-0} : { *(.rela.got) }
461 ${OTHER_GOT_RELOC_SECTIONS}
462 ${REL_SDATA}
463 ${REL_SBSS}
464 ${REL_SDATA2}
465 ${REL_SBSS2}
466 .rel.${BSS_NAME} ${RELOCATING-0} : { *(.rel.${BSS_NAME}${RELOCATING+ .rel.${BSS_NAME}.* .rel.gnu.linkonce.b.*}) }
467 .rela.${BSS_NAME} ${RELOCATING-0} : { *(.rela.${BSS_NAME}${RELOCATING+ .rela.${BSS_NAME}.* .rela.gnu.linkonce.b.*}) }
468 ${REL_LARGE}
469 ${IREL_IN_PLT+$REL_IFUNC}
470 ${IREL_IN_PLT+$RELA_IFUNC}
471 ${IREL_IN_PLT-$REL_IPLT}
472 ${IREL_IN_PLT-$RELA_IPLT}
473 EOF
474
475 if [ -n "$COMBRELOC" ]; then
476 cat >> ldscripts/dyntmp.$$ <<EOF
477 .rel.dyn ${RELOCATING-0} :
478 {
479 EOF
480 sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rela\./d;/__rela_iplt_/d;s/^.*: { *\(.*\)}$/ \1/' $COMBRELOC >> ldscripts/dyntmp.$$
481 cat >> ldscripts/dyntmp.$$ <<EOF
482 }
483 .rela.dyn ${RELOCATING-0} :
484 {
485 EOF
486 sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rel\./d;/__rel_iplt_/d;s/^.*: { *\(.*\)}/ \1/' $COMBRELOC >> ldscripts/dyntmp.$$
487 cat >> ldscripts/dyntmp.$$ <<EOF
488 }
489 EOF
490 fi
491
492 cat >> ldscripts/dyntmp.$$ <<EOF
493 .rel.plt ${RELOCATING-0} :
494 {
495 *(.rel.plt)
496 ${IREL_IN_PLT+${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_start = .);}}}
497 ${IREL_IN_PLT+${RELOCATING+*(.rel.iplt)}}
498 ${IREL_IN_PLT+${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_end = .);}}}
499 }
500 .rela.plt ${RELOCATING-0} :
501 {
502 *(.rela.plt)
503 ${IREL_IN_PLT+${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_start = .);}}}
504 ${IREL_IN_PLT+${RELOCATING+*(.rela.iplt)}}
505 ${IREL_IN_PLT+${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_end = .);}}}
506 }
507 ${OTHER_PLT_RELOC_SECTIONS}
508 EOF
509
510 emit_dyn()
511 {
512 if test -z "${NO_REL_RELOCS}${NO_RELA_RELOCS}"; then
513 cat ldscripts/dyntmp.$$
514 else
515 if test -z "${NO_REL_RELOCS}"; then
516 sed -e '/^[ ]*\.rela\.[^}]*$/,/}/d;/^[ ]*\.rela\./d;/__rela_iplt_/d' ldscripts/dyntmp.$$
517 fi
518 if test -z "${NO_RELA_RELOCS}"; then
519 sed -e '/^[ ]*\.rel\.[^}]*$/,/}/d;/^[ ]*\.rel\./d;/__rel_iplt_/d' ldscripts/dyntmp.$$
520 fi
521 fi
522 rm -f ldscripts/dyntmp.$$
523 }
524
525 test -n "${NON_ALLOC_DYN}${SEPARATE_CODE}" || emit_dyn
526
527 cat <<EOF
528 ${RELOCATING+${TEXT_SEGMENT_ALIGN}}
529
530 .init ${RELOCATING-0}${RELOCATING+${INIT_ADDR}} :
531 {
532 ${RELOCATING+${INIT_START}}
533 KEEP (*(SORT_NONE(.init)))
534 ${RELOCATING+${INIT_END}}
535 } ${FILL}
536
537 ${TEXT_PLT+${PLT_NEXT_DATA-${PLT} ${OTHER_PLT_SECTIONS}}}
538 ${TINY_READONLY_SECTION}
539 .text ${RELOCATING-0} :
540 {
541 ${RELOCATING+${TEXT_START_SYMBOLS}}
542 ${RELOCATING+*(.text.unlikely .text.*_unlikely .text.unlikely.*)}
543 ${RELOCATING+*(.text.exit .text.exit.*)}
544 ${RELOCATING+*(.text.startup .text.startup.*)}
545 ${RELOCATING+*(.text.hot .text.hot.*)}
546 ${RELOCATING+*(SORT(.text.sorted.*))}
547 *(.text .stub${RELOCATING+ .text.* .gnu.linkonce.t.*})
548 /* .gnu.warning sections are handled specially by elf.em. */
549 *(.gnu.warning)
550 ${RELOCATING+${OTHER_TEXT_SECTIONS}}
551 } ${FILL}
552 .fini ${RELOCATING-0}${RELOCATING+${FINI_ADDR}} :
553 {
554 ${RELOCATING+${FINI_START}}
555 KEEP (*(SORT_NONE(.fini)))
556 ${RELOCATING+${FINI_END}}
557 } ${FILL}
558 ${RELOCATING+${ETEXT_LAST_IN_RODATA_SEGMENT-PROVIDE (__${ETEXT_NAME} = .);}}
559 ${RELOCATING+${ETEXT_LAST_IN_RODATA_SEGMENT-PROVIDE (_${ETEXT_NAME} = .);}}
560 ${RELOCATING+${ETEXT_LAST_IN_RODATA_SEGMENT-PROVIDE (${ETEXT_NAME} = .);}}
561 ${RELOCATING+${TEXT_SEGMENT_ALIGN}}
562 EOF
563
564 if test -n "${SEPARATE_CODE}${SEPARATE_TEXT}"; then
565 if test -n "${RODATA_ADDR}"; then
566 RODATA_ADDR="\
567 SEGMENT_START(\"rodata-segment\", ${RODATA_ADDR}) + SIZEOF_HEADERS"
568 else
569 RODATA_ADDR="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))"
570 RODATA_ADDR="SEGMENT_START(\"rodata-segment\", ${RODATA_ADDR})"
571 fi
572 if test -n "${SHLIB_RODATA_ADDR}"; then
573 SHLIB_RODATA_ADDR="\
574 SEGMENT_START(\"rodata-segment\", ${SHLIB_RODATA_ADDR}) + SIZEOF_HEADERS"
575 else
576 SHLIB_RODATA_ADDR="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))"
577 SHLIB_RODATA_ADDR="SEGMENT_START(\"rodata-segment\", ${SHLIB_RODATA_ADDR})"
578 fi
579 cat <<EOF
580 ${RELOCATING+/* Adjust the address for the rodata segment. We want to adjust up to
581 the same address within the page on the next page up. */
582 ${CREATE_SHLIB-${CREATE_PIE-. = ${RODATA_ADDR};}}
583 ${CREATE_SHLIB+. = ${SHLIB_RODATA_ADDR};}
584 ${CREATE_PIE+. = ${SHLIB_RODATA_ADDR};}}
585 EOF
586 if test -n "${SEPARATE_CODE}"; then
587 emit_early_ro
588 emit_dyn
589 fi
590 fi
591
592 cat <<EOF
593 ${WRITABLE_RODATA-${RODATA}}
594 .${RODATA_NAME}1 ${RELOCATING-0} : { *(.${RODATA_NAME}1) }
595 ${CREATE_SHLIB-${SDATA2}}
596 ${CREATE_SHLIB-${SBSS2}}
597 ${OTHER_READONLY_SECTIONS}
598 .eh_frame_hdr ${RELOCATING-0} : { *(.eh_frame_hdr)${RELOCATING+ *(.eh_frame_entry .eh_frame_entry.*)} }
599 .eh_frame ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame))${RELOCATING+ *(.eh_frame.*)} }
600 .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) }
601 .gnu_extab ${RELOCATING-0} : ONLY_IF_RO { *(.gnu_extab*) }
602 /* These sections are generated by the Sun/Oracle C++ compiler. */
603 .exception_ranges ${RELOCATING-0} : ONLY_IF_RO { *(.exception_ranges${RELOCATING+*}) }
604 ${TEXT_PLT+${PLT_NEXT_DATA+${PLT} ${OTHER_PLT_SECTIONS}}}
605
606 ${RELOCATING+${ETEXT_LAST_IN_RODATA_SEGMENT+PROVIDE (__${ETEXT_NAME} = .);}}
607 ${RELOCATING+${ETEXT_LAST_IN_RODATA_SEGMENT+PROVIDE (_${ETEXT_NAME} = .);}}
608 ${RELOCATING+${ETEXT_LAST_IN_RODATA_SEGMENT+PROVIDE (${ETEXT_NAME} = .);}}
609
610 ${RELOCATING+/* Adjust the address for the data segment. We want to adjust up to
611 the same address within the page on the next page up. */}
612 ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}}
613 ${CREATE_SHLIB+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}
614 ${CREATE_PIE+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}
615
616 /* Exception handling */
617 .eh_frame ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame))${RELOCATING+ *(.eh_frame.*)} }
618 .gnu_extab ${RELOCATING-0} : ONLY_IF_RW { *(.gnu_extab) }
619 .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) }
620 .exception_ranges ${RELOCATING-0} : ONLY_IF_RW { *(.exception_ranges${RELOCATING+*}) }
621
622 /* Thread Local Storage sections */
623 .tdata ${RELOCATING-0} :
624 {
625 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__tdata_start = .);}}
626 *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*})
627 }
628 .tbss ${RELOCATING-0} : { *(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} }
629
630 ${RELOCATING+${PREINIT_ARRAY}}
631 ${RELOCATING+${INIT_ARRAY}}
632 ${RELOCATING+${FINI_ARRAY}}
633 ${SMALL_DATA_CTOR-${RELOCATING+${CTOR}}}
634 ${SMALL_DATA_DTOR-${RELOCATING+${DTOR}}}
635 .jcr ${RELOCATING-0} : { KEEP (*(.jcr)) }
636
637 ${RELOCATING+${DATARELRO}}
638 ${OTHER_RELRO_SECTIONS}
639 ${TEXT_DYNAMIC-${DYNAMIC}}
640 ${OTHER_RELRO_SECTIONS_2}
641 ${DATA_GOT+${RELRO_NOW+${DATA_PLT+${PLT_BEFORE_GOT+${PLT}}}}}
642 ${DATA_GOT+${RELRO_NOW+${GOT}}}
643 ${DATA_GOT+${RELRO_NOW+${GOTPLT}}}
644 ${DATA_GOT+${RELRO_NOW-${SEPARATE_GOTPLT+${GOT}}}}
645 ${RELOCATING+${DATA_SEGMENT_RELRO_END}}
646 ${INITIAL_READWRITE_SECTIONS}
647 ${DATA_SDATA+${SDATA}}
648 ${DATA_SDATA+${OTHER_SDATA_SECTIONS}}
649 ${DATA_SDATA+${SBSS}}
650 ${DATA_GOT+${RELRO_NOW-${DATA_PLT+${PLT_BEFORE_GOT+${PLT}}}}}
651 ${DATA_GOT+${RELRO_NOW-${SEPARATE_GOTPLT-${GOT}}}}
652 ${DATA_GOT+${RELRO_NOW-${GOTPLT}}}
653
654 ${DATA_PLT+${PLT_BEFORE_GOT-${PLT}}}
655
656 .data ${RELOCATING-0} :
657 {
658 ${RELOCATING+${DATA_START_SYMBOLS}}
659 *(.data${RELOCATING+ .data.* .gnu.linkonce.d.*})
660 ${CONSTRUCTING+SORT(CONSTRUCTORS)}
661 }
662 .data1 ${RELOCATING-0} : { *(.data1) }
663 ${WRITABLE_RODATA+${RODATA}}
664 ${OTHER_READWRITE_SECTIONS}
665 ${SMALL_DATA_CTOR+${RELOCATING+${CTOR}}}
666 ${SMALL_DATA_DTOR+${RELOCATING+${DTOR}}}
667 ${SDATA_GOT+${DATA_PLT+${PLT_BEFORE_GOT+${PLT}}}}
668 ${SDATA_GOT+${RELOCATING+${OTHER_GOT_SYMBOLS+. = .; ${OTHER_GOT_SYMBOLS}}}}
669 ${SDATA_GOT+${GOT}}
670 ${SDATA_GOT+${OTHER_GOT_SECTIONS}}
671 ${DATA_SDATA-${SDATA}}
672 ${DATA_SDATA-${OTHER_SDATA_SECTIONS}}
673 ${RELOCATING+${DATA_END_SYMBOLS-${CREATE_SHLIB+PROVIDE (}${USER_LABEL_PREFIX}_edata = .${CREATE_SHLIB+)}; PROVIDE (${USER_LABEL_PREFIX}edata = .);}}
674 ${PERSISTENT}
675 ${RELOCATING+. = .;}
676 ${RELOCATING+${CREATE_SHLIB+PROVIDE (}${USER_LABEL_PREFIX}__bss_start = .${CREATE_SHLIB+)};}
677 ${RELOCATING+${OTHER_BSS_SYMBOLS}}
678 ${DATA_SDATA-${SBSS}}
679 ${BSS_PLT+${PLT}}
680 .${BSS_NAME} ${RELOCATING-0} :
681 {
682 ${RELOCATING+*(.dynbss)}
683 *(.${BSS_NAME}${RELOCATING+ .${BSS_NAME}.* .gnu.linkonce.b.*})
684 ${RELOCATING+*(COMMON)
685 /* Align here to ensure that the .bss section occupies space up to
686 _end. Align after .bss to ensure correct alignment even if the
687 .bss section disappears because there are no input sections.
688 FIXME: Why do we need it? When there is no .bss section, we do not
689 pad the .data section. */
690 . = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
691 }
692 ${OTHER_BSS_SECTIONS}
693 ${LARGE_BSS_AFTER_BSS+${LARGE_BSS}}
694 ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
695 ${NOINIT}
696 ${RELOCATING+. = ALIGN(${ALIGNMENT});}
697 EOF
698
699 LARGE_DATA_ADDR=". = SEGMENT_START(\"ldata-segment\", ${LARGE_DATA_ADDR-.});"
700 SHLIB_LARGE_DATA_ADDR=". = SEGMENT_START(\"ldata-segment\", ${SHLIB_LARGE_DATA_ADDR-.});"
701
702 cat <<EOF
703 ${RELOCATING+${CREATE_SHLIB-${CREATE_PIE-${LARGE_DATA_ADDR}}}}
704 ${CREATE_SHLIB+${SHLIB_LARGE_DATA_ADDR}}
705 ${CREATE_PIE+${SHLIB_LARGE_DATA_ADDR}}
706 ${LARGE_SECTIONS}
707 ${LARGE_BSS_AFTER_BSS-${LARGE_BSS}}
708 ${RELOCATING+. = ALIGN(${ALIGNMENT});}
709 ${RELOCATING+${OTHER_END_SYMBOLS}}
710 ${RELOCATING+${END_SYMBOLS-${CREATE_SHLIB+PROVIDE (}${USER_LABEL_PREFIX}_end = .${CREATE_SHLIB+)}; PROVIDE (${USER_LABEL_PREFIX}end = .);}}
711 ${RELOCATING+${DATA_SEGMENT_END}}
712 ${TINY_DATA_SECTION}
713 ${TINY_BSS_SECTION}
714 ${STACK_ADDR+${STACK}}
715 EOF
716
717 test -z "${NON_ALLOC_DYN}" || emit_dyn
718
719 cat <<EOF
720 /* Stabs debugging sections. */
721 .stab 0 : { *(.stab) }
722 .stabstr 0 : { *(.stabstr) }
723 .stab.excl 0 : { *(.stab.excl) }
724 .stab.exclstr 0 : { *(.stab.exclstr) }
725 .stab.index 0 : { *(.stab.index) }
726 .stab.indexstr 0 : { *(.stab.indexstr) }
727
728 .comment 0 : { *(.comment) }
729
730 .gnu.build.attributes : { *(.gnu.build.attributes${RELOCATING+ .gnu.build.attributes.*}) }
731
732 EOF
733
734 . $srcdir/scripttempl/DWARF.sc
735
736 cat <<EOF
737 ${ATTRS_SECTIONS}
738 ${OTHER_SECTIONS}
739 ${RELOCATING+${OTHER_SYMBOLS}}
740 ${RELOCATING+${DISCARDED}}
741 }
742 EOF