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