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