]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - ld/scripttempl/mep.sc
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / ld / scripttempl / mep.sc
CommitLineData
250d07de 1# Copyright (C) 2014-2021 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.
19d9b7d3
DB
6#
7# Unusual variables checked by this code:
8# NOP - four byte opcode for no-op (defaults to 0)
9# NO_SMALL_DATA - no .sbss/.sbss2/.sdata/.sdata2 sections if not
10# empty.
11# SMALL_DATA_CTOR - .ctors contains small data.
12# SMALL_DATA_DTOR - .dtors contains small data.
13# DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
14# INITIAL_READONLY_SECTIONS - at start of text segment
15# OTHER_READONLY_SECTIONS - other than .text .init .rodata ...
16# (e.g., .PARISC.milli)
17# OTHER_TEXT_SECTIONS - these get put in .text when relocating
18# OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ...
19# (e.g., .PARISC.global)
20# OTHER_RELRO_SECTIONS - other than .data.rel.ro ...
21# (e.g. PPC32 .fixup, .got[12])
22# OTHER_BSS_SECTIONS - other than .bss .sbss ...
23# OTHER_SECTIONS - at the end
24# EXECUTABLE_SYMBOLS - symbols that must be defined for an
25# executable (e.g., _DYNAMIC_LINK)
26# TEXT_START_ADDR - the first byte of the text segment, after any
27# headers.
28# TEXT_BASE_ADDRESS - the first byte of the text segment.
29# TEXT_START_SYMBOLS - symbols that appear at the start of the
30# .text section.
31# DATA_START_SYMBOLS - symbols that appear at the start of the
32# .data section.
33# OTHER_GOT_SYMBOLS - symbols defined just before .got.
34# OTHER_GOT_SECTIONS - sections just after .got.
35# OTHER_SDATA_SECTIONS - sections just after .sdata.
36# OTHER_BSS_SYMBOLS - symbols that appear at the start of the
37# .bss section besides __bss_start.
38# DATA_PLT - .plt should be in data segment, not text segment.
39# PLT_BEFORE_GOT - .plt just before .got when .plt is in data segement.
40# BSS_PLT - .plt should be in bss segment
41# TEXT_DYNAMIC - .dynamic in text segment, not data segment.
6c19b93b 42# EMBEDDED - whether this is for an embedded system.
19d9b7d3
DB
43# SHLIB_TEXT_START_ADDR - if set, add to SIZEOF_HEADERS to set
44# start address of shared library.
45# INPUT_FILES - INPUT command of files to always include
46# WRITABLE_RODATA - if set, the .rodata section should be writable
47# INIT_START, INIT_END - statements just before and just after
6c19b93b 48# combination of .init sections.
19d9b7d3 49# FINI_START, FINI_END - statements just before and just after
6c19b93b 50# combination of .fini sections.
19d9b7d3
DB
51# STACK_ADDR - start of a .stack section.
52# OTHER_END_SYMBOLS - symbols to place right at the end of the script.
53# SEPARATE_GOTPLT - if set, .got.plt should be separate output section,
54# so that .got can be in the RELRO area. It should be set to
55# the number of bytes in the beginning of .got.plt which can be
56# in the RELRO area as well.
57#
58# When adding sections, do note that the names of some sections are used
59# when specifying the start address of the next.
60#
61
62# Many sections come in three flavours. There is the 'real' section,
63# like ".data". Then there are the per-procedure or per-variable
64# sections, generated by -ffunction-sections and -fdata-sections in GCC,
65# and useful for --gc-sections, which for a variable "foo" might be
66# ".data.foo". Then there are the linkonce sections, for which the linker
67# eliminates duplicates, which are named like ".gnu.linkonce.d.foo".
68# The exact correspondences are:
69#
70# Section Linkonce section
71# .text .gnu.linkonce.t.foo
72# .rodata .gnu.linkonce.r.foo
73# .data .gnu.linkonce.d.foo
74# .bss .gnu.linkonce.b.foo
75# .sdata .gnu.linkonce.s.foo
76# .sbss .gnu.linkonce.sb.foo
77# .sdata2 .gnu.linkonce.s2.foo
78# .sbss2 .gnu.linkonce.sb2.foo
79# .debug_info .gnu.linkonce.wi.foo
80# .tdata .gnu.linkonce.td.foo
81# .tbss .gnu.linkonce.tb.foo
82#
83# Each of these can also have corresponding .rel.* and .rela.* sections.
84
85test -z "$ENTRY" && ENTRY=_start
86test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
87test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
88if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi
89test -z "${ELFSIZE}" && ELFSIZE=32
90test -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8"
91test "$LD_FLAG" = "N" && DATA_ADDR=.
92test -n "$CREATE_SHLIB$CREATE_PIE" && test -n "$SHLIB_DATA_ADDR" && COMMONPAGESIZE=""
93test -z "$CREATE_SHLIB$CREATE_PIE" && test -n "$DATA_ADDR" && COMMONPAGESIZE=""
94test -n "$RELRO_NOW" && unset SEPARATE_GOTPLT
95DATA_SEGMENT_ALIGN="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))"
96DATA_SEGMENT_RELRO_END=""
97DATA_SEGMENT_RELRO_GOTPLT_END=""
98DATA_SEGMENT_END=""
99if test -n "${COMMONPAGESIZE}"; then
100 DATA_SEGMENT_ALIGN="ALIGN (${SEGMENT_SIZE}) - ((${MAXPAGESIZE} - .) & (${MAXPAGESIZE} - 1)); . = DATA_SEGMENT_ALIGN (${MAXPAGESIZE}, ${COMMONPAGESIZE})"
101 DATA_SEGMENT_END=". = DATA_SEGMENT_END (.);"
102 if test -n "${SEPARATE_GOTPLT}"; then
103 DATA_SEGMENT_RELRO_GOTPLT_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT}, .);"
104 else
105 DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (0, .);"
106 fi
107fi
ec2d9b29
AM
108INTERP=".interp ${RELOCATING-0} : { *(.interp) }"
109PLT=".plt ${RELOCATING-0} : { *(.plt) }"
19d9b7d3
DB
110if test -z "$GOT"; then
111 if test -z "$SEPARATE_GOTPLT"; then
2bf2bf23 112 GOT=".got ${RELOCATING-0} : {${RELOCATING+ *(.got.plt)} *(.got) }"
19d9b7d3 113 else
ec2d9b29 114 GOT=".got ${RELOCATING-0} : { *(.got) }"
19d9b7d3 115 GOTPLT="${RELOCATING+${DATA_SEGMENT_RELRO_GOTPLT_END}}
ec2d9b29 116 .got.plt ${RELOCATING-0} : { *(.got.plt) }"
19d9b7d3
DB
117 fi
118fi
ec2d9b29
AM
119DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
120RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
18bbc1c5 121DATARELRO=".data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro .data.rel.ro.*) }"
43e56c34 122DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }"
19d9b7d3 123if test -z "${NO_SMALL_DATA}"; then
ec2d9b29 124 SBSS=".sbss ${RELOCATING-0} :
19d9b7d3
DB
125 {
126 ${RELOCATING+PROVIDE (__sbss_start = .);}
127 ${RELOCATING+PROVIDE (___sbss_start = .);}
128 ${CREATE_SHLIB+*(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)}
2bf2bf23 129 ${RELOCATING+*(.dynsbss)}
19d9b7d3 130 *(.sbss${RELOCATING+ .sbss.* .gnu.linkonce.sb.*})
2bf2bf23 131 ${RELOCATING+*(.scommon)}
19d9b7d3
DB
132 ${RELOCATING+PROVIDE (__sbss_end = .);}
133 ${RELOCATING+PROVIDE (___sbss_end = .);}
134 }"
ec2d9b29 135 SBSS2=".sbss2 ${RELOCATING-0} : { *(.sbss2${RELOCATING+ .sbss2.* .gnu.linkonce.sb2.*}) }"
19d9b7d3
DB
136 SDATA="/* We want the small data sections together, so single-instruction offsets
137 can access them all, and initialized data all before uninitialized, so
138 we can shorten the on-disk segment size. */
6c19b93b 139 .sdata ${RELOCATING-0} :
19d9b7d3
DB
140 {
141 ${RELOCATING+${SDATA_START_SYMBOLS}}
142 ${CREATE_SHLIB+*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)}
143 *(.sdata${RELOCATING+ .sdata.* .gnu.linkonce.s.*})
144 }"
ec2d9b29
AM
145 SDATA2=".sdata2 ${RELOCATING-0} : { *(.sdata2${RELOCATING+ .sdata2.* .gnu.linkonce.s2.*}) }"
146 REL_SDATA=".rel.sdata ${RELOCATING-0} : { *(.rel.sdata${RELOCATING+ .rel.sdata.* .rel.gnu.linkonce.s.*}) }
147 .rela.sdata ${RELOCATING-0} : { *(.rela.sdata${RELOCATING+ .rela.sdata.* .rela.gnu.linkonce.s.*}) }"
148 REL_SBSS=".rel.sbss ${RELOCATING-0} : { *(.rel.sbss${RELOCATING+ .rel.sbss.* .rel.gnu.linkonce.sb.*}) }
149 .rela.sbss ${RELOCATING-0} : { *(.rela.sbss${RELOCATING+ .rela.sbss.* .rela.gnu.linkonce.sb.*}) }"
150 REL_SDATA2=".rel.sdata2 ${RELOCATING-0} : { *(.rel.sdata2${RELOCATING+ .rel.sdata2.* .rel.gnu.linkonce.s2.*}) }
151 .rela.sdata2 ${RELOCATING-0} : { *(.rela.sdata2${RELOCATING+ .rela.sdata2.* .rela.gnu.linkonce.s2.*}) }"
152 REL_SBSS2=".rel.sbss2 ${RELOCATING-0} : { *(.rel.sbss2${RELOCATING+ .rel.sbss2.* .rel.gnu.linkonce.sb2.*}) }
153 .rela.sbss2 ${RELOCATING-0} : { *(.rela.sbss2${RELOCATING+ .rela.sbss2.* .rela.gnu.linkonce.sb2.*}) }"
19d9b7d3
DB
154else
155 NO_SMALL_DATA=" "
156fi
157test -n "$SEPARATE_GOTPLT" && SEPARATE_GOTPLT=" "
6c19b93b 158CTOR=".ctors ${CONSTRUCTING-0} :
19d9b7d3
DB
159 {
160 ${CONSTRUCTING+${CTOR_START}}
161 /* gcc uses crtbegin.o to find the start of
162 the constructors, so we make sure it is
163 first. Because this is a wildcard, it
164 doesn't matter if the user does not
165 actually link against crtbegin.o; the
166 linker won't look for a file to match a
167 wildcard. The wildcard also means that it
168 doesn't matter which directory crtbegin.o
169 is in. */
170
171 KEEP (*crtbegin*.o(.ctors))
172
173 /* We don't want to include the .ctor section from
174 from the crtend.o file until after the sorted ctors.
175 The .ctor section from the crtend file contains the
176 end of ctors marker and it must be last */
177
178 KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .ctors))
179 KEEP (*(SORT(.ctors.*)))
180 KEEP (*(.ctors))
181 ${CONSTRUCTING+${CTOR_END}}
182 }"
ec2d9b29 183DTOR=".dtors ${CONSTRUCTING-0} :
19d9b7d3
DB
184 {
185 ${CONSTRUCTING+${DTOR_START}}
186 KEEP (*crtbegin*.o(.dtors))
187 KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .dtors))
188 KEEP (*(SORT(.dtors.*)))
189 KEEP (*(.dtors))
190 ${CONSTRUCTING+${DTOR_END}}
191 }"
ec2d9b29 192STACK=" .stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} :
19d9b7d3
DB
193 {
194 ${RELOCATING+_stack = .;}
195 *(.stack)
196 }"
197
985743c7 198# If this is for an embedded system, don't add SIZEOF_HEADERS.
19d9b7d3
DB
199if [ -z "$EMBEDDED" ]; then
200 test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR} + SIZEOF_HEADERS"
201else
202 test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}"
203fi
204
205cat <<EOF
250d07de 206/* Copyright (C) 2014-2021 Free Software Foundation, Inc.
985743c7
NC
207
208 Copying and distribution of this script, with or without modification,
209 are permitted in any medium without royalty provided the copyright
210 notice and this notice are preserved. */
211
19d9b7d3
DB
212OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
213 "${LITTLE_OUTPUT_FORMAT}")
214OUTPUT_ARCH(${OUTPUT_ARCH})
b34c1498 215${RELOCATING+ENTRY(${ENTRY})}
19d9b7d3
DB
216
217${RELOCATING+${LIB_SEARCH_DIRS}}
218${RELOCATING+/* Do we need any of these for elf?
219 __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */}
220${RELOCATING+${EXECUTABLE_SYMBOLS}}
221${RELOCATING+${INPUT_FILES}}
ec2d9b29
AM
222${RELOCATING- /* For some reason, the Solaris linker makes bad executables
223 if gld -r is used and the intermediate file has sections starting
224 at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld
225 bug. But for now assigning the zero vmas works. */}
19d9b7d3
DB
226
227SECTIONS
228{
229 /* Read-only sections, merged into text segment: */
230 ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+PROVIDE (__executable_start = ${TEXT_START_ADDR}); . = ${TEXT_BASE_ADDRESS};}}}
231 ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}}
232 ${CREATE_PIE+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}}
233 ${CREATE_SHLIB-${INTERP}}
234 ${INITIAL_READONLY_SECTIONS}
235 ${TEXT_DYNAMIC+${DYNAMIC}}
ec2d9b29
AM
236 .hash ${RELOCATING-0} : { *(.hash) }
237 .dynsym ${RELOCATING-0} : { *(.dynsym) }
238 .dynstr ${RELOCATING-0} : { *(.dynstr) }
239 .gnu.version ${RELOCATING-0} : { *(.gnu.version) }
240 .gnu.version_d ${RELOCATING-0}: { *(.gnu.version_d) }
241 .gnu.version_r ${RELOCATING-0}: { *(.gnu.version_r) }
19d9b7d3
DB
242
243EOF
244if [ "x$COMBRELOC" = x ]; then
245 COMBRELOCCAT=cat
246else
247 COMBRELOCCAT="cat > $COMBRELOC"
248fi
249eval $COMBRELOCCAT <<EOF
ec2d9b29
AM
250 .rel.init ${RELOCATING-0} : { *(.rel.init) }
251 .rela.init ${RELOCATING-0} : { *(.rela.init) }
252 .rel.text ${RELOCATING-0} : { *(.rel.text${RELOCATING+ .rel.text.* .rel.gnu.linkonce.t.*}) }
253 .rela.text ${RELOCATING-0} : { *(.rela.text${RELOCATING+ .rela.text.* .rela.gnu.linkonce.t.*}) }
254 .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
255 .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
256 .rel.rodata ${RELOCATING-0} : { *(.rel.rodata${RELOCATING+ .rel.rodata.* .rel.gnu.linkonce.r.*}) }
257 .rela.rodata ${RELOCATING-0} : { *(.rela.rodata${RELOCATING+ .rela.rodata.* .rela.gnu.linkonce.r.*}) }
19d9b7d3 258 ${OTHER_READONLY_RELOC_SECTIONS}
18bbc1c5
CC
259 .rel.data.rel.ro ${RELOCATING-0} : { *(.rel.data.rel.ro${RELOCATING+ .rel.data.rel.ro.*}) }
260 .rela.data.rel.ro ${RELOCATING-0} : { *(.rela.data.rel.ro${RELOCATING+ .rela.data.rel.ro.*}) }
ec2d9b29
AM
261 .rel.data ${RELOCATING-0} : { *(.rel.data${RELOCATING+ .rel.data.* .rel.gnu.linkonce.d.*}) }
262 .rela.data ${RELOCATING-0} : { *(.rela.data${RELOCATING+ .rela.data.* .rela.gnu.linkonce.d.*}) }
263 .rel.tdata ${RELOCATING-0} : { *(.rel.tdata${RELOCATING+ .rel.tdata.* .rel.gnu.linkonce.td.*}) }
264 .rela.tdata ${RELOCATING-0} : { *(.rela.tdata${RELOCATING+ .rela.tdata.* .rela.gnu.linkonce.td.*}) }
265 .rel.tbss ${RELOCATING-0} : { *(.rel.tbss${RELOCATING+ .rel.tbss.* .rel.gnu.linkonce.tb.*}) }
266 .rela.tbss ${RELOCATING-0} : { *(.rela.tbss${RELOCATING+ .rela.tbss.* .rela.gnu.linkonce.tb.*}) }
267 .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
268 .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
269 .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
270 .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
271 .rel.got ${RELOCATING-0} : { *(.rel.got) }
272 .rela.got ${RELOCATING-0} : { *(.rela.got) }
19d9b7d3
DB
273 ${OTHER_GOT_RELOC_SECTIONS}
274 ${REL_SDATA}
275 ${REL_SBSS}
276 ${REL_SDATA2}
277 ${REL_SBSS2}
ec2d9b29
AM
278 .rel.bss ${RELOCATING-0} : { *(.rel.bss${RELOCATING+ .rel.bss.* .rel.gnu.linkonce.b.*}) }
279 .rela.bss ${RELOCATING-0} : { *(.rela.bss${RELOCATING+ .rela.bss.* .rela.gnu.linkonce.b.*}) }
19d9b7d3
DB
280EOF
281if [ -n "$COMBRELOC" ]; then
282cat <<EOF
ec2d9b29 283 .rel.dyn ${RELOCATING-0} :
19d9b7d3
DB
284 {
285EOF
6c19b93b 286sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rela\./d;s/^.*: { *\(.*\)}$/ \1/' $COMBRELOC
19d9b7d3
DB
287cat <<EOF
288 }
ec2d9b29 289 .rela.dyn ${RELOCATING-0} :
19d9b7d3
DB
290 {
291EOF
6c19b93b 292sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rel\./d;s/^.*: { *\(.*\)}/ \1/' $COMBRELOC
19d9b7d3
DB
293cat <<EOF
294 }
295EOF
296fi
297cat <<EOF
ec2d9b29
AM
298 .rel.plt ${RELOCATING-0} : { *(.rel.plt) }
299 .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
19d9b7d3
DB
300 ${OTHER_PLT_RELOC_SECTIONS}
301
6c19b93b
AM
302 .init ${RELOCATING-0} :
303 {
19d9b7d3 304 ${RELOCATING+${INIT_START}}
2d3181c7 305 KEEP (*(SORT_NONE(.init)))
19d9b7d3
DB
306 ${RELOCATING+${INIT_END}}
307 } =${NOP-0}
308
309 ${DATA_PLT-${BSS_PLT-${PLT}}}
ec2d9b29 310 .text ${RELOCATING-0} :
19d9b7d3
DB
311 {
312 ${RELOCATING+${TEXT_START_SYMBOLS}}
313 *(.text .stub${RELOCATING+ .text.* .gnu.linkonce.t.*})
075a2b89 314 /* .gnu.warning sections are handled specially by elf.em. */
19d9b7d3
DB
315 *(.gnu.warning)
316 ${RELOCATING+${OTHER_TEXT_SECTIONS}}
317 } =${NOP-0}
ec2d9b29 318 .fini ${RELOCATING-0} :
19d9b7d3
DB
319 {
320 ${RELOCATING+${FINI_START}}
2d3181c7 321 KEEP (*(SORT_NONE(.fini)))
19d9b7d3
DB
322 ${RELOCATING+${FINI_END}}
323 } =${NOP-0}
324 ${RELOCATING+PROVIDE (__etext = .);}
325 ${RELOCATING+PROVIDE (_etext = .);}
326 ${RELOCATING+PROVIDE (etext = .);}
327 ${WRITABLE_RODATA-${RODATA}}
ec2d9b29 328 .rodata1 ${RELOCATING-0} : { *(.rodata1) }
19d9b7d3
DB
329 ${CREATE_SHLIB-${SDATA2}}
330 ${CREATE_SHLIB-${SBSS2}}
331 ${OTHER_READONLY_SECTIONS}
c2e86386 332 .eh_frame_hdr ${RELOCATING-0} : { *(.eh_frame_hdr) }
ec2d9b29 333 .eh_frame ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame)) }
2bf2bf23 334 .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.gcc_except_table${RELOCATING+ .gcc_except_table.*})) }
19d9b7d3
DB
335
336 /* Adjust the address for the data segment. We want to adjust up to
337 the same address within the page on the next page up. */
338 ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}}
339 ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}
340 ${CREATE_PIE+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}
341
342 /* Exception handling */
ec2d9b29 343 .eh_frame ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame)) }
2bf2bf23 344 .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.gcc_except_table${RELOCATING+ .gcc_except_table.*})) }
19d9b7d3
DB
345
346 /* Thread Local Storage sections */
ec2d9b29
AM
347 .tdata ${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) }
348 .tbss ${RELOCATING-0} : { *(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} }
19d9b7d3 349
ec2d9b29
AM
350 .preinit_array ${RELOCATING-0} : { KEEP (*(.preinit_array)) }
351 .init_array ${RELOCATING-0} : { KEEP (*(.init_array)) }
352 .fini_array ${RELOCATING-0} : { KEEP (*(.fini_array)) }
19d9b7d3
DB
353
354 ${SMALL_DATA_CTOR-${RELOCATING+${CTOR}}}
355 ${SMALL_DATA_DTOR-${RELOCATING+${DTOR}}}
ec2d9b29 356 .jcr ${RELOCATING-0} : { KEEP (*(.jcr)) }
19d9b7d3
DB
357
358 ${RELOCATING+${DATARELRO}}
359 ${OTHER_RELRO_SECTIONS}
360 ${TEXT_DYNAMIC-${DYNAMIC}}
361 ${NO_SMALL_DATA+${RELRO_NOW+${GOT}}}
362 ${NO_SMALL_DATA+${RELRO_NOW-${SEPARATE_GOTPLT+${GOT}}}}
363 ${NO_SMALL_DATA+${RELRO_NOW-${SEPARATE_GOTPLT+${GOTPLT}}}}
364 ${RELOCATING+${DATA_SEGMENT_RELRO_END}}
365 ${NO_SMALL_DATA+${RELRO_NOW-${SEPARATE_GOTPLT-${GOT}}}}
366
367 ${DATA_PLT+${PLT_BEFORE_GOT-${PLT}}}
368
ec2d9b29 369 .data ${RELOCATING-0} :
19d9b7d3
DB
370 {
371 ${RELOCATING+${DATA_START_SYMBOLS}}
372 *(.data${RELOCATING+ .data.* .gnu.linkonce.d.*})
19d9b7d3
DB
373 ${CONSTRUCTING+SORT(CONSTRUCTORS)}
374 }
ec2d9b29 375 .data1 ${RELOCATING-0} : { *(.data1) }
19d9b7d3
DB
376 ${WRITABLE_RODATA+${RODATA}}
377 ${OTHER_READWRITE_SECTIONS}
378 ${SMALL_DATA_CTOR+${RELOCATING+${CTOR}}}
379 ${SMALL_DATA_DTOR+${RELOCATING+${DTOR}}}
380 ${DATA_PLT+${PLT_BEFORE_GOT+${PLT}}}
381 ${RELOCATING+${OTHER_GOT_SYMBOLS}}
382 ${NO_SMALL_DATA-${GOT}}
383 ${OTHER_GOT_SECTIONS}
384 ${SDATA}
385 ${OTHER_SDATA_SECTIONS}
386 ${RELOCATING+_edata = .;}
387 ${RELOCATING+PROVIDE (edata = .);}
388 ${RELOCATING+__bss_start = .;}
389 ${RELOCATING+${OTHER_BSS_SYMBOLS}}
390 ${SBSS}
391 ${BSS_PLT+${PLT}}
ec2d9b29 392 .bss ${RELOCATING-0} :
19d9b7d3 393 {
2bf2bf23 394 ${RELOCATING+*(.dynbss)}
19d9b7d3 395 *(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*})
2bf2bf23 396 ${RELOCATING+*(COMMON)
19d9b7d3
DB
397 /* Align here to ensure that the .bss section occupies space up to
398 _end. Align after .bss to ensure correct alignment even if the
399 .bss section disappears because there are no input sections. */
2bf2bf23 400 . = ALIGN(${ALIGNMENT});}
19d9b7d3
DB
401 }
402 ${OTHER_BSS_SECTIONS}
403 ${RELOCATING+. = ALIGN(${ALIGNMENT});}
404 ${RELOCATING+_end = .;}
405 ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
406 ${RELOCATING+PROVIDE (end = .);}
407 ${RELOCATING+${DATA_SEGMENT_END}}
408
409 /* Stabs debugging sections. */
410 .stab 0 : { *(.stab) }
411 .stabstr 0 : { *(.stabstr) }
412 .stab.excl 0 : { *(.stab.excl) }
413 .stab.exclstr 0 : { *(.stab.exclstr) }
414 .stab.index 0 : { *(.stab.index) }
415 .stab.indexstr 0 : { *(.stab.indexstr) }
416
417 .comment 0 : { *(.comment) }
418
ceb0a680 419EOF
2a995fc1 420
d061dfac 421. $srcdir/scripttempl/DWARF.sc
2a995fc1 422
ceb0a680 423cat <<EOF
19d9b7d3
DB
424 ${STACK_ADDR+${STACK}}
425 ${OTHER_SECTIONS}
426 ${RELOCATING+${OTHER_END_SYMBOLS}}
1c68693b 427 ${RELOCATING+${DISCARDED}}
19d9b7d3
DB
428}
429EOF