1*d2201f2fSdrahn#
2*d2201f2fSdrahn# Unusual variables checked by this code:
3*d2201f2fSdrahn#	NOP - four byte opcode for no-op (defaults to 0)
4*d2201f2fSdrahn#	NO_SMALL_DATA - no .sbss/.sbss2/.sdata/.sdata2 sections if not
5*d2201f2fSdrahn#		empty.
6*d2201f2fSdrahn#	DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
7*d2201f2fSdrahn#	INITIAL_READONLY_SECTIONS - at start of text segment
8*d2201f2fSdrahn#	OTHER_READONLY_SECTIONS - other than .text .init .rodata ...
9*d2201f2fSdrahn#		(e.g., .PARISC.milli)
10*d2201f2fSdrahn#	OTHER_TEXT_SECTIONS - these get put in .text when relocating
11*d2201f2fSdrahn#	OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ...
12*d2201f2fSdrahn#		(e.g., .PARISC.global)
13*d2201f2fSdrahn#	OTHER_BSS_SECTIONS - other than .bss .sbss ...
14*d2201f2fSdrahn#	OTHER_SECTIONS - at the end
15*d2201f2fSdrahn#	EXECUTABLE_SYMBOLS - symbols that must be defined for an
16*d2201f2fSdrahn#		executable (e.g., _DYNAMIC_LINK)
17*d2201f2fSdrahn#	TEXT_START_SYMBOLS - symbols that appear at the start of the
18*d2201f2fSdrahn#		.text section.
19*d2201f2fSdrahn#	DATA_START_SYMBOLS - symbols that appear at the start of the
20*d2201f2fSdrahn#		.data section.
21*d2201f2fSdrahn#	OTHER_GOT_SYMBOLS - symbols defined just before .got.
22*d2201f2fSdrahn#	OTHER_GOT_SECTIONS - sections just after .got.
23*d2201f2fSdrahn#	OTHER_SDATA_SECTIONS - sections just after .sdata.
24*d2201f2fSdrahn#	OTHER_BSS_SYMBOLS - symbols that appear at the start of the
25*d2201f2fSdrahn#		.bss section besides __bss_start.
26*d2201f2fSdrahn#	TEXT_DYNAMIC - .dynamic in text segment, not data segment.
27*d2201f2fSdrahn#	EMBEDDED - whether this is for an embedded system.
28*d2201f2fSdrahn#	SHLIB_TEXT_START_ADDR - if set, add to SIZEOF_HEADERS to set
29*d2201f2fSdrahn#		start address of shared library.
30*d2201f2fSdrahn#	INPUT_FILES - INPUT command of files to always include
31*d2201f2fSdrahn#	WRITABLE_RODATA - if set, the .rodata section should be writable
32*d2201f2fSdrahn#	INIT_START, INIT_END -  statements just before and just after
33*d2201f2fSdrahn# 	combination of .init sections.
34*d2201f2fSdrahn#	FINI_START, FINI_END - statements just before and just after
35*d2201f2fSdrahn# 	combination of .fini sections.
36*d2201f2fSdrahn#	STACK_ADDR - start of a .stack section.
37*d2201f2fSdrahn#	OTHER_END_SYMBOLS - symbols to place right at the end of the script.
38*d2201f2fSdrahn#
39*d2201f2fSdrahn# When adding sections, do note that the names of some sections are used
40*d2201f2fSdrahn# when specifying the start address of the next.
41*d2201f2fSdrahn#
42*d2201f2fSdrahn
43*d2201f2fSdrahn#  Many sections come in three flavours.  There is the 'real' section,
44*d2201f2fSdrahn#  like ".data".  Then there are the per-procedure or per-variable
45*d2201f2fSdrahn#  sections, generated by -ffunction-sections and -fdata-sections in GCC,
46*d2201f2fSdrahn#  and useful for --gc-sections, which for a variable "foo" might be
47*d2201f2fSdrahn#  ".data.foo".  Then there are the linkonce sections, for which the linker
48*d2201f2fSdrahn#  eliminates duplicates, which are named like ".gnu.linkonce.d.foo".
49*d2201f2fSdrahn#  The exact correspondences are:
50*d2201f2fSdrahn#
51*d2201f2fSdrahn#  Section	Linkonce section
52*d2201f2fSdrahn#  .text	.gnu.linkonce.t.foo
53*d2201f2fSdrahn#  .rodata	.gnu.linkonce.r.foo
54*d2201f2fSdrahn#  .data	.gnu.linkonce.d.foo
55*d2201f2fSdrahn#  .bss		.gnu.linkonce.b.foo
56*d2201f2fSdrahn#  .sdata	.gnu.linkonce.s.foo
57*d2201f2fSdrahn#  .sbss	.gnu.linkonce.sb.foo
58*d2201f2fSdrahn#  .sdata2	.gnu.linkonce.s2.foo
59*d2201f2fSdrahn#  .sbss2	.gnu.linkonce.sb2.foo
60*d2201f2fSdrahn#  .debug_info	.gnu.linkonce.wi.foo
61*d2201f2fSdrahn#  .tdata	.gnu.linkonce.td.foo
62*d2201f2fSdrahn#  .tbss	.gnu.linkonce.tb.foo
63*d2201f2fSdrahn#
64*d2201f2fSdrahn#  Each of these can also have corresponding .rel.* and .rela.* sections.
65*d2201f2fSdrahn
66*d2201f2fSdrahntest -z "$ENTRY" && ENTRY=_start
67*d2201f2fSdrahntest -z "${ELFSIZE}" && ELFSIZE=32
68*d2201f2fSdrahntest -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8"
69*d2201f2fSdrahntest "$LD_FLAG" = "N" && DATA_ADDR=.
70*d2201f2fSdrahntest -n "$CREATE_SHLIB" && test -n "$SHLIB_DATA_ADDR" && COMMONPAGESIZE=""
71*d2201f2fSdrahntest -z "$CREATE_SHLIB" && test -n "$DATA_ADDR" && COMMONPAGESIZE=""
72*d2201f2fSdrahnDATA_SEGMENT_ALIGN="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))"
73*d2201f2fSdrahnDATA_SEGMENT_END=""
74*d2201f2fSdrahnif test -n "${COMMONPAGESIZE}"; then
75*d2201f2fSdrahn  DATA_SEGMENT_ALIGN="ALIGN (${SEGMENT_SIZE}) - ((${MAXPAGESIZE} - .) & (${MAXPAGESIZE} - 1)); . = DATA_SEGMENT_ALIGN (${MAXPAGESIZE}, ${COMMONPAGESIZE})"
76*d2201f2fSdrahn  DATA_SEGMENT_END=". = DATA_SEGMENT_END (.);"
77*d2201f2fSdrahnfi
78*d2201f2fSdrahnINTERP=".interp       ${RELOCATING-0} : { *(.interp) }"
79*d2201f2fSdrahnDYNAMIC=".dynamic      ${RELOCATING-0} : { *(.dynamic) }"
80*d2201f2fSdrahnRODATA=".rodata       ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
81*d2201f2fSdrahnINIT_LIT=".init.literal 0 : { *(.init.literal)	}"
82*d2201f2fSdrahnINIT=".init         0 : { *(.init)		}"
83*d2201f2fSdrahnFINI_LIT=".fini.literal 0 : { *(.fini.literal)	}"
84*d2201f2fSdrahnFINI=".fini         0 : { *(.fini)		}"
85*d2201f2fSdrahnif test -z "${NO_SMALL_DATA}"; then
86*d2201f2fSdrahn  SBSS=".sbss         ${RELOCATING-0} :
87*d2201f2fSdrahn  {
88*d2201f2fSdrahn    ${RELOCATING+PROVIDE (__sbss_start = .);}
89*d2201f2fSdrahn    ${RELOCATING+PROVIDE (___sbss_start = .);}
90*d2201f2fSdrahn    *(.dynsbss)
91*d2201f2fSdrahn    *(.sbss${RELOCATING+ .sbss.* .gnu.linkonce.sb.*})
92*d2201f2fSdrahn    *(.scommon)
93*d2201f2fSdrahn    ${RELOCATING+PROVIDE (__sbss_end = .);}
94*d2201f2fSdrahn    ${RELOCATING+PROVIDE (___sbss_end = .);}
95*d2201f2fSdrahn  }"
96*d2201f2fSdrahn  SBSS2=".sbss2        ${RELOCATING-0} : { *(.sbss2${RELOCATING+ .sbss2.* .gnu.linkonce.sb2.*}) }"
97*d2201f2fSdrahn  SDATA="/* We want the small data sections together, so single-instruction offsets
98*d2201f2fSdrahn     can access them all, and initialized data all before uninitialized, so
99*d2201f2fSdrahn     we can shorten the on-disk segment size.  */
100*d2201f2fSdrahn  .sdata        ${RELOCATING-0} :
101*d2201f2fSdrahn  {
102*d2201f2fSdrahn    ${RELOCATING+${SDATA_START_SYMBOLS}}
103*d2201f2fSdrahn    *(.sdata${RELOCATING+ .sdata.* .gnu.linkonce.s.*})
104*d2201f2fSdrahn  }"
105*d2201f2fSdrahn  SDATA2=".sdata2       ${RELOCATING-0} : { *(.sdata2${RELOCATING+ .sdata2.* .gnu.linkonce.s2.*}) }"
106*d2201f2fSdrahn  REL_SDATA=".rel.sdata    ${RELOCATING-0} : { *(.rel.sdata${RELOCATING+ .rel.sdata.* .rel.gnu.linkonce.s.*}) }
107*d2201f2fSdrahn  .rela.sdata   ${RELOCATING-0} : { *(.rela.sdata${RELOCATING+ .rela.sdata.* .rela.gnu.linkonce.s.*}) }"
108*d2201f2fSdrahn  REL_SBSS=".rel.sbss     ${RELOCATING-0} : { *(.rel.sbss${RELOCATING+ .rel.sbss.* .rel.gnu.linkonce.sb.*}) }
109*d2201f2fSdrahn  .rela.sbss    ${RELOCATING-0} : { *(.rela.sbss${RELOCATING+ .rela.sbss.* .rela.gnu.linkonce.sb.*}) }"
110*d2201f2fSdrahn  REL_SDATA2=".rel.sdata2   ${RELOCATING-0} : { *(.rel.sdata2${RELOCATING+ .rel.sdata2.* .rel.gnu.linkonce.s2.*}) }
111*d2201f2fSdrahn  .rela.sdata2  ${RELOCATING-0} : { *(.rela.sdata2${RELOCATING+ .rela.sdata2.* .rela.gnu.linkonce.s2.*}) }"
112*d2201f2fSdrahn  REL_SBSS2=".rel.sbss2    ${RELOCATING-0} : { *(.rel.sbss2${RELOCATING+ .rel.sbss2.* .rel.gnu.linkonce.sb2.*}) }
113*d2201f2fSdrahn  .rela.sbss2   ${RELOCATING-0} : { *(.rela.sbss2${RELOCATING+ .rela.sbss2.* .rela.gnu.linkonce.sb2.*}) }"
114*d2201f2fSdrahnfi
115*d2201f2fSdrahnCTOR=".ctors        ${CONSTRUCTING-0} :
116*d2201f2fSdrahn  {
117*d2201f2fSdrahn    ${CONSTRUCTING+${CTOR_START}}
118*d2201f2fSdrahn    /* gcc uses crtbegin.o to find the start of
119*d2201f2fSdrahn       the constructors, so we make sure it is
120*d2201f2fSdrahn       first.  Because this is a wildcard, it
121*d2201f2fSdrahn       doesn't matter if the user does not
122*d2201f2fSdrahn       actually link against crtbegin.o; the
123*d2201f2fSdrahn       linker won't look for a file to match a
124*d2201f2fSdrahn       wildcard.  The wildcard also means that it
125*d2201f2fSdrahn       doesn't matter which directory crtbegin.o
126*d2201f2fSdrahn       is in.  */
127*d2201f2fSdrahn
128*d2201f2fSdrahn    KEEP (*crtbegin*.o(.ctors))
129*d2201f2fSdrahn
130*d2201f2fSdrahn    /* We don't want to include the .ctor section from
131*d2201f2fSdrahn       from the crtend.o file until after the sorted ctors.
132*d2201f2fSdrahn       The .ctor section from the crtend file contains the
133*d2201f2fSdrahn       end of ctors marker and it must be last */
134*d2201f2fSdrahn
135*d2201f2fSdrahn    KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .ctors))
136*d2201f2fSdrahn    KEEP (*(SORT(.ctors.*)))
137*d2201f2fSdrahn    KEEP (*(.ctors))
138*d2201f2fSdrahn    ${CONSTRUCTING+${CTOR_END}}
139*d2201f2fSdrahn  }"
140*d2201f2fSdrahnDTOR=".dtors        ${CONSTRUCTING-0} :
141*d2201f2fSdrahn  {
142*d2201f2fSdrahn    ${CONSTRUCTING+${DTOR_START}}
143*d2201f2fSdrahn    KEEP (*crtbegin*.o(.dtors))
144*d2201f2fSdrahn    KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .dtors))
145*d2201f2fSdrahn    KEEP (*(SORT(.dtors.*)))
146*d2201f2fSdrahn    KEEP (*(.dtors))
147*d2201f2fSdrahn    ${CONSTRUCTING+${DTOR_END}}
148*d2201f2fSdrahn  }"
149*d2201f2fSdrahnSTACK="  .stack        ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} :
150*d2201f2fSdrahn  {
151*d2201f2fSdrahn    ${RELOCATING+_stack = .;}
152*d2201f2fSdrahn    *(.stack)
153*d2201f2fSdrahn  }"
154*d2201f2fSdrahn
155*d2201f2fSdrahn# if this is for an embedded system, don't add SIZEOF_HEADERS.
156*d2201f2fSdrahnif [ -z "$EMBEDDED" ]; then
157*d2201f2fSdrahn   test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR} + SIZEOF_HEADERS"
158*d2201f2fSdrahnelse
159*d2201f2fSdrahn   test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}"
160*d2201f2fSdrahnfi
161*d2201f2fSdrahn
162*d2201f2fSdrahncat <<EOF
163*d2201f2fSdrahnENTRY(${ENTRY})
164*d2201f2fSdrahn
165*d2201f2fSdrahn${RELOCATING+${LIB_SEARCH_DIRS}}
166*d2201f2fSdrahn${RELOCATING+/* Do we need any of these for elf?
167*d2201f2fSdrahn   __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}}  */}
168*d2201f2fSdrahn${RELOCATING+${EXECUTABLE_SYMBOLS}}
169*d2201f2fSdrahn${RELOCATING+${INPUT_FILES}}
170*d2201f2fSdrahn${RELOCATING- /* For some reason, the Solaris linker makes bad executables
171*d2201f2fSdrahn  if gld -r is used and the intermediate file has sections starting
172*d2201f2fSdrahn  at non-zero addresses.  Could be a Solaris ld bug, could be a GNU ld
173*d2201f2fSdrahn  bug.  But for now assigning the zero vmas works.  */}
174*d2201f2fSdrahn
175*d2201f2fSdrahnSECTIONS
176*d2201f2fSdrahn{
177*d2201f2fSdrahn  /* Read-only sections, merged into text segment: */
178*d2201f2fSdrahn  ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_BASE_ADDRESS};}}
179*d2201f2fSdrahn  ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}}
180*d2201f2fSdrahn  ${CREATE_SHLIB-${INTERP}}
181*d2201f2fSdrahn  ${INITIAL_READONLY_SECTIONS}
182*d2201f2fSdrahn  ${TEXT_DYNAMIC+${DYNAMIC}}
183*d2201f2fSdrahn  .hash         ${RELOCATING-0} : { *(.hash) }
184*d2201f2fSdrahn  .dynsym       ${RELOCATING-0} : { *(.dynsym) }
185*d2201f2fSdrahn  .dynstr       ${RELOCATING-0} : { *(.dynstr) }
186*d2201f2fSdrahn  .gnu.version  ${RELOCATING-0} : { *(.gnu.version) }
187*d2201f2fSdrahn  .gnu.version_d ${RELOCATING-0}: { *(.gnu.version_d) }
188*d2201f2fSdrahn  .gnu.version_r ${RELOCATING-0}: { *(.gnu.version_r) }
189*d2201f2fSdrahn
190*d2201f2fSdrahnEOF
191*d2201f2fSdrahnif [ "x$COMBRELOC" = x ]; then
192*d2201f2fSdrahn  COMBRELOCCAT=cat
193*d2201f2fSdrahnelse
194*d2201f2fSdrahn  COMBRELOCCAT="cat > $COMBRELOC"
195*d2201f2fSdrahnfi
196*d2201f2fSdrahneval $COMBRELOCCAT <<EOF
197*d2201f2fSdrahn  .rel.init     ${RELOCATING-0} : { *(.rel.init) }
198*d2201f2fSdrahn  .rela.init    ${RELOCATING-0} : { *(.rela.init) }
199*d2201f2fSdrahn  .rel.text     ${RELOCATING-0} : { *(.rel.text${RELOCATING+ .rel.text.* .rel.gnu.linkonce.t.*}) }
200*d2201f2fSdrahn  .rela.text    ${RELOCATING-0} : { *(.rela.text${RELOCATING+ .rela.text.* .rela.gnu.linkonce.t.*}) }
201*d2201f2fSdrahn  .rel.fini     ${RELOCATING-0} : { *(.rel.fini) }
202*d2201f2fSdrahn  .rela.fini    ${RELOCATING-0} : { *(.rela.fini) }
203*d2201f2fSdrahn  .rel.rodata   ${RELOCATING-0} : { *(.rel.rodata${RELOCATING+ .rel.rodata.* .rel.gnu.linkonce.r.*}) }
204*d2201f2fSdrahn  .rela.rodata  ${RELOCATING-0} : { *(.rela.rodata${RELOCATING+ .rela.rodata.* .rela.gnu.linkonce.r.*}) }
205*d2201f2fSdrahn  ${OTHER_READONLY_RELOC_SECTIONS}
206*d2201f2fSdrahn  .rel.data     ${RELOCATING-0} : { *(.rel.data${RELOCATING+ .rel.data.* .rel.gnu.linkonce.d.*}) }
207*d2201f2fSdrahn  .rela.data    ${RELOCATING-0} : { *(.rela.data${RELOCATING+ .rela.data.* .rela.gnu.linkonce.d.*}) }
208*d2201f2fSdrahn  .rel.tdata	${RELOCATING-0} : { *(.rel.tdata${RELOCATING+ .rel.tdata.* .rel.gnu.linkonce.td.*}) }
209*d2201f2fSdrahn  .rela.tdata	${RELOCATING-0} : { *(.rela.tdata${RELOCATING+ .rela.tdata.* .rela.gnu.linkonce.td.*}) }
210*d2201f2fSdrahn  .rel.tbss	${RELOCATING-0} : { *(.rel.tbss${RELOCATING+ .rel.tbss.* .rel.gnu.linkonce.tb.*}) }
211*d2201f2fSdrahn  .rela.tbss	${RELOCATING-0} : { *(.rela.tbss${RELOCATING+ .rela.tbss.* .rela.gnu.linkonce.tb.*}) }
212*d2201f2fSdrahn  .rel.ctors    ${RELOCATING-0} : { *(.rel.ctors) }
213*d2201f2fSdrahn  .rela.ctors   ${RELOCATING-0} : { *(.rela.ctors) }
214*d2201f2fSdrahn  .rel.dtors    ${RELOCATING-0} : { *(.rel.dtors) }
215*d2201f2fSdrahn  .rela.dtors   ${RELOCATING-0} : { *(.rela.dtors) }
216*d2201f2fSdrahn  .rel.got      ${RELOCATING-0} : { *(.rel.got) }
217*d2201f2fSdrahn  .rela.got     ${RELOCATING-0} : { *(.rela.got) }
218*d2201f2fSdrahn  ${OTHER_GOT_RELOC_SECTIONS}
219*d2201f2fSdrahn  ${REL_SDATA}
220*d2201f2fSdrahn  ${REL_SBSS}
221*d2201f2fSdrahn  ${REL_SDATA2}
222*d2201f2fSdrahn  ${REL_SBSS2}
223*d2201f2fSdrahn  .rel.bss      ${RELOCATING-0} : { *(.rel.bss${RELOCATING+ .rel.bss.* .rel.gnu.linkonce.b.*}) }
224*d2201f2fSdrahn  .rela.bss     ${RELOCATING-0} : { *(.rela.bss${RELOCATING+ .rela.bss.* .rela.gnu.linkonce.b.*}) }
225*d2201f2fSdrahnEOF
226*d2201f2fSdrahnif [ -n "$COMBRELOC" ]; then
227*d2201f2fSdrahncat <<EOF
228*d2201f2fSdrahn  .rel.dyn      ${RELOCATING-0} :
229*d2201f2fSdrahn    {
230*d2201f2fSdrahnEOF
231*d2201f2fSdrahnsed -e '/^[ 	]*[{}][ 	]*$/d;/:[ 	]*$/d;/\.rela\./d;s/^.*: { *\(.*\)}$/      \1/' $COMBRELOC
232*d2201f2fSdrahncat <<EOF
233*d2201f2fSdrahn    }
234*d2201f2fSdrahn  .rela.dyn     ${RELOCATING-0} :
235*d2201f2fSdrahn    {
236*d2201f2fSdrahnEOF
237*d2201f2fSdrahnsed -e '/^[ 	]*[{}][ 	]*$/d;/:[ 	]*$/d;/\.rel\./d;s/^.*: { *\(.*\)}/      \1/' $COMBRELOC
238*d2201f2fSdrahncat <<EOF
239*d2201f2fSdrahn    }
240*d2201f2fSdrahnEOF
241*d2201f2fSdrahnfi
242*d2201f2fSdrahncat <<EOF
243*d2201f2fSdrahn  .rel.plt      ${RELOCATING-0} : { *(.rel.plt) }
244*d2201f2fSdrahn  .rela.plt     ${RELOCATING-0} : { *(.rela.plt) }
245*d2201f2fSdrahn  ${OTHER_PLT_RELOC_SECTIONS}
246*d2201f2fSdrahn
247*d2201f2fSdrahn  ${RELOCATING-$INIT_LIT}
248*d2201f2fSdrahn  ${RELOCATING-$INIT}
249*d2201f2fSdrahn
250*d2201f2fSdrahn  .text         ${RELOCATING-0} :
251*d2201f2fSdrahn  {
252*d2201f2fSdrahn    *(.got.plt* .plt*)
253*d2201f2fSdrahn
254*d2201f2fSdrahn    ${RELOCATING+${INIT_START}}
255*d2201f2fSdrahn    ${RELOCATING+KEEP (*(.init.literal))}
256*d2201f2fSdrahn    ${RELOCATING+KEEP (*(.init))}
257*d2201f2fSdrahn    ${RELOCATING+${INIT_END}}
258*d2201f2fSdrahn
259*d2201f2fSdrahn    ${RELOCATING+${TEXT_START_SYMBOLS}}
260*d2201f2fSdrahn    *(.literal .text .stub${RELOCATING+ .text.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*})
261*d2201f2fSdrahn    /* .gnu.warning sections are handled specially by elf32.em.  */
262*d2201f2fSdrahn    *(.gnu.warning)
263*d2201f2fSdrahn    ${RELOCATING+${OTHER_TEXT_SECTIONS}}
264*d2201f2fSdrahn
265*d2201f2fSdrahn    ${RELOCATING+${FINI_START}}
266*d2201f2fSdrahn    ${RELOCATING+KEEP (*(.fini.literal))}
267*d2201f2fSdrahn    ${RELOCATING+KEEP (*(.fini))}
268*d2201f2fSdrahn    ${RELOCATING+${FINI_END}}
269*d2201f2fSdrahn  } =${NOP-0}
270*d2201f2fSdrahn
271*d2201f2fSdrahn  ${RELOCATING-$FINI_LIT}
272*d2201f2fSdrahn  ${RELOCATING-$FINI}
273*d2201f2fSdrahn
274*d2201f2fSdrahn  ${RELOCATING+PROVIDE (__etext = .);}
275*d2201f2fSdrahn  ${RELOCATING+PROVIDE (_etext = .);}
276*d2201f2fSdrahn  ${RELOCATING+PROVIDE (etext = .);}
277*d2201f2fSdrahn  ${WRITABLE_RODATA-${RODATA}}
278*d2201f2fSdrahn  .rodata1      ${RELOCATING-0} : { *(.rodata1) }
279*d2201f2fSdrahn  ${CREATE_SHLIB-${SDATA2}}
280*d2201f2fSdrahn  ${CREATE_SHLIB-${SBSS2}}
281*d2201f2fSdrahn  ${OTHER_READONLY_SECTIONS}
282*d2201f2fSdrahn  .eh_frame_hdr : { *(.eh_frame_hdr) }
283*d2201f2fSdrahn
284*d2201f2fSdrahn  /* Adjust the address for the data segment.  We want to adjust up to
285*d2201f2fSdrahn     the same address within the page on the next page up.  */
286*d2201f2fSdrahn  ${CREATE_SHLIB-${RELOCATING+. = ${DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}
287*d2201f2fSdrahn  ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}
288*d2201f2fSdrahn
289*d2201f2fSdrahn  /* Ensure the __preinit_array_start label is properly aligned.  We
290*d2201f2fSdrahn     could instead move the label definition inside the section, but
291*d2201f2fSdrahn     the linker would then create the section even if it turns out to
292*d2201f2fSdrahn     be empty, which isn't pretty.  */
293*d2201f2fSdrahn  ${RELOCATING+. = ALIGN(${ALIGNMENT});}
294*d2201f2fSdrahn  ${RELOCATING+${CREATE_SHLIB-PROVIDE (__preinit_array_start = .);}}
295*d2201f2fSdrahn  .preinit_array   ${RELOCATING-0} : { *(.preinit_array) }
296*d2201f2fSdrahn  ${RELOCATING+${CREATE_SHLIB-PROVIDE (__preinit_array_end = .);}}
297*d2201f2fSdrahn
298*d2201f2fSdrahn  ${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_start = .);}}
299*d2201f2fSdrahn  .init_array   ${RELOCATING-0} : { *(.init_array) }
300*d2201f2fSdrahn  ${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_end = .);}}
301*d2201f2fSdrahn
302*d2201f2fSdrahn  ${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_start = .);}}
303*d2201f2fSdrahn  .fini_array   ${RELOCATING-0} : { *(.fini_array) }
304*d2201f2fSdrahn  ${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_end = .);}}
305*d2201f2fSdrahn
306*d2201f2fSdrahn  .data         ${RELOCATING-0} :
307*d2201f2fSdrahn  {
308*d2201f2fSdrahn    ${RELOCATING+${DATA_START_SYMBOLS}}
309*d2201f2fSdrahn    *(.data${RELOCATING+ .data.* .gnu.linkonce.d.*})
310*d2201f2fSdrahn    ${CONSTRUCTING+SORT(CONSTRUCTORS)}
311*d2201f2fSdrahn  }
312*d2201f2fSdrahn  .data1        ${RELOCATING-0} : { *(.data1) }
313*d2201f2fSdrahn  .tdata	${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) }
314*d2201f2fSdrahn  .tbss		${RELOCATING-0} : { *(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} }
315*d2201f2fSdrahn  .eh_frame     ${RELOCATING-0} : { KEEP (*(.eh_frame)) }
316*d2201f2fSdrahn  .gcc_except_table ${RELOCATING-0} : { *(.gcc_except_table) }
317*d2201f2fSdrahn  ${WRITABLE_RODATA+${RODATA}}
318*d2201f2fSdrahn  ${OTHER_READWRITE_SECTIONS}
319*d2201f2fSdrahn  ${TEXT_DYNAMIC-${DYNAMIC}}
320*d2201f2fSdrahn  ${RELOCATING+${CTOR}}
321*d2201f2fSdrahn  ${RELOCATING+${DTOR}}
322*d2201f2fSdrahn  .jcr          ${RELOCATING-0} : { KEEP (*(.jcr)) }
323*d2201f2fSdrahn  ${RELOCATING+${OTHER_GOT_SYMBOLS}}
324*d2201f2fSdrahn  .got          ${RELOCATING-0} : { *(.got) }
325*d2201f2fSdrahn  ${OTHER_GOT_SECTIONS}
326*d2201f2fSdrahn  ${CREATE_SHLIB+${SDATA2}}
327*d2201f2fSdrahn  ${CREATE_SHLIB+${SBSS2}}
328*d2201f2fSdrahn  ${SDATA}
329*d2201f2fSdrahn  ${OTHER_SDATA_SECTIONS}
330*d2201f2fSdrahn  ${RELOCATING+_edata = .;}
331*d2201f2fSdrahn  ${RELOCATING+PROVIDE (edata = .);}
332*d2201f2fSdrahn  ${RELOCATING+__bss_start = .;}
333*d2201f2fSdrahn  ${RELOCATING+${OTHER_BSS_SYMBOLS}}
334*d2201f2fSdrahn  ${SBSS}
335*d2201f2fSdrahn  .bss          ${RELOCATING-0} :
336*d2201f2fSdrahn  {
337*d2201f2fSdrahn   *(.dynbss)
338*d2201f2fSdrahn   *(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*})
339*d2201f2fSdrahn   *(COMMON)
340*d2201f2fSdrahn   /* Align here to ensure that the .bss section occupies space up to
341*d2201f2fSdrahn      _end.  Align after .bss to ensure correct alignment even if the
342*d2201f2fSdrahn      .bss section disappears because there are no input sections.  */
343*d2201f2fSdrahn   ${RELOCATING+. = ALIGN(${ALIGNMENT});}
344*d2201f2fSdrahn  }
345*d2201f2fSdrahn  ${OTHER_BSS_SECTIONS}
346*d2201f2fSdrahn  ${RELOCATING+. = ALIGN(${ALIGNMENT});}
347*d2201f2fSdrahn  ${RELOCATING+_end = .;}
348*d2201f2fSdrahn  ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
349*d2201f2fSdrahn  ${RELOCATING+PROVIDE (end = .);}
350*d2201f2fSdrahn  ${RELOCATING+${DATA_SEGMENT_END}}
351*d2201f2fSdrahn
352*d2201f2fSdrahn  /* Stabs debugging sections.  */
353*d2201f2fSdrahn  .stab          0 : { *(.stab) }
354*d2201f2fSdrahn  .stabstr       0 : { *(.stabstr) }
355*d2201f2fSdrahn  .stab.excl     0 : { *(.stab.excl) }
356*d2201f2fSdrahn  .stab.exclstr  0 : { *(.stab.exclstr) }
357*d2201f2fSdrahn  .stab.index    0 : { *(.stab.index) }
358*d2201f2fSdrahn  .stab.indexstr 0 : { *(.stab.indexstr) }
359*d2201f2fSdrahn
360*d2201f2fSdrahn  .comment       0 : { *(.comment) }
361*d2201f2fSdrahn
362*d2201f2fSdrahn  /* DWARF debug sections.
363*d2201f2fSdrahn     Symbols in the DWARF debugging sections are relative to the beginning
364*d2201f2fSdrahn     of the section so we begin them at 0.  */
365*d2201f2fSdrahn
366*d2201f2fSdrahn  /* DWARF 1 */
367*d2201f2fSdrahn  .debug          0 : { *(.debug) }
368*d2201f2fSdrahn  .line           0 : { *(.line) }
369*d2201f2fSdrahn
370*d2201f2fSdrahn  /* GNU DWARF 1 extensions */
371*d2201f2fSdrahn  .debug_srcinfo  0 : { *(.debug_srcinfo) }
372*d2201f2fSdrahn  .debug_sfnames  0 : { *(.debug_sfnames) }
373*d2201f2fSdrahn
374*d2201f2fSdrahn  /* DWARF 1.1 and DWARF 2 */
375*d2201f2fSdrahn  .debug_aranges  0 : { *(.debug_aranges) }
376*d2201f2fSdrahn  .debug_pubnames 0 : { *(.debug_pubnames) }
377*d2201f2fSdrahn
378*d2201f2fSdrahn  /* DWARF 2 */
379*d2201f2fSdrahn  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
380*d2201f2fSdrahn  .debug_abbrev   0 : { *(.debug_abbrev) }
381*d2201f2fSdrahn  .debug_line     0 : { *(.debug_line) }
382*d2201f2fSdrahn  .debug_frame    0 : { *(.debug_frame) }
383*d2201f2fSdrahn  .debug_str      0 : { *(.debug_str) }
384*d2201f2fSdrahn  .debug_loc      0 : { *(.debug_loc) }
385*d2201f2fSdrahn  .debug_macinfo  0 : { *(.debug_macinfo) }
386*d2201f2fSdrahn
387*d2201f2fSdrahn  /* SGI/MIPS DWARF 2 extensions */
388*d2201f2fSdrahn  .debug_weaknames 0 : { *(.debug_weaknames) }
389*d2201f2fSdrahn  .debug_funcnames 0 : { *(.debug_funcnames) }
390*d2201f2fSdrahn  .debug_typenames 0 : { *(.debug_typenames) }
391*d2201f2fSdrahn  .debug_varnames  0 : { *(.debug_varnames) }
392*d2201f2fSdrahn
393*d2201f2fSdrahn  ${STACK_ADDR+${STACK}}
394*d2201f2fSdrahn  ${OTHER_SECTIONS}
395*d2201f2fSdrahn  ${RELOCATING+${OTHER_END_SYMBOLS}}
396*d2201f2fSdrahn}
397*d2201f2fSdrahnEOF
398