]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - ld/scripttempl/elfxtensa.sc
* gdbarch.sh (has_global_solist): Mention global breakpoints.
[thirdparty/binutils-gdb.git] / ld / scripttempl / elfxtensa.sc
CommitLineData
e0001a05
NC
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.
be2c2e39
BW
6# SMALL_DATA_CTOR - .ctors contains small data.
7# SMALL_DATA_DTOR - .dtors contains small data.
e0001a05
NC
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)
43cd72b9
BW
15# OTHER_RELRO_SECTIONS - other than .data.rel.ro ...
16# (e.g. PPC32 .fixup, .got[12])
93c0f4a4 17# OTHER_BSS_SECTIONS - other than .bss .sbss ...
104d59d1 18# ATTRS_SECTIONS - at the end
e0001a05
NC
19# OTHER_SECTIONS - at the end
20# EXECUTABLE_SYMBOLS - symbols that must be defined for an
21# executable (e.g., _DYNAMIC_LINK)
be2c2e39
BW
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.
e0001a05
NC
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.
be2c2e39
BW
29# DATA_END_SYMBOLS - symbols that appear at the end of the
30# writeable data sections.
e0001a05
NC
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.
be2c2e39
BW
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
e0001a05
NC
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.
827a1c67 50# OTHER_SYMBOLS - symbols to place right at the end of the script.
be2c2e39
BW
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.
3c173cb1 57# USER_LABEL_PREFIX - prefix to add to user-visible symbols.
e0001a05
NC
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
3c173cb1
BW
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
e0001a05
NC
99#
100# Each of these can also have corresponding .rel.* and .rela.* sections.
101
102test -z "$ENTRY" && ENTRY=_start
be2c2e39
BW
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
e0001a05
NC
106test -z "${ELFSIZE}" && ELFSIZE=32
107test -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8"
108test "$LD_FLAG" = "N" && DATA_ADDR=.
be2c2e39 109test -z "${ETEXT_NAME}" && ETEXT_NAME=etext
43cd72b9
BW
110test -n "$CREATE_SHLIB$CREATE_PIE" && test -n "$SHLIB_DATA_ADDR" && COMMONPAGESIZE=""
111test -z "$CREATE_SHLIB$CREATE_PIE" && test -n "$DATA_ADDR" && COMMONPAGESIZE=""
be2c2e39 112test -n "$RELRO_NOW" && unset SEPARATE_GOTPLT
104d59d1 113test -z "$ATTRS_SECTIONS" && ATTRS_SECTIONS=".gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }"
e0001a05 114DATA_SEGMENT_ALIGN="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))"
43cd72b9 115DATA_SEGMENT_RELRO_END=""
e0001a05
NC
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 (.);"
be2c2e39 120 DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT-0}, .);"
e0001a05 121fi
93c0f4a4
BW
122if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}"; then
123 INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp) }"
124fi
be2c2e39
BW
125if test -z "$PLT"; then
126 PLT=".plt ${RELOCATING-0} : { *(.plt) }"
127fi
3c173cb1 128test -n "${DATA_PLT-${BSS_PLT-text}}" && TEXT_PLT=yes
43cd72b9 129if test -z "$GOT"; then
be2c2e39
BW
130 if test -z "$SEPARATE_GOTPLT"; then
131 GOT=".got ${RELOCATING-0} : { *(.got.plt) *(.got) }"
132 else
43cd72b9 133 GOT=".got ${RELOCATING-0} : { *(.got) }"
be2c2e39
BW
134 GOTPLT=".got.plt ${RELOCATING-0} : { *(.got.plt) }"
135 fi
43cd72b9 136fi
e0001a05
NC
137DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
138RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
3c173cb1 139DATARELRO=".data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }"
1c68693b 140DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }"
e0001a05
NC
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 {
3c173cb1 148 ${RELOCATING+${SBSS_START_SYMBOLS}}
be2c2e39 149 ${CREATE_SHLIB+*(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)}
e0001a05
NC
150 *(.dynsbss)
151 *(.sbss${RELOCATING+ .sbss.* .gnu.linkonce.sb.*})
152 *(.scommon)
3c173cb1 153 ${RELOCATING+${SBSS_END_SYMBOLS}}
e0001a05
NC
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}}
be2c2e39 162 ${CREATE_SHLIB+*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)}
e0001a05
NC
163 *(.sdata${RELOCATING+ .sdata.* .gnu.linkonce.s.*})
164 }"
3c173cb1
BW
165 SDATA2=".sdata2 ${RELOCATING-0} :
166 {
167 ${RELOCATING+${SDATA2_START_SYMBOLS}}
168 *(.sdata2${RELOCATING+ .sdata2.* .gnu.linkonce.s2.*})
169 }"
e0001a05
NC
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.*}) }"
43cd72b9
BW
178else
179 NO_SMALL_DATA=" "
e0001a05 180fi
be2c2e39
BW
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=" "
3c173cb1
BW
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.*}) }"
93c0f4a4
BW
199test "${LARGE_SECTIONS}" = "yes" && OTHER_BSS_SECTIONS="
200 ${OTHER_BSS_SECTIONS}
3c173cb1
BW
201 .lbss ${RELOCATING-0} :
202 {
203 *(.dynlbss)
204 *(.lbss${RELOCATING+ .lbss.* .gnu.linkonce.lb.*})
205 *(LARGE_COMMON)
93c0f4a4
BW
206 }"
207test "${LARGE_SECTIONS}" = "yes" && LARGE_SECTIONS="
3c173cb1
BW
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 }"
e0001a05
NC
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
40cf2291
AM
230 KEEP (*crtbegin.o(.ctors))
231 KEEP (*crtbegin?.o(.ctors))
e0001a05
NC
232
233 /* We don't want to include the .ctor section from
bd6791bc 234 the crtend.o file until after the sorted ctors.
e0001a05
NC
235 The .ctor section from the crtend file contains the
236 end of ctors marker and it must be last */
237
40cf2291 238 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors))
e0001a05
NC
239 KEEP (*(SORT(.ctors.*)))
240 KEEP (*(.ctors))
241 ${CONSTRUCTING+${CTOR_END}}
242 }"
243DTOR=".dtors ${CONSTRUCTING-0} :
244 {
245 ${CONSTRUCTING+${DTOR_START}}
40cf2291
AM
246 KEEP (*crtbegin.o(.dtors))
247 KEEP (*crtbegin?.o(.dtors))
248 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors))
e0001a05
NC
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
c19f06f2 267${RELOCATING+ENTRY(${ENTRY})}
e0001a05
NC
268
269${RELOCATING+${LIB_SEARCH_DIRS}}
e0001a05
NC
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: */
43cd72b9 280 ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+PROVIDE (__executable_start = ${TEXT_START_ADDR}); . = ${TEXT_BASE_ADDRESS};}}}
e0001a05 281 ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}}
43cd72b9 282 ${CREATE_PIE+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}}
e0001a05 283 ${INITIAL_READONLY_SECTIONS}
c19f06f2 284 .note.gnu.build-id : { *(.note.gnu.build-id) }
e0001a05
NC
285 ${TEXT_DYNAMIC+${DYNAMIC}}
286 .hash ${RELOCATING-0} : { *(.hash) }
3c173cb1 287 .gnu.hash ${RELOCATING-0} : { *(.gnu.hash) }
e0001a05
NC
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}
3c173cb1
BW
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.*}) }
e0001a05
NC
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.*}) }
3c173cb1 331 ${REL_LARGE}
e0001a05
NC
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
3c173cb1
BW
357 ${TEXT_PLT+${PLT}}
358 ${TINY_READONLY_SECTION}
e0001a05
NC
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}}
74869ac7 369 *(.literal .text .stub${RELOCATING+ .literal.* .text.* .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*})
e0001a05
NC
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
be2c2e39
BW
383 ${RELOCATING+PROVIDE (__${ETEXT_NAME} = .);}
384 ${RELOCATING+PROVIDE (_${ETEXT_NAME} = .);}
385 ${RELOCATING+PROVIDE (${ETEXT_NAME} = .);}
e0001a05
NC
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) }
43cd72b9 392 .eh_frame ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame)) }
3c173cb1 393 .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
e0001a05
NC
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. */
43cd72b9 397 ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}}
e0001a05 398 ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}
43cd72b9
BW
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)) }
3c173cb1 403 .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
43cd72b9
BW
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)} }
e0001a05 408
6f2942ed
PB
409 .preinit_array ${RELOCATING-0} :
410 {
3c173cb1 411 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_start = .);}}
6f2942ed 412 KEEP (*(.preinit_array))
3c173cb1 413 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_end = .);}}
6f2942ed
PB
414 }
415 .init_array ${RELOCATING-0} :
416 {
3c173cb1 417 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_start = .);}}
6f2942ed
PB
418 KEEP (*(SORT(.init_array.*)))
419 KEEP (*(.init_array))
3c173cb1 420 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_end = .);}}
6f2942ed
PB
421 }
422 .fini_array ${RELOCATING-0} :
423 {
3c173cb1 424 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_start = .);}}
6f2942ed
PB
425 KEEP (*(.fini_array))
426 KEEP (*(SORT(.fini_array.*)))
3c173cb1 427 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_end = .);}}
6f2942ed 428 }
be2c2e39
BW
429 ${SMALL_DATA_CTOR-${RELOCATING+${CTOR}}}
430 ${SMALL_DATA_DTOR-${RELOCATING+${DTOR}}}
43cd72b9
BW
431 .jcr ${RELOCATING-0} : { KEEP (*(.jcr)) }
432
433 ${RELOCATING+${DATARELRO}}
434 ${OTHER_RELRO_SECTIONS}
435 ${TEXT_DYNAMIC-${DYNAMIC}}
be2c2e39
BW
436 ${DATA_GOT+${RELRO_NOW+${GOT}}}
437 ${DATA_GOT+${RELRO_NOW+${GOTPLT}}}
438 ${DATA_GOT+${RELRO_NOW-${SEPARATE_GOTPLT+${GOT}}}}
43cd72b9 439 ${RELOCATING+${DATA_SEGMENT_RELRO_END}}
be2c2e39
BW
440 ${DATA_GOT+${RELRO_NOW-${SEPARATE_GOTPLT-${GOT}}}}
441 ${DATA_GOT+${RELRO_NOW-${GOTPLT}}}
442
443 ${DATA_PLT+${PLT_BEFORE_GOT-${PLT}}}
43cd72b9 444
e0001a05
NC
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) }
e0001a05
NC
452 ${WRITABLE_RODATA+${RODATA}}
453 ${OTHER_READWRITE_SECTIONS}
be2c2e39
BW
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}}
e0001a05
NC
460 ${SDATA}
461 ${OTHER_SDATA_SECTIONS}
3c173cb1 462 ${RELOCATING+${DATA_END_SYMBOLS-${USER_LABEL_PREFIX}_edata = .; PROVIDE (${USER_LABEL_PREFIX}edata = .);}}
e0001a05
NC
463 ${RELOCATING+__bss_start = .;}
464 ${RELOCATING+${OTHER_BSS_SYMBOLS}}
465 ${SBSS}
be2c2e39 466 ${BSS_PLT+${PLT}}
e0001a05
NC
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
3c173cb1
BW
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);}
e0001a05 478 }
93c0f4a4 479 ${OTHER_BSS_SECTIONS}
827a1c67 480 ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
e0001a05 481 ${RELOCATING+. = ALIGN(${ALIGNMENT});}
3c173cb1
BW
482 ${LARGE_SECTIONS}
483 ${RELOCATING+. = ALIGN(${ALIGNMENT});}
9f4fb502 484 ${RELOCATING+${OTHER_END_SYMBOLS}}
3c173cb1 485 ${RELOCATING+${END_SYMBOLS-${USER_LABEL_PREFIX}_end = .; PROVIDE (${USER_LABEL_PREFIX}end = .);}}
e0001a05
NC
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 */
3c173cb1 515 .debug_info 0 : { *(.debug_info${RELOCATING+ .gnu.linkonce.wi.*}) }
e0001a05
NC
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
93c0f4a4
BW
529 /* DWARF 3 */
530 .debug_pubtypes 0 : { *(.debug_pubtypes) }
531 .debug_ranges 0 : { *(.debug_ranges) }
532
3c173cb1
BW
533 ${TINY_DATA_SECTION}
534 ${TINY_BSS_SECTION}
535
e0001a05 536 ${STACK_ADDR+${STACK}}
104d59d1 537 ${ATTRS_SECTIONS}
e0001a05 538 ${OTHER_SECTIONS}
827a1c67 539 ${RELOCATING+${OTHER_SYMBOLS}}
1c68693b 540 ${RELOCATING+${DISCARDED}}
e0001a05
NC
541}
542EOF