This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
PATCH: Refine SymbianOS section symbols
- From: Mark Mitchell <mark at codesourcery dot com>
- To: binutils at sources dot redhat dot com
- Date: Tue, 8 Feb 2005 16:01:14 -0800
- Subject: PATCH: Refine SymbianOS section symbols
- Reply-to: mark at codesourcery dot com
It turns out that the special SymbianOS section symbols need defining
in shared objects, as well as in final executables. It also turns out
that they need to be hidden; each shared object may define its own
copy of these symbols. Fixed with appropriate modifications to the
linker script.
OK to apply? And, would it be possible for Paul and/or myself to have
approval rights for these purely SymbianOS-specific files?
Thanks,
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
2005-02-08 Mark Mitchell <mark@codesourcery.com>
* scripttempl/armbpabi.sc (VERSION): Make special section symbols
local.
(Image$$ER_RO$$Base): Define whenever RELOCATING.
(Image$$ER_RO$$Limit): Likewise.
(SHT$$INIT_ARRAY$$Base): Likewise.
(SHT$$INIT_ARRAY$$Limit): Likeise.
Index: ld/scripttempl/armbpabi.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/armbpabi.sc,v
retrieving revision 1.4
diff -c -5 -p -r1.4 armbpabi.sc
*** ld/scripttempl/armbpabi.sc 26 Jan 2005 06:10:45 -0000 1.4
--- ld/scripttempl/armbpabi.sc 8 Feb 2005 23:22:37 -0000
*************** ${RELOCATING+${INPUT_FILES}}
*** 132,150 ****
${RELOCATING- /* For some reason, the Solaris linker makes bad executables
if gld -r is used and the intermediate file has sections starting
at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld
bug. But for now assigning the zero vmas works. */}
SECTIONS
{
/* Read-only sections, merged into text segment: */
${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+PROVIDE (__executable_start = ${TEXT_START_ADDR});}}}
! /* SymbianOS uses this symbol. */
! ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+PROVIDE (Image\$\$ER_RO\$\$Base = ${TEXT_START_ADDR});}}}
${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+ . = ${TEXT_BASE_ADDRESS};}}}
${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_BASE_ADDRESS};}}
${CREATE_PIE+${RELOCATING+. = ${SHLIB_BASE_ADDRESS};}}
${INITIAL_READONLY_SECTIONS}
EOF
cat <<EOF
.init ${RELOCATING-0} :
--- 132,172 ----
${RELOCATING- /* For some reason, the Solaris linker makes bad executables
if gld -r is used and the intermediate file has sections starting
at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld
bug. But for now assigning the zero vmas works. */}
+ /* ARM's proprietary toolchain generate these symbols to match the start
+ and end of particular sections of the image. SymbianOS uses these
+ symbols. We provide them for compatibility with ARM's toolchains.
+ These symbols should be bound locally; each shared object may define
+ its own version of these symbols. */
+
+ VERSION
+ {
+ {
+ local:
+ Image\$\$ER_RO\$\$Base;
+ Image\$\$ER_RO\$\$Limit;
+ SHT\$\$INIT_ARRAY\$\$Base;
+ SHT\$\$INIT_ARRAY\$\$Limit;
+ .ARM.exidx\$\$Base;
+ .ARM.exidx\$\$Limit;
+ };
+ }
+
SECTIONS
{
/* Read-only sections, merged into text segment: */
${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+PROVIDE (__executable_start = ${TEXT_START_ADDR});}}}
!
${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+ . = ${TEXT_BASE_ADDRESS};}}}
${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_BASE_ADDRESS};}}
${CREATE_PIE+${RELOCATING+. = ${SHLIB_BASE_ADDRESS};}}
+
+ /* Define Image\$\$ER_RO\$\$Base. */
+ ${RELOCATING+PROVIDE (Image\$\$ER_RO\$\$Base = .);}
+
${INITIAL_READONLY_SECTIONS}
EOF
cat <<EOF
.init ${RELOCATING-0} :
*************** cat <<EOF
*** 172,183 ****
text section. */
${DATA_PLT-${BSS_PLT-${PLT}}}
${RELOCATING+PROVIDE (__etext = .);}
${RELOCATING+PROVIDE (_etext = .);}
${RELOCATING+PROVIDE (etext = .);}
! /* SymbianOS uses this symbol. */
${RELOCATING+PROVIDE (Image\$\$ER_RO\$\$Limit = .);}
${WRITABLE_RODATA-${RODATA}}
.rodata1 ${RELOCATING-0} : { *(.rodata1) }
${CREATE_SHLIB-${SDATA2}}
${CREATE_SHLIB-${SBSS2}}
--- 194,207 ----
text section. */
${DATA_PLT-${BSS_PLT-${PLT}}}
${RELOCATING+PROVIDE (__etext = .);}
${RELOCATING+PROVIDE (_etext = .);}
${RELOCATING+PROVIDE (etext = .);}
!
! /* Define Image\$\$ER_RO\$\$Limit. */
${RELOCATING+PROVIDE (Image\$\$ER_RO\$\$Limit = .);}
+
${WRITABLE_RODATA-${RODATA}}
.rodata1 ${RELOCATING-0} : { *(.rodata1) }
${CREATE_SHLIB-${SDATA2}}
${CREATE_SHLIB-${SBSS2}}
*************** cat <<EOF
*** 194,207 ****
.preinit_array ${RELOCATING-0} : { *(.preinit_array) }
${RELOCATING+${CREATE_SHLIB-PROVIDE (__preinit_array_end = .);}}
${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_start = .);}}
/* SymbianOS uses this symbol. */
! ${RELOCATING+${CREATE_SHLIB-PROVIDE (SHT\$\$INIT_ARRAY\$\$Base = .);}}
.init_array ${RELOCATING-0} : { *(.init_array) }
/* SymbianOS uses this symbol. */
! ${RELOCATING+${CREATE_SHLIB-PROVIDE (SHT\$\$INIT_ARRAY\$\$Limit = .);}}
${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_end = .);}}
${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_start = .);}}
.fini_array ${RELOCATING-0} : { *(.fini_array) }
${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_end = .);}}
--- 218,231 ----
.preinit_array ${RELOCATING-0} : { *(.preinit_array) }
${RELOCATING+${CREATE_SHLIB-PROVIDE (__preinit_array_end = .);}}
${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_start = .);}}
/* SymbianOS uses this symbol. */
! ${RELOCATING+PROVIDE (SHT\$\$INIT_ARRAY\$\$Base = .);}
.init_array ${RELOCATING-0} : { *(.init_array) }
/* SymbianOS uses this symbol. */
! ${RELOCATING+PROVIDE (SHT\$\$INIT_ARRAY\$\$Limit = .);}
${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_end = .);}}
${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_start = .);}}
.fini_array ${RELOCATING-0} : { *(.fini_array) }
${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_end = .);}}