From 349e935badff8a1d3d4932e4f90935e7fb3aa721 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 23 Mar 2010 16:02:02 +0000 Subject: [PATCH] * scripttempl/elf.sc (RODATA_NAME, SDATA_NAME, SBSS_NAME, BSS_NAME): Define if not already defined. Use in place of some hardcoded section names. --- ld/ChangeLog | 6 +++++ ld/scripttempl/elf.sc | 61 ++++++++++++++++++++++++------------------- 2 files changed, 40 insertions(+), 27 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 2849c5a456..bf0c9bf95a 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2010-03-23 Joseph Myers + + * 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 * scripttempl/elf.sc (INIT_ARRAY): Re-indent. diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc index 56deb2e2ea..62120fc63e 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 <