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