aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2017-01-02 22:33:47 +1030
committerAlan Modra <amodra@gmail.com>2017-01-02 22:42:45 +1030
commitf5657270bd9353db74ba802ebed62b7133f7c2a0 (patch)
treecbd9dc4ebf8ca3d01a00e0a23e9107c5f7933430
parent595e0a47f57b414843261303b8aa5036fd1fa1e3 (diff)
downloadgdb-f5657270bd9353db74ba802ebed62b7133f7c2a0.zip
gdb-f5657270bd9353db74ba802ebed62b7133f7c2a0.tar.gz
gdb-f5657270bd9353db74ba802ebed62b7133f7c2a0.tar.bz2
Support -z relro on hppa
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.
-rw-r--r--ld/ChangeLog8
-rw-r--r--ld/emulparams/hppalinux.sh13
-rw-r--r--ld/scripttempl/elf.sc26
3 files changed, 33 insertions, 14 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 6a61d61..90a6d33 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,13 @@
2017-01-02 Alan Modra <amodra@gmail.com>
+ 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 <amodra@gmail.com>
+
Update year range in copyright notice of all files.
For older changes see ChangeLog-2016
diff --git a/ld/emulparams/hppalinux.sh b/ld/emulparams/hppalinux.sh
index d7d87e2..deb07c2 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 aa46050..e65f9a3 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) }"