diff --git a/ld/ChangeLog b/ld/ChangeLog index 6a61d61fee..90a6d33b89 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,11 @@ +2017-01-02 Alan Modra + + PR ld/21000 + * emulparams/hppalinux.sh (DATA_ADDR, SHLIB_DATA_ADDR): Don't define. + (DATA_SEGMENT_ALIGN, DATA_SEGMENT_END, DATA_SEGMENT_RELRO_END): Define. + * scripttempl/elf.sc: Don't define the above if DATA_SEGMENT_ALIGN + is already defined. + 2017-01-02 Alan Modra Update year range in copyright notice of all files. diff --git a/ld/emulparams/hppalinux.sh b/ld/emulparams/hppalinux.sh index d7d87e2d3a..deb07c23dd 100644 --- a/ld/emulparams/hppalinux.sh +++ b/ld/emulparams/hppalinux.sh @@ -8,8 +8,17 @@ NO_REL_RELOCS=yes TEXT_START_ADDR=0x10000 TARGET_PAGE_SIZE=0x10000 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" -DATA_ADDR="ALIGN(${MAXPAGESIZE})" -SHLIB_DATA_ADDR="ALIGN(${MAXPAGESIZE})" +COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)" +if test "$LD_FLAG" = "N"; then + unset DATA_SEGMENT_ALIGN + unset DATA_SEGMENT_END + unset DATA_SEGMENT_RELRO_END +else + DATA_SEGMENT_ALIGN="ALIGN(${MAXPAGESIZE});\ + . = DATA_SEGMENT_ALIGN (${MAXPAGESIZE}, ${COMMONPAGESIZE})" + DATA_SEGMENT_END=". = DATA_SEGMENT_END (.);" + DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT-0}, .);" +fi ARCH=hppa MACHINE=hppa1.1 # We use 1.1 specific features. NOP=0x08000240 diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc index aa460505d5..e65f9a3ccf 100644 --- a/ld/scripttempl/elf.sc +++ b/ld/scripttempl/elf.sc @@ -120,21 +120,23 @@ test -z "${ELFSIZE}" && ELFSIZE=32 test -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8" test "$LD_FLAG" = "N" && DATA_ADDR=. test -z "${ETEXT_NAME}" && ETEXT_NAME=${USER_LABEL_PREFIX}etext -test -n "$CREATE_SHLIB$CREATE_PIE" && test -n "$SHLIB_DATA_ADDR" && COMMONPAGESIZE="" -test -z "$CREATE_SHLIB$CREATE_PIE" && test -n "$DATA_ADDR" && COMMONPAGESIZE="" test -n "$RELRO_NOW" && unset SEPARATE_GOTPLT test -z "$ATTRS_SECTIONS" && ATTRS_SECTIONS=".gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }" -DATA_SEGMENT_ALIGN="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))" -DATA_SEGMENT_RELRO_END="" -DATA_SEGMENT_END="" -if test -n "${COMMONPAGESIZE}"; then - if test "${SEGMENT_SIZE}" != "${MAXPAGESIZE}"; then - DATA_SEGMENT_ALIGN="ALIGN (${SEGMENT_SIZE}) - ((${MAXPAGESIZE} - .) & (${MAXPAGESIZE} - 1)); . = DATA_SEGMENT_ALIGN (${MAXPAGESIZE}, ${COMMONPAGESIZE})" - else - DATA_SEGMENT_ALIGN="DATA_SEGMENT_ALIGN (${MAXPAGESIZE}, ${COMMONPAGESIZE})" +if test -z "$DATA_SEGMENT_ALIGN"; then + test -n "$CREATE_SHLIB$CREATE_PIE" && test -n "$SHLIB_DATA_ADDR" && COMMONPAGESIZE="" + test -z "$CREATE_SHLIB$CREATE_PIE" && test -n "$DATA_ADDR" && COMMONPAGESIZE="" + DATA_SEGMENT_ALIGN="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))" + DATA_SEGMENT_RELRO_END="" + DATA_SEGMENT_END="" + if test -n "${COMMONPAGESIZE}"; then + if test "${SEGMENT_SIZE}" != "${MAXPAGESIZE}"; then + DATA_SEGMENT_ALIGN="ALIGN (${SEGMENT_SIZE}) - ((${MAXPAGESIZE} - .) & (${MAXPAGESIZE} - 1)); . = DATA_SEGMENT_ALIGN (${MAXPAGESIZE}, ${COMMONPAGESIZE})" + else + DATA_SEGMENT_ALIGN="DATA_SEGMENT_ALIGN (${MAXPAGESIZE}, ${COMMONPAGESIZE})" + fi + DATA_SEGMENT_END=". = DATA_SEGMENT_END (.);" + DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT-0}, .);" fi - DATA_SEGMENT_END=". = DATA_SEGMENT_END (.);" - DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT-0}, .);" fi if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}"; then INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp) }"