From 6bd0a312a4cb6803b9d6aa2f5646b610d213a1fe Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 11 Jan 2018 05:05:25 -0800 Subject: [PATCH] Fix the order of SHLIB_RODATA_ADDR in elf.sc elf.sc has if test -n "${RODATA_ADDR}"; then RODATA_ADDR="\ SEGMENT_START(\"rodata-segment\", ${RODATA_ADDR}) + SIZEOF_HEADERS" else RODATA_ADDR="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))" ^^^^^^^^^^ Set RODATA_ADDR RODATA_ADDR="SEGMENT_START(\"rodata-segment\", ${RODATA_ADDR})" ^^^^^^^^^^ Set RODATA_ADDR with ${RODATA_ADDR} fi if test -n "${SHLIB_RODATA_ADDR}"; then SHLIB_RODATA_ADDR="\ SEGMENT_START(\"rodata-segment\", ${SHLIB_RODATA_ADDR}) + SIZEOF_HEADERS" else SHLIB_RODATA_ADDR="SEGMENT_START(\"rodata-segment\", ${SHLIB_RODATA_ADDR})" ^^^^^^^^^^ Set SHLIB_RODATA_ADDR SHLIB_RODATA_ADDR="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))" ^^^^^^^^^^ Override SHLIB_RODATA_ADDR fi The order should be: if test -n "${SHLIB_RODATA_ADDR}"; then SHLIB_RODATA_ADDR="\ SEGMENT_START(\"rodata-segment\", ${SHLIB_RODATA_ADDR}) + SIZEOF_HEADERS" else SHLIB_RODATA_ADDR="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))" SHLIB_RODATA_ADDR="SEGMENT_START(\"rodata-segment\", ${SHLIB_RODATA_ADDR})" fi PR ld/22696 * scripttempl/elf.sc: Fix the order of SHLIB_RODATA_ADDR. --- ld/ChangeLog | 5 +++++ ld/scripttempl/elf.sc | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 0545b6a29ce..c5085b179b9 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2018-01-11 H.J. Lu + + PR ld/22696 + * scripttempl/elf.sc: Fix the order of SHLIB_RODATA_ADDR. + 2018-01-09 Jim Wilson * testsuite/ld-elf/eh-frame-hdr.d (#xfail): Delete diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc index 841a831437e..3de86b0fcf1 100644 --- a/ld/scripttempl/elf.sc +++ b/ld/scripttempl/elf.sc @@ -522,8 +522,8 @@ SEGMENT_START(\"rodata-segment\", ${RODATA_ADDR}) + SIZEOF_HEADERS" SHLIB_RODATA_ADDR="\ SEGMENT_START(\"rodata-segment\", ${SHLIB_RODATA_ADDR}) + SIZEOF_HEADERS" else - SHLIB_RODATA_ADDR="SEGMENT_START(\"rodata-segment\", ${SHLIB_RODATA_ADDR})" SHLIB_RODATA_ADDR="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))" + SHLIB_RODATA_ADDR="SEGMENT_START(\"rodata-segment\", ${SHLIB_RODATA_ADDR})" fi cat <