From 6e9ed99753f0730e85bd45eabb63f499e4d0eca3 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 5 Dec 2019 16:40:02 +1030 Subject: PR25243, static linking with exceptions and iostream is broken on ARM PR 25243 * emulparams/armelf.sh (OTHER_READONLY_SECTIONS): Move definition of __exidx_start and __exidx_end into ARM.exidx. * emulparams/armelf_linux_eabi.sh (OTHER_READONLY_SECTIONS): Likewise. * emulparams/armsymbian.sh (OTHER_READONLY_SECTIONS): Similarly. * emulparams/elf32_tic6x_le.sh (OTHER_READONLY_SECTIONS): Similarly. * emulparams/armelf_fuchsia.sh: Source armelf_linux_eabi.sh, just redefining TEXT_START_ADDR. * emulparams/armelf_linux_fdpiceabi.sh: Source armelf_linux_eabi.sh, adding to OTHER_READONLY_SECTIONS. --- ld/ChangeLog | 13 +++++++++++++ ld/emulparams/armelf.sh | 9 ++++++--- ld/emulparams/armelf_fuchsia.sh | 31 +------------------------------ ld/emulparams/armelf_linux_eabi.sh | 10 ++++++---- ld/emulparams/armelf_linux_fdpiceabi.sh | 9 ++------- ld/emulparams/armsymbian.sh | 13 ++++++++----- ld/emulparams/elf32_tic6x_le.sh | 9 ++++++--- 7 files changed, 42 insertions(+), 52 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 15b2d80..b3318cb 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,5 +1,18 @@ 2019-12-05 Alan Modra + PR 25243 + * emulparams/armelf.sh (OTHER_READONLY_SECTIONS): Move definition + of __exidx_start and __exidx_end into ARM.exidx. + * emulparams/armelf_linux_eabi.sh (OTHER_READONLY_SECTIONS): Likewise. + * emulparams/armsymbian.sh (OTHER_READONLY_SECTIONS): Similarly. + * emulparams/elf32_tic6x_le.sh (OTHER_READONLY_SECTIONS): Similarly. + * emulparams/armelf_fuchsia.sh: Source armelf_linux_eabi.sh, + just redefining TEXT_START_ADDR. + * emulparams/armelf_linux_fdpiceabi.sh: Source armelf_linux_eabi.sh, + adding to OTHER_READONLY_SECTIONS. + +2019-12-05 Alan Modra + PR 25244 * ldlang.c (lang_print_memory_usage): Don't print percent used when length is zero. diff --git a/ld/emulparams/armelf.sh b/ld/emulparams/armelf.sh index 0e3147c..24ca8ed 100644 --- a/ld/emulparams/armelf.sh +++ b/ld/emulparams/armelf.sh @@ -26,9 +26,12 @@ OTHER_SECTIONS=' ATTRS_SECTIONS='.ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }' OTHER_READONLY_SECTIONS=" .ARM.extab ${RELOCATING-0} : { *(.ARM.extab${RELOCATING+* .gnu.linkonce.armextab.*}) } - ${RELOCATING+ PROVIDE_HIDDEN (__exidx_start = .); } - .ARM.exidx ${RELOCATING-0} : { *(.ARM.exidx${RELOCATING+* .gnu.linkonce.armexidx.*}) } - ${RELOCATING+ PROVIDE_HIDDEN (__exidx_end = .); }" + .ARM.exidx ${RELOCATING-0} : + { + ${RELOCATING+PROVIDE_HIDDEN (__exidx_start = .);} + *(.ARM.exidx${RELOCATING+* .gnu.linkonce.armexidx.*}) + ${RELOCATING+PROVIDE_HIDDEN (__exidx_end = .);} + }" DATA_START_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__data_start = .${CREATE_SHLIB+)};" diff --git a/ld/emulparams/armelf_fuchsia.sh b/ld/emulparams/armelf_fuchsia.sh index 823ddf5..f67ebd7 100644 --- a/ld/emulparams/armelf_fuchsia.sh +++ b/ld/emulparams/armelf_fuchsia.sh @@ -1,32 +1,3 @@ -ARCH=arm -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-littlearm" -BIG_OUTPUT_FORMAT="elf32-bigarm" -LITTLE_OUTPUT_FORMAT="elf32-littlearm" -MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" -COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)" -TEMPLATE_NAME=elf -EXTRA_EM_FILE=armelf -GENERATE_SHLIB_SCRIPT=yes -GENERATE_PIE_SCRIPT=yes - -DATA_START_SYMBOLS='PROVIDE (__data_start = .);'; -OTHER_TEXT_SECTIONS='*(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)' -OTHER_BSS_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__bss_start__ = .${CREATE_SHLIB+)};" -OTHER_BSS_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}_bss_end__ = .${CREATE_SHLIB+)}; ${CREATE_SHLIB+PROVIDE (}__bss_end__ = .${CREATE_SHLIB+)};" -OTHER_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__end__ = .${CREATE_SHLIB+)};" -OTHER_SECTIONS='.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }' +source_sh ${srcdir}/emulparams/armelf_linux_eabi.sh TEXT_START_ADDR=0x00001000 -TARGET2_TYPE=got-rel - -# ARM does not support .s* sections. -NO_SMALL_DATA=yes - -# Use the ARM ABI-compliant exception-handling sections. -OTHER_READONLY_SECTIONS=" - .ARM.extab ${RELOCATING-0} : { *(.ARM.extab${RELOCATING+* .gnu.linkonce.armextab.*}) } - ${RELOCATING+ PROVIDE_HIDDEN (__exidx_start = .); } - .ARM.exidx ${RELOCATING-0} : { *(.ARM.exidx${RELOCATING+* .gnu.linkonce.armexidx.*}) } - ${RELOCATING+ PROVIDE_HIDDEN (__exidx_end = .); }" - diff --git a/ld/emulparams/armelf_linux_eabi.sh b/ld/emulparams/armelf_linux_eabi.sh index e1b6a11..312d006 100644 --- a/ld/emulparams/armelf_linux_eabi.sh +++ b/ld/emulparams/armelf_linux_eabi.sh @@ -3,7 +3,9 @@ source_sh ${srcdir}/emulparams/armelf_linux.sh # Use the ARM ABI-compliant exception-handling sections. OTHER_READONLY_SECTIONS=" .ARM.extab ${RELOCATING-0} : { *(.ARM.extab${RELOCATING+* .gnu.linkonce.armextab.*}) } - ${RELOCATING+ PROVIDE_HIDDEN (__exidx_start = .); } - .ARM.exidx ${RELOCATING-0} : { *(.ARM.exidx${RELOCATING+* .gnu.linkonce.armexidx.*}) } - ${RELOCATING+ PROVIDE_HIDDEN (__exidx_end = .); }" - + .ARM.exidx ${RELOCATING-0} : + { + ${RELOCATING+PROVIDE_HIDDEN (__exidx_start = .);} + *(.ARM.exidx${RELOCATING+* .gnu.linkonce.armexidx.*}) + ${RELOCATING+PROVIDE_HIDDEN (__exidx_end = .);} + }" diff --git a/ld/emulparams/armelf_linux_fdpiceabi.sh b/ld/emulparams/armelf_linux_fdpiceabi.sh index 97d41f8..84e452b 100644 --- a/ld/emulparams/armelf_linux_fdpiceabi.sh +++ b/ld/emulparams/armelf_linux_fdpiceabi.sh @@ -1,15 +1,10 @@ -source_sh ${srcdir}/emulparams/armelf_linux.sh +source_sh ${srcdir}/emulparams/armelf_linux_eabi.sh OUTPUT_FORMAT="elf32-littlearm-fdpic" BIG_OUTPUT_FORMAT="elf32-bigarm-fdpic" LITTLE_OUTPUT_FORMAT="elf32-littlearm-fdpic" -# Use the ARM ABI-compliant exception-handling sections. -OTHER_READONLY_SECTIONS=" - .ARM.extab ${RELOCATING-0} : { *(.ARM.extab${RELOCATING+* .gnu.linkonce.armextab.*}) } - ${RELOCATING+ PROVIDE_HIDDEN (__exidx_start = .); } - .ARM.exidx ${RELOCATING-0} : { *(.ARM.exidx${RELOCATING+* .gnu.linkonce.armexidx.*}) } - ${RELOCATING+ PROVIDE_HIDDEN (__exidx_end = .); } +OTHER_READONLY_SECTIONS="${OTHER_READONLY_SECTIONS} .rofixup : { ${RELOCATING+__ROFIXUP_LIST__ = .;} *(.rofixup) diff --git a/ld/emulparams/armsymbian.sh b/ld/emulparams/armsymbian.sh index 1959685..f643165 100644 --- a/ld/emulparams/armsymbian.sh +++ b/ld/emulparams/armsymbian.sh @@ -13,10 +13,13 @@ EMBEDDED=yes # .ARM.exidx$${Base,Limit} symbols. OTHER_READONLY_SECTIONS=" .ARM.extab ${RELOCATING-0} : { *(.ARM.extab${RELOCATING+* .gnu.linkonce.armextab.*}) } - ${RELOCATING+ PROVIDE_HIDDEN (.ARM.exidx\$\$Base = .); } - ${RELOCATING+ PROVIDE_HIDDEN (__exidx_start = .); } - .ARM.exidx ${RELOCATING-0} : { *(.ARM.exidx${RELOCATING+* .gnu.linkonce.armexidx.*}) } - ${RELOCATING+ PROVIDE_HIDDEN (__exidx_end = .); } - ${RELOCATING+ PROVIDE_HIDDEN (.ARM.exidx\$\$Limit = .); }" + .ARM.exidx ${RELOCATING-0} : + { + ${RELOCATING+PROVIDE_HIDDEN (.ARM.exidx\$\$Base = .);} + ${RELOCATING+PROVIDE_HIDDEN (__exidx_start = .);} + *(.ARM.exidx${RELOCATING+* .gnu.linkonce.armexidx.*}) + ${RELOCATING+PROVIDE_HIDDEN (__exidx_end = .);} + ${RELOCATING+PROVIDE_HIDDEN (.ARM.exidx\$\$Limit = .);} + }" MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" diff --git a/ld/emulparams/elf32_tic6x_le.sh b/ld/emulparams/elf32_tic6x_le.sh index 7bf7bf1..9ef4c17 100644 --- a/ld/emulparams/elf32_tic6x_le.sh +++ b/ld/emulparams/elf32_tic6x_le.sh @@ -32,9 +32,12 @@ SBSS_NAME="bss" BSS_NAME="far" OTHER_READONLY_SECTIONS=" .c6xabi.extab ${RELOCATING-0} : { *(.c6xabi.extab${RELOCATING+* .gnu.linkonce.c6xabiextab.*}) } - ${RELOCATING+ PROVIDE_HIDDEN (__exidx_start = .); } - .c6xabi.exidx ${RELOCATING-0} : { *(.c6xabi.exidx${RELOCATING+* .gnu.linkonce.c6xabiexidx.*}) } - ${RELOCATING+ PROVIDE_HIDDEN (__exidx_end = .); }" + .c6xabi.exidx ${RELOCATING-0} : + { + ${RELOCATING+PROVIDE_HIDDEN (__exidx_start = .);} + *(.c6xabi.exidx${RELOCATING+* .gnu.linkonce.c6xabiexidx.*}) + ${RELOCATING+PROVIDE_HIDDEN (__exidx_end = .);} + }" OTHER_SDATA_SECTIONS=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.*}) }" OTHER_READONLY_RELOC_SECTIONS=" .rel.rodata ${RELOCATING-0} : { *(.rel.rodata${RELOCATING+ .rel.rodata.*}) } -- cgit v1.1