aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2018-07-22 13:52:28 -0700
committerMax Filippov <jcmvbkbc@gmail.com>2018-07-23 12:02:53 -0700
commit5d3a462f05cba5b0c0c96de899b84fb84155c760 (patch)
treeef4b1467df8ea2d90c3d39ec9addf6690efbef04 /bfd
parent01bcaf636ad0b1d5fe44a21917ec900af86072a8 (diff)
downloadfsf-binutils-gdb-5d3a462f05cba5b0c0c96de899b84fb84155c760.zip
fsf-binutils-gdb-5d3a462f05cba5b0c0c96de899b84fb84155c760.tar.gz
fsf-binutils-gdb-5d3a462f05cba5b0c0c96de899b84fb84155c760.tar.bz2
xtensa: fix relaxation of undefined weak references in shared objects
The change c451bb34ae8b ("xtensa: don't emit dynamic relocation for weak undefined symbol") didn't properly handle shrinking of relocation sections due to coalescing of references to a dynamic undefined weak symbol in a shared object, which resulted in the following assertion failure in ld when linking uClibc-ng libthread_db for xtensa: BFD (GNU Binutils) 2.31 internal error, aborting at elf32-xtensa.c:3269 in elf_xtensa_finish_dynamic_sections Shrink dynamic relocations section for dynamic undefined weak symbols when linking a shared object. bfd/ 2018-07-23 Max Filippov <jcmvbkbc@gmail.com> * elf32-xtensa.c (shrink_dynamic_reloc_sections): Shrink dynamic relocations section for dynamic undefined weak symbols when linking a shared object.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf32-xtensa.c3
2 files changed, 8 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 19fd9df..3bdd2aa 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2018-07-23 Max Filippov <jcmvbkbc@gmail.com>
+
+ * elf32-xtensa.c (shrink_dynamic_reloc_sections): Shrink dynamic
+ relocations section for dynamic undefined weak symbols when
+ linking a shared object.
+
2018-07-23 Tom Tromey <tom@tromey.com>
* elf.c (bfd_get_elf_phdrs): Don't call memcpy with size 0.
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
index f7f569d..a4b046e 100644
--- a/bfd/elf32-xtensa.c
+++ b/bfd/elf32-xtensa.c
@@ -10022,7 +10022,8 @@ shrink_dynamic_reloc_sections (struct bfd_link_info *info,
if ((r_type == R_XTENSA_32 || r_type == R_XTENSA_PLT)
&& (input_section->flags & SEC_ALLOC) != 0
&& (dynamic_symbol || bfd_link_pic (info))
- && (!h || h->root.type != bfd_link_hash_undefweak))
+ && (!h || h->root.type != bfd_link_hash_undefweak
+ || (dynamic_symbol && bfd_link_dll (info))))
{
asection *srel;
bfd_boolean is_plt = FALSE;