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