]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame_incremental - ld/scripttempl/elfxtensa.sc
* gdbarch.sh (has_global_solist): Mention global breakpoints.
[thirdparty/binutils-gdb.git] / ld / scripttempl / elfxtensa.sc
... / ...
CommitLineData
1#
2# Unusual variables checked by this code:
3# NOP - four byte opcode for no-op (defaults to 0)
4# NO_SMALL_DATA - no .sbss/.sbss2/.sdata/.sdata2 sections if not
5# empty.
6# SMALL_DATA_CTOR - .ctors contains small data.
7# SMALL_DATA_DTOR - .dtors contains small data.
8# DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
9# INITIAL_READONLY_SECTIONS - at start of text segment
10# OTHER_READONLY_SECTIONS - other than .text .init .rodata ...
11# (e.g., .PARISC.milli)
12# OTHER_TEXT_SECTIONS - these get put in .text when relocating
13# OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ...
14# (e.g., .PARISC.global)
15# OTHER_RELRO_SECTIONS - other than .data.rel.ro ...
16# (e.g. PPC32 .fixup, .got[12])
17# OTHER_BSS_SECTIONS - other than .bss .sbss ...
18# ATTRS_SECTIONS - at the end
19# OTHER_SECTIONS - at the end
20# EXECUTABLE_SYMBOLS - symbols that must be defined for an
21# executable (e.g., _DYNAMIC_LINK)
22# TEXT_START_ADDR - the first byte of the text segment, after any
23# headers.
24# TEXT_BASE_ADDRESS - the first byte of the text segment.
25# TEXT_START_SYMBOLS - symbols that appear at the start of the
26# .text section.
27# DATA_START_SYMBOLS - symbols that appear at the start of the
28# .data section.
29# DATA_END_SYMBOLS - symbols that appear at the end of the
30# writeable data sections.
31# OTHER_GOT_SYMBOLS - symbols defined just before .got.
32# OTHER_GOT_SECTIONS - sections just after .got.
33# OTHER_SDATA_SECTIONS - sections just after .sdata.
34# OTHER_BSS_SYMBOLS - symbols that appear at the start of the
35# .bss section besides __bss_start.
36# DATA_PLT - .plt should be in data segment, not text segment.
37# PLT_BEFORE_GOT - .plt just before .got when .plt is in data segement.
38# BSS_PLT - .plt should be in bss segment
39# TEXT_DYNAMIC - .dynamic in text segment, not data segment.
40# EMBEDDED - whether this is for an embedded system.
41# SHLIB_TEXT_START_ADDR - if set, add to SIZEOF_HEADERS to set
42# start address of shared library.
43# INPUT_FILES - INPUT command of files to always include
44# WRITABLE_RODATA - if set, the .rodata section should be writable
45# INIT_START, INIT_END - statements just before and just after
46# combination of .init sections.
47# FINI_START, FINI_END - statements just before and just after
48# combination of .fini sections.
49# STACK_ADDR - start of a .stack section.
50# OTHER_SYMBOLS - symbols to place right at the end of the script.
51# ETEXT_NAME - name of a symbol for the end of the text section,
52# normally etext.
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# USER_LABEL_PREFIX - prefix to add to user-visible symbols.
58#
59# When adding sections, do note that the names of some sections are used
60# when specifying the start address of the next.
61#
62
63# Many sections come in three flavours. There is the 'real' section,
64# like ".data". Then there are the per-procedure or per-variable
65# sections, generated by -ffunction-sections and -fdata-sections in GCC,
66# and useful for --gc-sections, which for a variable "foo" might be
67# ".data.foo". Then there are the linkonce sections, for which the linker
68# eliminates duplicates, which are named like ".gnu.linkonce.d.foo".
69# The exact correspondences are:
70#
71# Section Linkonce section
72# .text .gnu.linkonce.t.foo
73# .rodata .gnu.linkonce.r.foo
74# .data .gnu.linkonce.d.foo
75# .bss .gnu.linkonce.b.foo
76# .sdata .gnu.linkonce.s.foo
77# .sbss .gnu.linkonce.sb.foo
78# .sdata2 .gnu.linkonce.s2.foo
79# .sbss2 .gnu.linkonce.sb2.foo
80# .debug_info .gnu.linkonce.wi.foo
81# .tdata .gnu.linkonce.td.foo
82# .tbss .gnu.linkonce.tb.foo
83# .lrodata .gnu.linkonce.lr.foo
84# .ldata .gnu.linkonce.l.foo
85# .lbss .gnu.linkonce.lb.foo
86#
87# plus exception-handling information for Tensilica's XCC compiler:
88# .xt_except_table .gnu.linkonce.e.foo
89# .xt_except_desc .gnu.linkonce.h.foo
90#
91# plus Xtensa-specific literal sections:
92# .literal .gnu.linkonce.literal.foo
93# .lit4 .gnu.linkonce.lit4.foo
94#
95# plus Xtensa-specific "property table" sections:
96# .xt.lit .gnu.linkonce.p.foo
97# .xt.insn .gnu.linkonce.x.foo (obsolete)
98# .xt.prop .gnu.linkonce.prop.foo
99#
100# Each of these can also have corresponding .rel.* and .rela.* sections.
101
102test -z "$ENTRY" && ENTRY=_start
103test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
104test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
105if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi
106test -z "${ELFSIZE}" && ELFSIZE=32
107test -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8"
108test "$LD_FLAG" = "N" && DATA_ADDR=.
109test -z "${ETEXT_NAME}" && ETEXT_NAME=etext
110test -n "$CREATE_SHLIB$CREATE_PIE" && test -n "$SHLIB_DATA_ADDR" && COMMONPAGESIZE=""
111test -z "$CREATE_SHLIB$CREATE_PIE" && test -n "$DATA_ADDR" && COMMONPAGESIZE=""
112test -n "$RELRO_NOW" && unset SEPARATE_GOTPLT
113test -z "$ATTRS_SECTIONS" && ATTRS_SECTIONS=".gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }"
114DATA_SEGMENT_ALIGN="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))"
115DATA_SEGMENT_RELRO_END=""
116DATA_SEGMENT_END=""
117if test -n "${COMMONPAGESIZE}"; then
118 DATA_SEGMENT_ALIGN="ALIGN (${SEGMENT_SIZE}) - ((${MAXPAGESIZE} - .) & (${MAXPAGESIZE} - 1)); . = DATA_SEGMENT_ALIGN (${MAXPAGESIZE}, ${COMMONPAGESIZE})"
119 DATA_SEGMENT_END=". = DATA_SEGMENT_END (.);"
120 DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT-0}, .);"
121fi
122if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}"; then
123 INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp) }"
124fi
125if test -z "$PLT"; then
126 PLT=".plt ${RELOCATING-0} : { *(.plt) }"
127fi
128test -n "${DATA_PLT-${BSS_PLT-text}}" && TEXT_PLT=yes
129if test -z "$GOT"; then
130 if test -z "$SEPARATE_GOTPLT"; then
131 GOT=".got ${RELOCATING-0} : { *(.got.plt) *(.got) }"
132 else
133 GOT=".got ${RELOCATING-0} : { *(.got) }"
134 GOTPLT=".got.plt ${RELOCATING-0} : { *(.got.plt) }"
135 fi
136fi
137DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
138RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
139DATARELRO=".data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }"
140DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }"
141INIT_LIT=".init.literal 0 : { *(.init.literal) }"
142INIT=".init 0 : { *(.init) }"
143FINI_LIT=".fini.literal 0 : { *(.fini.literal) }"
144FINI=".fini 0 : { *(.fini) }"
145if test -z "${NO_SMALL_DATA}"; then
146 SBSS=".sbss ${RELOCATING-0} :
147 {
148 ${RELOCATING+${SBSS_START_SYMBOLS}}
149 ${CREATE_SHLIB+*(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)}
150 *(.dynsbss)
151 *(.sbss${RELOCATING+ .sbss.* .gnu.linkonce.sb.*})
152 *(.scommon)
153 ${RELOCATING+${SBSS_END_SYMBOLS}}
154 }"
155 SBSS2=".sbss2 ${RELOCATING-0} : { *(.sbss2${RELOCATING+ .sbss2.* .gnu.linkonce.sb2.*}) }"
156 SDATA="/* We want the small data sections together, so single-instruction offsets
157 can access them all, and initialized data all before uninitialized, so
158 we can shorten the on-disk segment size. */
159 .sdata ${RELOCATING-0} :
160 {
161 ${RELOCATING+${SDATA_START_SYMBOLS}}
162 ${CREATE_SHLIB+*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)}
163 *(.sdata${RELOCATING+ .sdata.* .gnu.linkonce.s.*})
164 }"
165 SDATA2=".sdata2 ${RELOCATING-0} :
166 {
167 ${RELOCATING+${SDATA2_START_SYMBOLS}}
168 *(.sdata2${RELOCATING+ .sdata2.* .gnu.linkonce.s2.*})
169 }"
170 REL_SDATA=".rel.sdata ${RELOCATING-0} : { *(.rel.sdata${RELOCATING+ .rel.sdata.* .rel.gnu.linkonce.s.*}) }
171 .rela.sdata ${RELOCATING-0} : { *(.rela.sdata${RELOCATING+ .rela.sdata.* .rela.gnu.linkonce.s.*}) }"
172 REL_SBSS=".rel.sbss ${RELOCATING-0} : { *(.rel.sbss${RELOCATING+ .rel.sbss.* .rel.gnu.linkonce.sb.*}) }
173 .rela.sbss ${RELOCATING-0} : { *(.rela.sbss${RELOCATING+ .rela.sbss.* .rela.gnu.linkonce.sb.*}) }"
174 REL_SDATA2=".rel.sdata2 ${RELOCATING-0} : { *(.rel.sdata2${RELOCATING+ .rel.sdata2.* .rel.gnu.linkonce.s2.*}) }
175 .rela.sdata2 ${RELOCATING-0} : { *(.rela.sdata2${RELOCATING+ .rela.sdata2.* .rela.gnu.linkonce.s2.*}) }"
176 REL_SBSS2=".rel.sbss2 ${RELOCATING-0} : { *(.rel.sbss2${RELOCATING+ .rel.sbss2.* .rel.gnu.linkonce.sb2.*}) }
177 .rela.sbss2 ${RELOCATING-0} : { *(.rela.sbss2${RELOCATING+ .rela.sbss2.* .rela.gnu.linkonce.sb2.*}) }"
178else
179 NO_SMALL_DATA=" "
180fi
181if test -z "${DATA_GOT}"; then
182 if test -n "${NO_SMALL_DATA}"; then
183 DATA_GOT=" "
184 fi
185fi
186if test -z "${SDATA_GOT}"; then
187 if test -z "${NO_SMALL_DATA}"; then
188 SDATA_GOT=" "
189 fi
190fi
191test -n "$SEPARATE_GOTPLT" && SEPARATE_GOTPLT=" "
192test "${LARGE_SECTIONS}" = "yes" && REL_LARGE="
193 .rel.ldata ${RELOCATING-0} : { *(.rel.ldata${RELOCATING+ .rel.ldata.* .rel.gnu.linkonce.l.*}) }
194 .rela.ldata ${RELOCATING-0} : { *(.rela.ldata${RELOCATING+ .rela.ldata.* .rela.gnu.linkonce.l.*}) }
195 .rel.lbss ${RELOCATING-0} : { *(.rel.lbss${RELOCATING+ .rel.lbss.* .rel.gnu.linkonce.lb.*}) }
196 .rela.lbss ${RELOCATING-0} : { *(.rela.lbss${RELOCATING+ .rela.lbss.* .rela.gnu.linkonce.lb.*}) }
197 .rel.lrodata ${RELOCATING-0} : { *(.rel.lrodata${RELOCATING+ .rel.lrodata.* .rel.gnu.linkonce.lr.*}) }
198 .rela.lrodata ${RELOCATING-0} : { *(.rela.lrodata${RELOCATING+ .rela.lrodata.* .rela.gnu.linkonce.lr.*}) }"
199test "${LARGE_SECTIONS}" = "yes" && OTHER_BSS_SECTIONS="
200 ${OTHER_BSS_SECTIONS}
201 .lbss ${RELOCATING-0} :
202 {
203 *(.dynlbss)
204 *(.lbss${RELOCATING+ .lbss.* .gnu.linkonce.lb.*})
205 *(LARGE_COMMON)
206 }"
207test "${LARGE_SECTIONS}" = "yes" && LARGE_SECTIONS="
208 .lrodata ${RELOCATING-0} ${RELOCATING+ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))} :
209 {
210 *(.lrodata${RELOCATING+ .lrodata.* .gnu.linkonce.lr.*})
211 }
212 .ldata ${RELOCATING-0} ${RELOCATING+ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))} :
213 {
214 *(.ldata${RELOCATING+ .ldata.* .gnu.linkonce.l.*})
215 ${RELOCATING+. = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
216 }"
217CTOR=".ctors ${CONSTRUCTING-0} :
218 {
219 ${CONSTRUCTING+${CTOR_START}}
220 /* gcc uses crtbegin.o to find the start of
221 the constructors, so we make sure it is
222 first. Because this is a wildcard, it
223 doesn't matter if the user does not
224 actually link against crtbegin.o; the
225 linker won't look for a file to match a
226 wildcard. The wildcard also means that it
227 doesn't matter which directory crtbegin.o
228 is in. */
229
230 KEEP (*crtbegin.o(.ctors))
231 KEEP (*crtbegin?.o(.ctors))
232
233 /* We don't want to include the .ctor section from
234 the crtend.o file until after the sorted ctors.
235 The .ctor section from the crtend file contains the
236 end of ctors marker and it must be last */
237
238 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors))
239 KEEP (*(SORT(.ctors.*)))
240 KEEP (*(.ctors))
241 ${CONSTRUCTING+${CTOR_END}}
242 }"
243DTOR=".dtors ${CONSTRUCTING-0} :
244 {
245 ${CONSTRUCTING+${DTOR_START}}
246 KEEP (*crtbegin.o(.dtors))
247 KEEP (*crtbegin?.o(.dtors))
248 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors))
249 KEEP (*(SORT(.dtors.*)))
250 KEEP (*(.dtors))
251 ${CONSTRUCTING+${DTOR_END}}
252 }"
253STACK=" .stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} :
254 {
255 ${RELOCATING+_stack = .;}
256 *(.stack)
257 }"
258
259# if this is for an embedded system, don't add SIZEOF_HEADERS.
260if [ -z "$EMBEDDED" ]; then
261 test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR} + SIZEOF_HEADERS"
262else
263 test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}"
264fi
265
266cat <<EOF
267${RELOCATING+ENTRY(${ENTRY})}
268
269${RELOCATING+${LIB_SEARCH_DIRS}}
270${RELOCATING+${EXECUTABLE_SYMBOLS}}
271${RELOCATING+${INPUT_FILES}}
272${RELOCATING- /* For some reason, the Solaris linker makes bad executables
273 if gld -r is used and the intermediate file has sections starting
274 at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld
275 bug. But for now assigning the zero vmas works. */}
276
277SECTIONS
278{
279 /* Read-only sections, merged into text segment: */
280 ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+PROVIDE (__executable_start = ${TEXT_START_ADDR}); . = ${TEXT_BASE_ADDRESS};}}}
281 ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}}
282 ${CREATE_PIE+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}}
283 ${INITIAL_READONLY_SECTIONS}
284 .note.gnu.build-id : { *(.note.gnu.build-id) }
285 ${TEXT_DYNAMIC+${DYNAMIC}}
286 .hash ${RELOCATING-0} : { *(.hash) }
287 .gnu.hash ${RELOCATING-0} : { *(.gnu.hash) }
288 .dynsym ${RELOCATING-0} : { *(.dynsym) }
289 .dynstr ${RELOCATING-0} : { *(.dynstr) }
290 .gnu.version ${RELOCATING-0} : { *(.gnu.version) }
291 .gnu.version_d ${RELOCATING-0}: { *(.gnu.version_d) }
292 .gnu.version_r ${RELOCATING-0}: { *(.gnu.version_r) }
293
294EOF
295if [ "x$COMBRELOC" = x ]; then
296 COMBRELOCCAT=cat
297else
298 COMBRELOCCAT="cat > $COMBRELOC"
299fi
300eval $COMBRELOCCAT <<EOF
301 .rel.init ${RELOCATING-0} : { *(.rel.init) }
302 .rela.init ${RELOCATING-0} : { *(.rela.init) }
303 .rel.text ${RELOCATING-0} : { *(.rel.text${RELOCATING+ .rel.text.* .rel.gnu.linkonce.t.*}) }
304 .rela.text ${RELOCATING-0} : { *(.rela.text${RELOCATING+ .rela.text.* .rela.gnu.linkonce.t.*}) }
305 .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
306 .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
307 .rel.rodata ${RELOCATING-0} : { *(.rel.rodata${RELOCATING+ .rel.rodata.* .rel.gnu.linkonce.r.*}) }
308 .rela.rodata ${RELOCATING-0} : { *(.rela.rodata${RELOCATING+ .rela.rodata.* .rela.gnu.linkonce.r.*}) }
309 ${OTHER_READONLY_RELOC_SECTIONS}
310 .rel.data.rel.ro ${RELOCATING-0} : { *(.rel.data.rel.ro${RELOCATING+* .rel.gnu.linkonce.d.rel.ro.*}) }
311 .rela.data.rel.ro ${RELOCATING-0} : { *(.rela.data.rel.ro${RELOCATING+* .rela.gnu.linkonce.d.rel.ro.*}) }
312 .rel.data ${RELOCATING-0} : { *(.rel.data${RELOCATING+ .rel.data.* .rel.gnu.linkonce.d.*}) }
313 .rela.data ${RELOCATING-0} : { *(.rela.data${RELOCATING+ .rela.data.* .rela.gnu.linkonce.d.*}) }
314 .rel.tdata ${RELOCATING-0} : { *(.rel.tdata${RELOCATING+ .rel.tdata.* .rel.gnu.linkonce.td.*}) }
315 .rela.tdata ${RELOCATING-0} : { *(.rela.tdata${RELOCATING+ .rela.tdata.* .rela.gnu.linkonce.td.*}) }
316 .rel.tbss ${RELOCATING-0} : { *(.rel.tbss${RELOCATING+ .rel.tbss.* .rel.gnu.linkonce.tb.*}) }
317 .rela.tbss ${RELOCATING-0} : { *(.rela.tbss${RELOCATING+ .rela.tbss.* .rela.gnu.linkonce.tb.*}) }
318 .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
319 .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
320 .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
321 .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
322 .rel.got ${RELOCATING-0} : { *(.rel.got) }
323 .rela.got ${RELOCATING-0} : { *(.rela.got) }
324 ${OTHER_GOT_RELOC_SECTIONS}
325 ${REL_SDATA}
326 ${REL_SBSS}
327 ${REL_SDATA2}
328 ${REL_SBSS2}
329 .rel.bss ${RELOCATING-0} : { *(.rel.bss${RELOCATING+ .rel.bss.* .rel.gnu.linkonce.b.*}) }
330 .rela.bss ${RELOCATING-0} : { *(.rela.bss${RELOCATING+ .rela.bss.* .rela.gnu.linkonce.b.*}) }
331 ${REL_LARGE}
332EOF
333if [ -n "$COMBRELOC" ]; then
334cat <<EOF
335 .rel.dyn ${RELOCATING-0} :
336 {
337EOF
338sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rela\./d;s/^.*: { *\(.*\)}$/ \1/' $COMBRELOC
339cat <<EOF
340 }
341 .rela.dyn ${RELOCATING-0} :
342 {
343EOF
344sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rel\./d;s/^.*: { *\(.*\)}/ \1/' $COMBRELOC
345cat <<EOF
346 }
347EOF
348fi
349cat <<EOF
350 .rel.plt ${RELOCATING-0} : { *(.rel.plt) }
351 .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
352 ${OTHER_PLT_RELOC_SECTIONS}
353
354 ${RELOCATING-$INIT_LIT}
355 ${RELOCATING-$INIT}
356
357 ${TEXT_PLT+${PLT}}
358 ${TINY_READONLY_SECTION}
359 .text ${RELOCATING-0} :
360 {
361 *(.got.plt* .plt*)
362
363 ${RELOCATING+${INIT_START}}
364 ${RELOCATING+KEEP (*(.init.literal))}
365 ${RELOCATING+KEEP (*(.init))}
366 ${RELOCATING+${INIT_END}}
367
368 ${RELOCATING+${TEXT_START_SYMBOLS}}
369 *(.literal .text .stub${RELOCATING+ .literal.* .text.* .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*})
370 /* .gnu.warning sections are handled specially by elf32.em. */
371 *(.gnu.warning)
372 ${RELOCATING+${OTHER_TEXT_SECTIONS}}
373
374 ${RELOCATING+${FINI_START}}
375 ${RELOCATING+KEEP (*(.fini.literal))}
376 ${RELOCATING+KEEP (*(.fini))}
377 ${RELOCATING+${FINI_END}}
378 } =${NOP-0}
379
380 ${RELOCATING-$FINI_LIT}
381 ${RELOCATING-$FINI}
382
383 ${RELOCATING+PROVIDE (__${ETEXT_NAME} = .);}
384 ${RELOCATING+PROVIDE (_${ETEXT_NAME} = .);}
385 ${RELOCATING+PROVIDE (${ETEXT_NAME} = .);}
386 ${WRITABLE_RODATA-${RODATA}}
387 .rodata1 ${RELOCATING-0} : { *(.rodata1) }
388 ${CREATE_SHLIB-${SDATA2}}
389 ${CREATE_SHLIB-${SBSS2}}
390 ${OTHER_READONLY_SECTIONS}
391 .eh_frame_hdr : { *(.eh_frame_hdr) }
392 .eh_frame ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame)) }
393 .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
394
395 /* Adjust the address for the data segment. We want to adjust up to
396 the same address within the page on the next page up. */
397 ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}}
398 ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}
399 ${CREATE_PIE+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}
400
401 /* Exception handling */
402 .eh_frame ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame)) }
403 .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
404
405 /* Thread Local Storage sections */
406 .tdata ${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) }
407 .tbss ${RELOCATING-0} : { *(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} }
408
409 .preinit_array ${RELOCATING-0} :
410 {
411 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_start = .);}}
412 KEEP (*(.preinit_array))
413 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_end = .);}}
414 }
415 .init_array ${RELOCATING-0} :
416 {
417 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_start = .);}}
418 KEEP (*(SORT(.init_array.*)))
419 KEEP (*(.init_array))
420 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_end = .);}}
421 }
422 .fini_array ${RELOCATING-0} :
423 {
424 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_start = .);}}
425 KEEP (*(.fini_array))
426 KEEP (*(SORT(.fini_array.*)))
427 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_end = .);}}
428 }
429 ${SMALL_DATA_CTOR-${RELOCATING+${CTOR}}}
430 ${SMALL_DATA_DTOR-${RELOCATING+${DTOR}}}
431 .jcr ${RELOCATING-0} : { KEEP (*(.jcr)) }
432
433 ${RELOCATING+${DATARELRO}}
434 ${OTHER_RELRO_SECTIONS}
435 ${TEXT_DYNAMIC-${DYNAMIC}}
436 ${DATA_GOT+${RELRO_NOW+${GOT}}}
437 ${DATA_GOT+${RELRO_NOW+${GOTPLT}}}
438 ${DATA_GOT+${RELRO_NOW-${SEPARATE_GOTPLT+${GOT}}}}
439 ${RELOCATING+${DATA_SEGMENT_RELRO_END}}
440 ${DATA_GOT+${RELRO_NOW-${SEPARATE_GOTPLT-${GOT}}}}
441 ${DATA_GOT+${RELRO_NOW-${GOTPLT}}}
442
443 ${DATA_PLT+${PLT_BEFORE_GOT-${PLT}}}
444
445 .data ${RELOCATING-0} :
446 {
447 ${RELOCATING+${DATA_START_SYMBOLS}}
448 *(.data${RELOCATING+ .data.* .gnu.linkonce.d.*})
449 ${CONSTRUCTING+SORT(CONSTRUCTORS)}
450 }
451 .data1 ${RELOCATING-0} : { *(.data1) }
452 ${WRITABLE_RODATA+${RODATA}}
453 ${OTHER_READWRITE_SECTIONS}
454 ${SMALL_DATA_CTOR+${RELOCATING+${CTOR}}}
455 ${SMALL_DATA_DTOR+${RELOCATING+${DTOR}}}
456 ${DATA_PLT+${PLT_BEFORE_GOT+${PLT}}}
457 ${SDATA_GOT+${RELOCATING+${OTHER_GOT_SYMBOLS}}}
458 ${SDATA_GOT+${GOT}}
459 ${SDATA_GOT+${OTHER_GOT_SECTIONS}}
460 ${SDATA}
461 ${OTHER_SDATA_SECTIONS}
462 ${RELOCATING+${DATA_END_SYMBOLS-${USER_LABEL_PREFIX}_edata = .; PROVIDE (${USER_LABEL_PREFIX}edata = .);}}
463 ${RELOCATING+__bss_start = .;}
464 ${RELOCATING+${OTHER_BSS_SYMBOLS}}
465 ${SBSS}
466 ${BSS_PLT+${PLT}}
467 .bss ${RELOCATING-0} :
468 {
469 *(.dynbss)
470 *(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*})
471 *(COMMON)
472 /* Align here to ensure that the .bss section occupies space up to
473 _end. Align after .bss to ensure correct alignment even if the
474 .bss section disappears because there are no input sections.
475 FIXME: Why do we need it? When there is no .bss section, we don't
476 pad the .data section. */
477 ${RELOCATING+. = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
478 }
479 ${OTHER_BSS_SECTIONS}
480 ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
481 ${RELOCATING+. = ALIGN(${ALIGNMENT});}
482 ${LARGE_SECTIONS}
483 ${RELOCATING+. = ALIGN(${ALIGNMENT});}
484 ${RELOCATING+${OTHER_END_SYMBOLS}}
485 ${RELOCATING+${END_SYMBOLS-${USER_LABEL_PREFIX}_end = .; PROVIDE (${USER_LABEL_PREFIX}end = .);}}
486 ${RELOCATING+${DATA_SEGMENT_END}}
487
488 /* Stabs debugging sections. */
489 .stab 0 : { *(.stab) }
490 .stabstr 0 : { *(.stabstr) }
491 .stab.excl 0 : { *(.stab.excl) }
492 .stab.exclstr 0 : { *(.stab.exclstr) }
493 .stab.index 0 : { *(.stab.index) }
494 .stab.indexstr 0 : { *(.stab.indexstr) }
495
496 .comment 0 : { *(.comment) }
497
498 /* DWARF debug sections.
499 Symbols in the DWARF debugging sections are relative to the beginning
500 of the section so we begin them at 0. */
501
502 /* DWARF 1 */
503 .debug 0 : { *(.debug) }
504 .line 0 : { *(.line) }
505
506 /* GNU DWARF 1 extensions */
507 .debug_srcinfo 0 : { *(.debug_srcinfo) }
508 .debug_sfnames 0 : { *(.debug_sfnames) }
509
510 /* DWARF 1.1 and DWARF 2 */
511 .debug_aranges 0 : { *(.debug_aranges) }
512 .debug_pubnames 0 : { *(.debug_pubnames) }
513
514 /* DWARF 2 */
515 .debug_info 0 : { *(.debug_info${RELOCATING+ .gnu.linkonce.wi.*}) }
516 .debug_abbrev 0 : { *(.debug_abbrev) }
517 .debug_line 0 : { *(.debug_line) }
518 .debug_frame 0 : { *(.debug_frame) }
519 .debug_str 0 : { *(.debug_str) }
520 .debug_loc 0 : { *(.debug_loc) }
521 .debug_macinfo 0 : { *(.debug_macinfo) }
522
523 /* SGI/MIPS DWARF 2 extensions */
524 .debug_weaknames 0 : { *(.debug_weaknames) }
525 .debug_funcnames 0 : { *(.debug_funcnames) }
526 .debug_typenames 0 : { *(.debug_typenames) }
527 .debug_varnames 0 : { *(.debug_varnames) }
528
529 /* DWARF 3 */
530 .debug_pubtypes 0 : { *(.debug_pubtypes) }
531 .debug_ranges 0 : { *(.debug_ranges) }
532
533 ${TINY_DATA_SECTION}
534 ${TINY_BSS_SECTION}
535
536 ${STACK_ADDR+${STACK}}
537 ${ATTRS_SECTIONS}
538 ${OTHER_SECTIONS}
539 ${RELOCATING+${OTHER_SYMBOLS}}
540 ${RELOCATING+${DISCARDED}}
541}
542EOF