1*3d8817e4Smiod# This variant of elf.sc is used for ARM BPABI platforms, like Symbian
2*3d8817e4Smiod# OS, where a separate postlinker will operated on the generated
3*3d8817e4Smiod# executable or shared object.  See elf.sc for configuration variables
4*3d8817e4Smiod# that apply; only BPABI-specific variables will be noted here.
5*3d8817e4Smiod
6*3d8817e4Smiodtest -z "$ENTRY" && ENTRY=_start
7*3d8817e4Smiodtest -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
8*3d8817e4Smiodtest -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
9*3d8817e4Smiodif [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi
10*3d8817e4Smiodtest -z "${ELFSIZE}" && ELFSIZE=32
11*3d8817e4Smiodtest -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8"
12*3d8817e4Smiodtest "$LD_FLAG" = "N" && DATA_ADDR=.
13*3d8817e4Smiodtest -n "$CREATE_SHLIB$CREATE_PIE" && test -n "$SHLIB_DATA_ADDR" && COMMONPAGESIZE=""
14*3d8817e4Smiodtest -z "$CREATE_SHLIB$CREATE_PIE" && test -n "$DATA_ADDR" && COMMONPAGESIZE=""
15*3d8817e4Smiodtest -n "$RELRO_NOW" && unset SEPARATE_GOTPLT
16*3d8817e4SmiodDATA_SEGMENT_ALIGN="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))"
17*3d8817e4SmiodDATA_SEGMENT_RELRO_END=""
18*3d8817e4SmiodDATA_SEGMENT_RELRO_GOTPLT_END=""
19*3d8817e4SmiodDATA_SEGMENT_END=""
20*3d8817e4Smiodif test -n "${COMMONPAGESIZE}"; then
21*3d8817e4Smiod  DATA_SEGMENT_ALIGN="ALIGN (${SEGMENT_SIZE}) - ((${MAXPAGESIZE} - .) & (${MAXPAGESIZE} - 1)); . = DATA_SEGMENT_ALIGN (${MAXPAGESIZE}, ${COMMONPAGESIZE})"
22*3d8817e4Smiod  DATA_SEGMENT_END=". = DATA_SEGMENT_END (.);"
23*3d8817e4Smiod  if test -n "${SEPARATE_GOTPLT}"; then
24*3d8817e4Smiod    DATA_SEGMENT_RELRO_GOTPLT_END=". = DATA_SEGMENT_RELRO_END (. + ${SEPARATE_GOTPLT});"
25*3d8817e4Smiod  else
26*3d8817e4Smiod    DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (.);"
27*3d8817e4Smiod  fi
28*3d8817e4Smiodfi
29*3d8817e4SmiodINTERP=".interp       0 : { *(.interp) }"
30*3d8817e4SmiodPLT=".plt          ${RELOCATING-0} : { *(.plt) }"
31*3d8817e4SmiodRODATA=".rodata       ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
32*3d8817e4SmiodDATARELRO=".data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) }"
33*3d8817e4SmiodSTACKNOTE="/DISCARD/ : { *(.note.GNU-stack) }"
34*3d8817e4Smiodif test -z "${NO_SMALL_DATA}"; then
35*3d8817e4Smiod  SBSS=".sbss         ${RELOCATING-0} :
36*3d8817e4Smiod  {
37*3d8817e4Smiod    ${RELOCATING+PROVIDE (__sbss_start = .);}
38*3d8817e4Smiod    ${RELOCATING+PROVIDE (___sbss_start = .);}
39*3d8817e4Smiod    *(.dynsbss)
40*3d8817e4Smiod    *(.sbss${RELOCATING+ .sbss.* .gnu.linkonce.sb.*})
41*3d8817e4Smiod    *(.scommon)
42*3d8817e4Smiod    ${RELOCATING+PROVIDE (__sbss_end = .);}
43*3d8817e4Smiod    ${RELOCATING+PROVIDE (___sbss_end = .);}
44*3d8817e4Smiod  }"
45*3d8817e4Smiod  SBSS2=".sbss2        ${RELOCATING-0} : { *(.sbss2${RELOCATING+ .sbss2.* .gnu.linkonce.sb2.*}) }"
46*3d8817e4Smiod  SDATA="/* We want the small data sections together, so single-instruction offsets
47*3d8817e4Smiod     can access them all, and initialized data all before uninitialized, so
48*3d8817e4Smiod     we can shorten the on-disk segment size.  */
49*3d8817e4Smiod  .sdata        ${RELOCATING-0} :
50*3d8817e4Smiod  {
51*3d8817e4Smiod    ${RELOCATING+${SDATA_START_SYMBOLS}}
52*3d8817e4Smiod    *(.sdata${RELOCATING+ .sdata.* .gnu.linkonce.s.*})
53*3d8817e4Smiod  }"
54*3d8817e4Smiod  SDATA2=".sdata2       ${RELOCATING-0} : { *(.sdata2${RELOCATING+ .sdata2.* .gnu.linkonce.s2.*}) }"
55*3d8817e4Smiod  REL_SDATA=".rel.sdata    ${RELOCATING-0} : { *(.rel.sdata${RELOCATING+ .rel.sdata.* .rel.gnu.linkonce.s.*}) }
56*3d8817e4Smiod  .rela.sdata   ${RELOCATING-0} : { *(.rela.sdata${RELOCATING+ .rela.sdata.* .rela.gnu.linkonce.s.*}) }"
57*3d8817e4Smiod  REL_SBSS=".rel.sbss     ${RELOCATING-0} : { *(.rel.sbss${RELOCATING+ .rel.sbss.* .rel.gnu.linkonce.sb.*}) }
58*3d8817e4Smiod  .rela.sbss    ${RELOCATING-0} : { *(.rela.sbss${RELOCATING+ .rela.sbss.* .rela.gnu.linkonce.sb.*}) }"
59*3d8817e4Smiod  REL_SDATA2=".rel.sdata2   ${RELOCATING-0} : { *(.rel.sdata2${RELOCATING+ .rel.sdata2.* .rel.gnu.linkonce.s2.*}) }
60*3d8817e4Smiod  .rela.sdata2  ${RELOCATING-0} : { *(.rela.sdata2${RELOCATING+ .rela.sdata2.* .rela.gnu.linkonce.s2.*}) }"
61*3d8817e4Smiod  REL_SBSS2=".rel.sbss2    ${RELOCATING-0} : { *(.rel.sbss2${RELOCATING+ .rel.sbss2.* .rel.gnu.linkonce.sb2.*}) }
62*3d8817e4Smiod  .rela.sbss2   ${RELOCATING-0} : { *(.rela.sbss2${RELOCATING+ .rela.sbss2.* .rela.gnu.linkonce.sb2.*}) }"
63*3d8817e4Smiodelse
64*3d8817e4Smiod  NO_SMALL_DATA=" "
65*3d8817e4Smiodfi
66*3d8817e4Smiodtest -n "$SEPARATE_GOTPLT" && SEPARATE_GOTPLT=" "
67*3d8817e4SmiodCTOR=".ctors        ${CONSTRUCTING-0} :
68*3d8817e4Smiod  {
69*3d8817e4Smiod    ${CONSTRUCTING+${CTOR_START}}
70*3d8817e4Smiod    /* gcc uses crtbegin.o to find the start of
71*3d8817e4Smiod       the constructors, so we make sure it is
72*3d8817e4Smiod       first.  Because this is a wildcard, it
73*3d8817e4Smiod       doesn't matter if the user does not
74*3d8817e4Smiod       actually link against crtbegin.o; the
75*3d8817e4Smiod       linker won't look for a file to match a
76*3d8817e4Smiod       wildcard.  The wildcard also means that it
77*3d8817e4Smiod       doesn't matter which directory crtbegin.o
78*3d8817e4Smiod       is in.  */
79*3d8817e4Smiod
80*3d8817e4Smiod    KEEP (*crtbegin*.o(.ctors))
81*3d8817e4Smiod
82*3d8817e4Smiod    /* We don't want to include the .ctor section from
83*3d8817e4Smiod       the crtend.o file until after the sorted ctors.
84*3d8817e4Smiod       The .ctor section from the crtend file contains the
85*3d8817e4Smiod       end of ctors marker and it must be last */
86*3d8817e4Smiod
87*3d8817e4Smiod    KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .ctors))
88*3d8817e4Smiod    KEEP (*(SORT(.ctors.*)))
89*3d8817e4Smiod    KEEP (*(.ctors))
90*3d8817e4Smiod    ${CONSTRUCTING+${CTOR_END}}
91*3d8817e4Smiod  }"
92*3d8817e4SmiodDTOR=".dtors        ${CONSTRUCTING-0} :
93*3d8817e4Smiod  {
94*3d8817e4Smiod    ${CONSTRUCTING+${DTOR_START}}
95*3d8817e4Smiod    KEEP (*crtbegin*.o(.dtors))
96*3d8817e4Smiod    KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .dtors))
97*3d8817e4Smiod    KEEP (*(SORT(.dtors.*)))
98*3d8817e4Smiod    KEEP (*(.dtors))
99*3d8817e4Smiod    ${CONSTRUCTING+${DTOR_END}}
100*3d8817e4Smiod  }"
101*3d8817e4SmiodSTACK="  .stack        ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} :
102*3d8817e4Smiod  {
103*3d8817e4Smiod    ${RELOCATING+_stack = .;}
104*3d8817e4Smiod    *(.stack)
105*3d8817e4Smiod  }"
106*3d8817e4Smiod
107*3d8817e4SmiodTEXT_START_ADDR="SEGMENT_START(\"text\", ${TEXT_START_ADDR})"
108*3d8817e4SmiodSHLIB_TEXT_START_ADDR="SEGMENT_START(\"text\", ${SHLIB_TEXT_START_ADDR:-0})"
109*3d8817e4SmiodDATA_ADDR="SEGMENT_START(\"data\", ${DATA_ADDR-${DATA_SEGMENT_ALIGN}})"
110*3d8817e4SmiodSHLIB_DATA_ADDR="SEGMENT_START(\"data\", ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}})"
111*3d8817e4Smiod
112*3d8817e4Smiod# if this is for an embedded system, don't add SIZEOF_HEADERS.
113*3d8817e4Smiodif [ -z "$EMBEDDED" ]; then
114*3d8817e4Smiod   test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR} + SIZEOF_HEADERS"
115*3d8817e4Smiod   SHLIB_BASE_ADDRESS="${SHLIB_TEXT_START_ADDR} + SIZEOF_HEADERS"
116*3d8817e4Smiodelse
117*3d8817e4Smiod   test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}"
118*3d8817e4Smiod   SHLIB_BASE_ADDRESS="${SHLIB_TEXT_START_ADDR}"
119*3d8817e4Smiodfi
120*3d8817e4Smiod
121*3d8817e4Smiodcat <<EOF
122*3d8817e4SmiodOUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
123*3d8817e4Smiod	      "${LITTLE_OUTPUT_FORMAT}")
124*3d8817e4SmiodOUTPUT_ARCH(${OUTPUT_ARCH})
125*3d8817e4SmiodENTRY(${ENTRY})
126*3d8817e4Smiod
127*3d8817e4Smiod${RELOCATING+${LIB_SEARCH_DIRS}}
128*3d8817e4Smiod${RELOCATING+/* Do we need any of these for elf?
129*3d8817e4Smiod   __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}}  */}
130*3d8817e4Smiod${RELOCATING+${EXECUTABLE_SYMBOLS}}
131*3d8817e4Smiod${RELOCATING+${INPUT_FILES}}
132*3d8817e4Smiod${RELOCATING- /* For some reason, the Solaris linker makes bad executables
133*3d8817e4Smiod  if gld -r is used and the intermediate file has sections starting
134*3d8817e4Smiod  at non-zero addresses.  Could be a Solaris ld bug, could be a GNU ld
135*3d8817e4Smiod  bug.  But for now assigning the zero vmas works.  */}
136*3d8817e4Smiod
137*3d8817e4Smiod/* ARM's proprietary toolchain generate these symbols to match the start
138*3d8817e4Smiod   and end of particular sections of the image.  SymbianOS uses these
139*3d8817e4Smiod   symbols.  We provide them for compatibility with ARM's toolchains.
140*3d8817e4Smiod   These symbols should be bound locally; each shared object may define
141*3d8817e4Smiod   its own version of these symbols.  */
142*3d8817e4Smiod
143*3d8817e4SmiodVERSION
144*3d8817e4Smiod{
145*3d8817e4Smiod  /* Give these a dummy version to work around linker lameness.
146*3d8817e4Smiod     The name used shouldn't matter as these are all local symbols.  */
147*3d8817e4Smiod  __GNU {
148*3d8817e4Smiod    local:
149*3d8817e4Smiod      Image\$\$ER_RO\$\$Base;
150*3d8817e4Smiod      Image\$\$ER_RO\$\$Limit;
151*3d8817e4Smiod      SHT\$\$INIT_ARRAY\$\$Base;
152*3d8817e4Smiod      SHT\$\$INIT_ARRAY\$\$Limit;
153*3d8817e4Smiod      .ARM.exidx\$\$Base;
154*3d8817e4Smiod      .ARM.exidx\$\$Limit;
155*3d8817e4Smiod  };
156*3d8817e4Smiod}
157*3d8817e4Smiod
158*3d8817e4SmiodSECTIONS
159*3d8817e4Smiod{
160*3d8817e4Smiod  /* Read-only sections, merged into text segment: */
161*3d8817e4Smiod  ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+PROVIDE (__executable_start = ${TEXT_START_ADDR});}}}
162*3d8817e4Smiod
163*3d8817e4Smiod  ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+ . = ${TEXT_BASE_ADDRESS};}}}
164*3d8817e4Smiod  ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_BASE_ADDRESS};}}
165*3d8817e4Smiod  ${CREATE_PIE+${RELOCATING+. = ${SHLIB_BASE_ADDRESS};}}
166*3d8817e4Smiod
167*3d8817e4Smiod  /* Define Image\$\$ER_RO\$\$Base.  */
168*3d8817e4Smiod  ${RELOCATING+PROVIDE (Image\$\$ER_RO\$\$Base = .);}
169*3d8817e4Smiod
170*3d8817e4Smiod  ${INITIAL_READONLY_SECTIONS}
171*3d8817e4Smiod
172*3d8817e4SmiodEOF
173*3d8817e4Smiodcat <<EOF
174*3d8817e4Smiod  .init         ${RELOCATING-0} :
175*3d8817e4Smiod  {
176*3d8817e4Smiod    ${RELOCATING+${INIT_START}}
177*3d8817e4Smiod    KEEP (*(.init))
178*3d8817e4Smiod    ${RELOCATING+${INIT_END}}
179*3d8817e4Smiod  } =${NOP-0}
180*3d8817e4Smiod  .text         ${RELOCATING-0} :
181*3d8817e4Smiod  {
182*3d8817e4Smiod    ${RELOCATING+${TEXT_START_SYMBOLS}}
183*3d8817e4Smiod    *(.text .stub${RELOCATING+ .text.* .gnu.linkonce.t.*})
184*3d8817e4Smiod    KEEP (*(.text.*personality*))
185*3d8817e4Smiod    /* .gnu.warning sections are handled specially by elf32.em.  */
186*3d8817e4Smiod    *(.gnu.warning)
187*3d8817e4Smiod    ${RELOCATING+${OTHER_TEXT_SECTIONS}}
188*3d8817e4Smiod  } =${NOP-0}
189*3d8817e4Smiod  .fini         ${RELOCATING-0} :
190*3d8817e4Smiod  {
191*3d8817e4Smiod    ${RELOCATING+${FINI_START}}
192*3d8817e4Smiod    KEEP (*(.fini))
193*3d8817e4Smiod    ${RELOCATING+${FINI_END}}
194*3d8817e4Smiod  } =${NOP-0}
195*3d8817e4Smiod  /* The SymbianOS kernel requires that the PLT go at the end of the
196*3d8817e4Smiod     text section.  */
197*3d8817e4Smiod  ${DATA_PLT-${BSS_PLT-${PLT}}}
198*3d8817e4Smiod  ${RELOCATING+PROVIDE (__etext = .);}
199*3d8817e4Smiod  ${RELOCATING+PROVIDE (_etext = .);}
200*3d8817e4Smiod  ${RELOCATING+PROVIDE (etext = .);}
201*3d8817e4Smiod
202*3d8817e4Smiod  /* Define Image\$\$ER_RO\$\$Limit.  */
203*3d8817e4Smiod  ${RELOCATING+PROVIDE (Image\$\$ER_RO\$\$Limit = .);}
204*3d8817e4Smiod
205*3d8817e4Smiod  ${WRITABLE_RODATA-${RODATA}}
206*3d8817e4Smiod  .rodata1      ${RELOCATING-0} : { *(.rodata1) }
207*3d8817e4Smiod  ${CREATE_SHLIB-${SDATA2}}
208*3d8817e4Smiod  ${CREATE_SHLIB-${SBSS2}}
209*3d8817e4Smiod
210*3d8817e4Smiod  /* On SymbianOS, put  .init_array and friends in the read-only
211*3d8817e4Smiod     segment; there is no runtime relocation applied to these
212*3d8817e4Smiod     arrays.  */
213*3d8817e4Smiod
214*3d8817e4Smiod  .preinit_array   ${RELOCATING-0} :
215*3d8817e4Smiod  {
216*3d8817e4Smiod    ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__preinit_array_start = .);}}
217*3d8817e4Smiod    KEEP (*(.preinit_array))
218*3d8817e4Smiod    ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__preinit_array_end = .);}}
219*3d8817e4Smiod  }
220*3d8817e4Smiod  .init_array   ${RELOCATING-0} :
221*3d8817e4Smiod  {
222*3d8817e4Smiod    /* SymbianOS uses this symbol.  */
223*3d8817e4Smiod    ${RELOCATING+PROVIDE (SHT\$\$INIT_ARRAY\$\$Base = .);}
224*3d8817e4Smiod    ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__init_array_start = .);}}
225*3d8817e4Smiod    KEEP (*(SORT(.init_array.*)))
226*3d8817e4Smiod    KEEP (*(.init_array))
227*3d8817e4Smiod    ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__init_array_end = .);}}
228*3d8817e4Smiod    /* SymbianOS uses this symbol.  */
229*3d8817e4Smiod    ${RELOCATING+PROVIDE (SHT\$\$INIT_ARRAY\$\$Limit = .);}
230*3d8817e4Smiod  }
231*3d8817e4Smiod  .fini_array   ${RELOCATING-0} :
232*3d8817e4Smiod  {
233*3d8817e4Smiod    ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__fini_array_start = .);}}
234*3d8817e4Smiod    KEEP (*(.fini_array))
235*3d8817e4Smiod    KEEP (*(SORT(.fini_array.*)))
236*3d8817e4Smiod    ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__fini_array_end = .);}}
237*3d8817e4Smiod  }
238*3d8817e4Smiod
239*3d8817e4Smiod  ${OTHER_READONLY_SECTIONS}
240*3d8817e4Smiod  .eh_frame_hdr : { *(.eh_frame_hdr) }
241*3d8817e4Smiod  .eh_frame     ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame)) }
242*3d8817e4Smiod  .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }
243*3d8817e4Smiod
244*3d8817e4Smiod  /* Adjust the address for the data segment.  We want to adjust up to
245*3d8817e4Smiod     the same address within the page on the next page up.  */
246*3d8817e4Smiod  ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${DATA_ADDR};}}}
247*3d8817e4Smiod  ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_DATA_ADDR};}}
248*3d8817e4Smiod  ${CREATE_PIE+${RELOCATING+. = ${SHLIB_DATA_ADDR};}}
249*3d8817e4Smiod
250*3d8817e4Smiod  /* Exception handling  */
251*3d8817e4Smiod  .eh_frame     ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame)) }
252*3d8817e4Smiod  .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }
253*3d8817e4Smiod
254*3d8817e4Smiod  /* Thread Local Storage sections  */
255*3d8817e4Smiod  .tdata	${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) }
256*3d8817e4Smiod  .tbss		${RELOCATING-0} : { *(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} }
257*3d8817e4Smiod
258*3d8817e4Smiod  ${RELOCATING+${CTOR}}
259*3d8817e4Smiod  ${RELOCATING+${DTOR}}
260*3d8817e4Smiod  .jcr          ${RELOCATING-0} : { KEEP (*(.jcr)) }
261*3d8817e4Smiod
262*3d8817e4Smiod  ${RELOCATING+${DATARELRO}}
263*3d8817e4Smiod  ${OTHER_RELRO_SECTIONS}
264*3d8817e4Smiod  ${RELOCATING+${DATA_SEGMENT_RELRO_END}}
265*3d8817e4Smiod
266*3d8817e4Smiod  ${DATA_PLT+${PLT_BEFORE_GOT-${PLT}}}
267*3d8817e4Smiod
268*3d8817e4Smiod  .data         ${RELOCATING-0} :
269*3d8817e4Smiod  {
270*3d8817e4Smiod    ${RELOCATING+${DATA_START_SYMBOLS}}
271*3d8817e4Smiod    *(.data${RELOCATING+ .data.* .gnu.linkonce.d.*})
272*3d8817e4Smiod    KEEP (*(.gnu.linkonce.d.*personality*))
273*3d8817e4Smiod    ${CONSTRUCTING+SORT(CONSTRUCTORS)}
274*3d8817e4Smiod  }
275*3d8817e4Smiod  .data1        ${RELOCATING-0} : { *(.data1) }
276*3d8817e4Smiod  ${WRITABLE_RODATA+${RODATA}}
277*3d8817e4Smiod  ${OTHER_READWRITE_SECTIONS}
278*3d8817e4Smiod  ${DATA_PLT+${PLT_BEFORE_GOT+${PLT}}}
279*3d8817e4Smiod  ${CREATE_SHLIB+${SDATA2}}
280*3d8817e4Smiod  ${CREATE_SHLIB+${SBSS2}}
281*3d8817e4Smiod  ${SDATA}
282*3d8817e4Smiod  ${OTHER_SDATA_SECTIONS}
283*3d8817e4Smiod  ${RELOCATING+_edata = .;}
284*3d8817e4Smiod  ${RELOCATING+PROVIDE (edata = .);}
285*3d8817e4Smiod  ${RELOCATING+. = DEFINED(__bss_segment_start) ? __bss_segment_start : .;}
286*3d8817e4Smiod  ${RELOCATING+__bss_start = .;}
287*3d8817e4Smiod  ${RELOCATING+${OTHER_BSS_SYMBOLS}}
288*3d8817e4Smiod  ${SBSS}
289*3d8817e4Smiod  ${BSS_PLT+${PLT}}
290*3d8817e4Smiod  .bss          ${RELOCATING-0} :
291*3d8817e4Smiod  {
292*3d8817e4Smiod   *(.dynbss)
293*3d8817e4Smiod   *(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*})
294*3d8817e4Smiod   *(COMMON)
295*3d8817e4Smiod   /* Align here to ensure that the .bss section occupies space up to
296*3d8817e4Smiod      _end.  Align after .bss to ensure correct alignment even if the
297*3d8817e4Smiod      .bss section disappears because there are no input sections.  */
298*3d8817e4Smiod   ${RELOCATING+. = ALIGN(${ALIGNMENT});}
299*3d8817e4Smiod  }
300*3d8817e4Smiod  ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
301*3d8817e4Smiod  ${RELOCATING+. = ALIGN(${ALIGNMENT});}
302*3d8817e4Smiod  ${RELOCATING+${OTHER_END_SYMBOLS}}
303*3d8817e4Smiod  ${RELOCATING+_end = .;}
304*3d8817e4Smiod  ${RELOCATING+PROVIDE (end = .);}
305*3d8817e4Smiod  ${RELOCATING+${DATA_SEGMENT_END}}
306*3d8817e4Smiod
307*3d8817e4Smiod  /* These sections are not mapped under the BPABI.  */
308*3d8817e4Smiod  .dynamic      0 : { *(.dynamic) }
309*3d8817e4Smiod  .hash         0 : { *(.hash) }
310*3d8817e4Smiod  .dynsym       0 : { *(.dynsym) }
311*3d8817e4Smiod  .dynstr       0 : { *(.dynstr) }
312*3d8817e4Smiod  .gnu.version  0 : { *(.gnu.version) }
313*3d8817e4Smiod  .gnu.version_d 0: { *(.gnu.version_d) }
314*3d8817e4Smiod  .gnu.version_r 0: { *(.gnu.version_r) }
315*3d8817e4Smiod  ${CREATE_SHLIB-${INTERP}}
316*3d8817e4Smiod
317*3d8817e4Smiod  /* Stabs debugging sections.  */
318*3d8817e4Smiod  .stab          0 : { *(.stab) }
319*3d8817e4Smiod  .stabstr       0 : { *(.stabstr) }
320*3d8817e4Smiod  .stab.excl     0 : { *(.stab.excl) }
321*3d8817e4Smiod  .stab.exclstr  0 : { *(.stab.exclstr) }
322*3d8817e4Smiod  .stab.index    0 : { *(.stab.index) }
323*3d8817e4Smiod  .stab.indexstr 0 : { *(.stab.indexstr) }
324*3d8817e4Smiod
325*3d8817e4Smiod  .comment       0 : { *(.comment) }
326*3d8817e4Smiod
327*3d8817e4Smiod  /* DWARF debug sections.
328*3d8817e4Smiod     Symbols in the DWARF debugging sections are relative to the beginning
329*3d8817e4Smiod     of the section so we begin them at 0.  */
330*3d8817e4Smiod
331*3d8817e4Smiod  /* DWARF 1 */
332*3d8817e4Smiod  .debug          0 : { *(.debug) }
333*3d8817e4Smiod  .line           0 : { *(.line) }
334*3d8817e4Smiod
335*3d8817e4Smiod  /* GNU DWARF 1 extensions */
336*3d8817e4Smiod  .debug_srcinfo  0 : { *(.debug_srcinfo) }
337*3d8817e4Smiod  .debug_sfnames  0 : { *(.debug_sfnames) }
338*3d8817e4Smiod
339*3d8817e4Smiod  /* DWARF 1.1 and DWARF 2 */
340*3d8817e4Smiod  .debug_aranges  0 : { *(.debug_aranges) }
341*3d8817e4Smiod  .debug_pubnames 0 : { *(.debug_pubnames) }
342*3d8817e4Smiod
343*3d8817e4Smiod  /* DWARF 2 */
344*3d8817e4Smiod  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
345*3d8817e4Smiod  .debug_abbrev   0 : { *(.debug_abbrev) }
346*3d8817e4Smiod  .debug_line     0 : { *(.debug_line) }
347*3d8817e4Smiod  .debug_frame    0 : { *(.debug_frame) }
348*3d8817e4Smiod  .debug_str      0 : { *(.debug_str) }
349*3d8817e4Smiod  .debug_loc      0 : { *(.debug_loc) }
350*3d8817e4Smiod  .debug_macinfo  0 : { *(.debug_macinfo) }
351*3d8817e4Smiod
352*3d8817e4Smiod  /* SGI/MIPS DWARF 2 extensions */
353*3d8817e4Smiod  .debug_weaknames 0 : { *(.debug_weaknames) }
354*3d8817e4Smiod  .debug_funcnames 0 : { *(.debug_funcnames) }
355*3d8817e4Smiod  .debug_typenames 0 : { *(.debug_typenames) }
356*3d8817e4Smiod  .debug_varnames  0 : { *(.debug_varnames) }
357*3d8817e4Smiod
358*3d8817e4Smiod  ${STACK_ADDR+${STACK}}
359*3d8817e4Smiod  ${OTHER_SECTIONS}
360*3d8817e4Smiod  ${RELOCATING+${OTHER_SYMBOLS}}
361*3d8817e4Smiod  ${RELOCATING+${STACKNOTE}}
362*3d8817e4SmiodEOF
363*3d8817e4Smiod
364*3d8817e4Smiod# These relocations sections are part of the read-only segment in SVR4
365*3d8817e4Smiod# executables, but are not mapped in BPABI executables.
366*3d8817e4Smiodif [ "x$COMBRELOC" = x ]; then
367*3d8817e4Smiod  COMBRELOCCAT=cat
368*3d8817e4Smiodelse
369*3d8817e4Smiod  COMBRELOCCAT="cat > $COMBRELOC"
370*3d8817e4Smiodfi
371*3d8817e4Smiodeval $COMBRELOCCAT <<EOF
372*3d8817e4Smiod  .rel.init     0 : { *(.rel.init) }
373*3d8817e4Smiod  .rela.init    0 : { *(.rela.init) }
374*3d8817e4Smiod  .rel.text     0 : { *(.rel.text${RELOCATING+ .rel.text.* .rel.gnu.linkonce.t.*}) }
375*3d8817e4Smiod  .rela.text    0 : { *(.rela.text${RELOCATING+ .rela.text.* .rela.gnu.linkonce.t.*}) }
376*3d8817e4Smiod  .rel.fini     0 : { *(.rel.fini) }
377*3d8817e4Smiod  .rela.fini    0 : { *(.rela.fini) }
378*3d8817e4Smiod  .rel.rodata   0 : { *(.rel.rodata${RELOCATING+ .rel.rodata.* .rel.gnu.linkonce.r.*}) }
379*3d8817e4Smiod  .rela.rodata  0 : { *(.rela.rodata${RELOCATING+ .rela.rodata.* .rela.gnu.linkonce.r.*}) }
380*3d8817e4Smiod  ${OTHER_READONLY_RELOC_SECTIONS}
381*3d8817e4Smiod  .rel.data.rel.ro 0 : { *(.rel.data.rel.ro${RELOCATING+*}) }
382*3d8817e4Smiod  .rela.data.rel.ro 0 : { *(.rel.data.rel.ro${RELOCATING+*}) }
383*3d8817e4Smiod  .rel.data     0 : { *(.rel.data${RELOCATING+ .rel.data.* .rel.gnu.linkonce.d.*}) }
384*3d8817e4Smiod  .rela.data    0 : { *(.rela.data${RELOCATING+ .rela.data.* .rela.gnu.linkonce.d.*}) }
385*3d8817e4Smiod  .rel.tdata	0 : { *(.rel.tdata${RELOCATING+ .rel.tdata.* .rel.gnu.linkonce.td.*}) }
386*3d8817e4Smiod  .rela.tdata	0 : { *(.rela.tdata${RELOCATING+ .rela.tdata.* .rela.gnu.linkonce.td.*}) }
387*3d8817e4Smiod  .rel.tbss	0 : { *(.rel.tbss${RELOCATING+ .rel.tbss.* .rel.gnu.linkonce.tb.*}) }
388*3d8817e4Smiod  .rela.tbss	0 : { *(.rela.tbss${RELOCATING+ .rela.tbss.* .rela.gnu.linkonce.tb.*}) }
389*3d8817e4Smiod  .rel.ctors    0 : { *(.rel.ctors) }
390*3d8817e4Smiod  .rela.ctors   0 : { *(.rela.ctors) }
391*3d8817e4Smiod  .rel.dtors    0 : { *(.rel.dtors) }
392*3d8817e4Smiod  .rela.dtors   0 : { *(.rela.dtors) }
393*3d8817e4Smiod  ${REL_SDATA}
394*3d8817e4Smiod  ${REL_SBSS}
395*3d8817e4Smiod  ${REL_SDATA2}
396*3d8817e4Smiod  ${REL_SBSS2}
397*3d8817e4Smiod  .rel.bss      0 : { *(.rel.bss${RELOCATING+ .rel.bss.* .rel.gnu.linkonce.b.*}) }
398*3d8817e4Smiod  .rela.bss     0 : { *(.rela.bss${RELOCATING+ .rela.bss.* .rela.gnu.linkonce.b.*}) }
399*3d8817e4Smiod  .rel.init_array  0 : { *(.rel.init_array) }
400*3d8817e4Smiod  .rela.init_array 0 : { *(.rela.init_array) }
401*3d8817e4Smiod  .rel.fini_array  0 : { *(.rel.fini_array) }
402*3d8817e4Smiod  .rela.fini_array 0 : { *(.rela.fini_array) }
403*3d8817e4SmiodEOF
404*3d8817e4Smiodif [ -n "$COMBRELOC" ]; then
405*3d8817e4Smiodcat <<EOF
406*3d8817e4Smiod  .rel.dyn      0 :
407*3d8817e4Smiod    {
408*3d8817e4SmiodEOF
409*3d8817e4Smiodsed -e '/^[ 	]*[{}][ 	]*$/d;/:[ 	]*$/d;/\.rela\./d;s/^.*: { *\(.*\)}$/      \1/' $COMBRELOC
410*3d8817e4Smiodcat <<EOF
411*3d8817e4Smiod    }
412*3d8817e4Smiod  .rela.dyn     0 :
413*3d8817e4Smiod    {
414*3d8817e4SmiodEOF
415*3d8817e4Smiodsed -e '/^[ 	]*[{}][ 	]*$/d;/:[ 	]*$/d;/\.rel\./d;s/^.*: { *\(.*\)}/      \1/' $COMBRELOC
416*3d8817e4Smiodcat <<EOF
417*3d8817e4Smiod    }
418*3d8817e4SmiodEOF
419*3d8817e4Smiodfi
420*3d8817e4Smiodcat <<EOF
421*3d8817e4Smiod  .rel.plt      0 : { *(.rel.plt) }
422*3d8817e4Smiod  .rela.plt     0 : { *(.rela.plt) }
423*3d8817e4Smiod  ${OTHER_PLT_RELOC_SECTIONS}
424*3d8817e4Smiod  .rel.other    0 : { *(.rel.*) }
425*3d8817e4Smiod  .rela.other   0 : { *(.rela.*) }
426*3d8817e4Smiod  .reli.other   0 : { *(.reli.*) }
427*3d8817e4Smiod}
428*3d8817e4SmiodEOF
429