aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2010-03-23 16:02:02 +0000
committerJoseph Myers <joseph@codesourcery.com>2010-03-23 16:02:02 +0000
commit349e935badff8a1d3d4932e4f90935e7fb3aa721 (patch)
treed7e061fed05f226bd15357e72b20e0161e2bbc51
parent103acc3caf47443f136a90cfc6306302087c33da (diff)
downloadgdb-349e935badff8a1d3d4932e4f90935e7fb3aa721.zip
gdb-349e935badff8a1d3d4932e4f90935e7fb3aa721.tar.gz
gdb-349e935badff8a1d3d4932e4f90935e7fb3aa721.tar.bz2
* scripttempl/elf.sc (RODATA_NAME, SDATA_NAME, SBSS_NAME,
BSS_NAME): Define if not already defined. Use in place of some hardcoded section names.
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/scripttempl/elf.sc61
2 files changed, 40 insertions, 27 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 2849c5a..bf0c9bf 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2010-03-23 Joseph Myers <joseph@codesourcery.com>
+
+ * scripttempl/elf.sc (RODATA_NAME, SDATA_NAME, SBSS_NAME,
+ BSS_NAME): Define if not already defined. Use in place of some
+ hardcoded section names.
+
2010-03-18 H.J. Lu <hongjiu.lu@intel.com>
* scripttempl/elf.sc (INIT_ARRAY): Re-indent.
diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
index 56deb2e..62120fc 100644
--- a/ld/scripttempl/elf.sc
+++ b/ld/scripttempl/elf.sc
@@ -58,6 +58,8 @@
# the number of bytes in the beginning of .got.plt which can be
# in the RELRO area as well.
# USER_LABEL_PREFIX - prefix to add to user-visible symbols.
+# RODATA_NAME, SDATA_NAME, SBSS_NAME, BSS_NAME - base parts of names
+# for standard sections, without initial "." or suffixes.
#
# When adding sections, do note that the names of some sections are used
# when specifying the start address of the next.
@@ -89,6 +91,10 @@
#
# Each of these can also have corresponding .rel.* and .rela.* sections.
+test -z "$RODATA_NAME" && RODATA_NAME=rodata
+test -z "$SDATA_NAME" && SDATA_NAME=sdata
+test -z "$SBSS_NAME" && SBSS_NAME=sbss
+test -z "$BSS_NAME" && BSS_NAME=bss
test -z "$ENTRY" && ENTRY=${USER_LABEL_PREFIX}_start
test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
@@ -141,42 +147,42 @@ RELA_IPLT=".rela.iplt ${RELOCATING-0} :
${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_end = .);}}
}"
DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
-RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
+RODATA=".${RODATA_NAME} ${RELOCATING-0} : { *(.${RODATA_NAME}${RELOCATING+ .${RODATA_NAME}.* .gnu.linkonce.r.*}) }"
DATARELRO=".data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }"
DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }"
if test -z "${NO_SMALL_DATA}"; then
- SBSS=".sbss ${RELOCATING-0} :
+ SBSS=".${SBSS_NAME} ${RELOCATING-0} :
{
${RELOCATING+${SBSS_START_SYMBOLS}}
- ${CREATE_SHLIB+*(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)}
- *(.dynsbss)
- *(.sbss${RELOCATING+ .sbss.* .gnu.linkonce.sb.*})
+ ${CREATE_SHLIB+*(.${SBSS_NAME}2 .${SBSS_NAME}2.* .gnu.linkonce.sb2.*)}
+ *(.dyn${SBSS_NAME})
+ *(.${SBSS_NAME}${RELOCATING+ .${SBSS_NAME}.* .gnu.linkonce.sb.*})
*(.scommon)
${RELOCATING+${SBSS_END_SYMBOLS}}
}"
- SBSS2=".sbss2 ${RELOCATING-0} : { *(.sbss2${RELOCATING+ .sbss2.* .gnu.linkonce.sb2.*}) }"
+ SBSS2=".${SBSS_NAME}2 ${RELOCATING-0} : { *(.${SBSS_NAME}2${RELOCATING+ .${SBSS_NAME}2.* .gnu.linkonce.sb2.*}) }"
SDATA="/* We want the small data sections together, so single-instruction offsets
can access them all, and initialized data all before uninitialized, so
we can shorten the on-disk segment size. */
- .sdata ${RELOCATING-0} :
+ .${SDATA_NAME} ${RELOCATING-0} :
{
${RELOCATING+${SDATA_START_SYMBOLS}}
- ${CREATE_SHLIB+*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)}
- *(.sdata${RELOCATING+ .sdata.* .gnu.linkonce.s.*})
+ ${CREATE_SHLIB+*(.${SDATA_NAME}2 .${SDATA_NAME}2.* .gnu.linkonce.s2.*)}
+ *(.${SDATA_NAME}${RELOCATING+ .${SDATA_NAME}.* .gnu.linkonce.s.*})
}"
- SDATA2=".sdata2 ${RELOCATING-0} :
+ SDATA2=".${SDATA_NAME}2 ${RELOCATING-0} :
{
${RELOCATING+${SDATA2_START_SYMBOLS}}
- *(.sdata2${RELOCATING+ .sdata2.* .gnu.linkonce.s2.*})
+ *(.${SDATA_NAME}2${RELOCATING+ .${SDATA_NAME}2.* .gnu.linkonce.s2.*})
}"
- REL_SDATA=".rel.sdata ${RELOCATING-0} : { *(.rel.sdata${RELOCATING+ .rel.sdata.* .rel.gnu.linkonce.s.*}) }
- .rela.sdata ${RELOCATING-0} : { *(.rela.sdata${RELOCATING+ .rela.sdata.* .rela.gnu.linkonce.s.*}) }"
- REL_SBSS=".rel.sbss ${RELOCATING-0} : { *(.rel.sbss${RELOCATING+ .rel.sbss.* .rel.gnu.linkonce.sb.*}) }
- .rela.sbss ${RELOCATING-0} : { *(.rela.sbss${RELOCATING+ .rela.sbss.* .rela.gnu.linkonce.sb.*}) }"
- REL_SDATA2=".rel.sdata2 ${RELOCATING-0} : { *(.rel.sdata2${RELOCATING+ .rel.sdata2.* .rel.gnu.linkonce.s2.*}) }
- .rela.sdata2 ${RELOCATING-0} : { *(.rela.sdata2${RELOCATING+ .rela.sdata2.* .rela.gnu.linkonce.s2.*}) }"
- REL_SBSS2=".rel.sbss2 ${RELOCATING-0} : { *(.rel.sbss2${RELOCATING+ .rel.sbss2.* .rel.gnu.linkonce.sb2.*}) }
- .rela.sbss2 ${RELOCATING-0} : { *(.rela.sbss2${RELOCATING+ .rela.sbss2.* .rela.gnu.linkonce.sb2.*}) }"
+ REL_SDATA=".rel.${SDATA_NAME} ${RELOCATING-0} : { *(.rel.${SDATA_NAME}${RELOCATING+ .rel.${SDATA_NAME}.* .rel.gnu.linkonce.s.*}) }
+ .rela.${SDATA_NAME} ${RELOCATING-0} : { *(.rela.${SDATA_NAME}${RELOCATING+ .rela.${SDATA_NAME}.* .rela.gnu.linkonce.s.*}) }"
+ REL_SBSS=".rel.${SBSS_NAME} ${RELOCATING-0} : { *(.rel.${SBSS_NAME}${RELOCATING+ .rel.${SBSS_NAME}.* .rel.gnu.linkonce.sb.*}) }
+ .rela.${SBSS_NAME} ${RELOCATING-0} : { *(.rela.${SBSS_NAME}${RELOCATING+ .rela.${SBSS_NAME}.* .rela.gnu.linkonce.sb.*}) }"
+ REL_SDATA2=".rel.${SDATA_NAME}2 ${RELOCATING-0} : { *(.rel.${SDATA_NAME}2${RELOCATING+ .rel.${SDATA_NAME}2.* .rel.gnu.linkonce.s2.*}) }
+ .rela.${SDATA_NAME}2 ${RELOCATING-0} : { *(.rela.${SDATA_NAME}2${RELOCATING+ .rela.${SDATA_NAME}2.* .rela.gnu.linkonce.s2.*}) }"
+ REL_SBSS2=".rel.${SBSS_NAME}2 ${RELOCATING-0} : { *(.rel.${SBSS_NAME}2${RELOCATING+ .rel.${SBSS_NAME}2.* .rel.gnu.linkonce.sb2.*}) }
+ .rela.${SBSS_NAME}2 ${RELOCATING-0} : { *(.rela.${SBSS_NAME}2${RELOCATING+ .rela.${SBSS_NAME}2.* .rela.gnu.linkonce.sb2.*}) }"
else
NO_SMALL_DATA=" "
fi
@@ -332,13 +338,14 @@ eval $COMBRELOCCAT <<EOF
.rela.text ${RELOCATING-0} : { *(.rela.text${RELOCATING+ .rela.text.* .rela.gnu.linkonce.t.*}) }
.rel.fini ${RELOCATING-0} : { *(.rel.fini) }
.rela.fini ${RELOCATING-0} : { *(.rela.fini) }
- .rel.rodata ${RELOCATING-0} : { *(.rel.rodata${RELOCATING+ .rel.rodata.* .rel.gnu.linkonce.r.*}) }
- .rela.rodata ${RELOCATING-0} : { *(.rela.rodata${RELOCATING+ .rela.rodata.* .rela.gnu.linkonce.r.*}) }
+ .rel.${RODATA_NAME} ${RELOCATING-0} : { *(.rel.${RODATA_NAME}${RELOCATING+ .rel.${RODATA_NAME}.* .rel.gnu.linkonce.r.*}) }
+ .rela.${RODATA_NAME} ${RELOCATING-0} : { *(.rela.${RODATA_NAME}${RELOCATING+ .rela.${RODATA_NAME}.* .rela.gnu.linkonce.r.*}) }
${OTHER_READONLY_RELOC_SECTIONS}
.rel.data.rel.ro ${RELOCATING-0} : { *(.rel.data.rel.ro${RELOCATING+* .rel.gnu.linkonce.d.rel.ro.*}) }
.rela.data.rel.ro ${RELOCATING-0} : { *(.rela.data.rel.ro${RELOCATING+* .rela.gnu.linkonce.d.rel.ro.*}) }
.rel.data ${RELOCATING-0} : { *(.rel.data${RELOCATING+ .rel.data.* .rel.gnu.linkonce.d.*}) }
.rela.data ${RELOCATING-0} : { *(.rela.data${RELOCATING+ .rela.data.* .rela.gnu.linkonce.d.*}) }
+ ${OTHER_READWRITE_RELOC_SECTIONS}
.rel.tdata ${RELOCATING-0} : { *(.rel.tdata${RELOCATING+ .rel.tdata.* .rel.gnu.linkonce.td.*}) }
.rela.tdata ${RELOCATING-0} : { *(.rela.tdata${RELOCATING+ .rela.tdata.* .rela.gnu.linkonce.td.*}) }
.rel.tbss ${RELOCATING-0} : { *(.rel.tbss${RELOCATING+ .rel.tbss.* .rel.gnu.linkonce.tb.*}) }
@@ -354,8 +361,8 @@ eval $COMBRELOCCAT <<EOF
${REL_SBSS}
${REL_SDATA2}
${REL_SBSS2}
- .rel.bss ${RELOCATING-0} : { *(.rel.bss${RELOCATING+ .rel.bss.* .rel.gnu.linkonce.b.*}) }
- .rela.bss ${RELOCATING-0} : { *(.rela.bss${RELOCATING+ .rela.bss.* .rela.gnu.linkonce.b.*}) }
+ .rel.${BSS_NAME} ${RELOCATING-0} : { *(.rel.${BSS_NAME}${RELOCATING+ .rel.${BSS_NAME}.* .rel.gnu.linkonce.b.*}) }
+ .rela.${BSS_NAME} ${RELOCATING-0} : { *(.rela.${BSS_NAME}${RELOCATING+ .rela.${BSS_NAME}.* .rela.gnu.linkonce.b.*}) }
${REL_LARGE}
${IREL_IN_PLT+$REL_IFUNC}
${IREL_IN_PLT+$RELA_IFUNC}
@@ -441,7 +448,7 @@ cat <<EOF
${RELOCATING+PROVIDE (_${ETEXT_NAME} = .);}
${RELOCATING+PROVIDE (${ETEXT_NAME} = .);}
${WRITABLE_RODATA-${RODATA}}
- .rodata1 ${RELOCATING-0} : { *(.rodata1) }
+ .${RODATA_NAME}1 ${RELOCATING-0} : { *(.${RODATA_NAME}1) }
${CREATE_SHLIB-${SDATA2}}
${CREATE_SHLIB-${SBSS2}}
${OTHER_READONLY_SECTIONS}
@@ -509,10 +516,10 @@ cat <<EOF
${RELOCATING+${OTHER_BSS_SYMBOLS}}
${SBSS}
${BSS_PLT+${PLT}}
- .bss ${RELOCATING-0} :
+ .${BSS_NAME} ${RELOCATING-0} :
{
- *(.dynbss)
- *(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*})
+ *(.dyn${BSS_NAME})
+ *(.${BSS_NAME}${RELOCATING+ .${BSS_NAME}.* .gnu.linkonce.b.*})
*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the