From 2487ef07c28b961c6e2b8c51161f88f93b181d07 Mon Sep 17 00:00:00 2001 From: Max Filippov Date: Thu, 28 Mar 2019 17:03:57 -0700 Subject: bfd: xtensa: fix shrink_dynamic_reloc_sections for export-dynamic shrink_dynamic_reloc_sections must remove PLT entry that was created for an undefined weak symbol in the presence of --export-dynamic option when relaxation coalesces literals pointing to that symbol. This fixes the following assertion: ld: BFD (GNU Binutils) 2.31.1 internal error, aborting at elf32-xtensa.c:3292 in elf_xtensa_finish_dynamic_sections 2019-03-29 Max Filippov bfd/ * elf32-xtensa.c (shrink_dynamic_reloc_sections): Add info->export_dynamic to the conditional. ld/ * testsuite/ld-xtensa/relax-undef-weak-pie-export-dynamic.d: New test definition. * testsuite/ld-xtensa/xtensa.exp (relax-undef-weak-pie-export-dynamic): Add new test. --- bfd/ChangeLog | 5 +++++ bfd/elf32-xtensa.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'bfd') diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 4dd3f27..6662b70 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2019-03-29 Max Filippov + + * elf32-xtensa.c (shrink_dynamic_reloc_sections): Add + info->export_dynamic to the conditional. + 2019-03-28 Alan Modra PR 24392 diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index c3df3d6..37ea200 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -10083,7 +10083,8 @@ shrink_dynamic_reloc_sections (struct bfd_link_info *info, && (input_section->flags & SEC_ALLOC) != 0 && (dynamic_symbol || bfd_link_pic (info)) && (!h || h->root.type != bfd_link_hash_undefweak - || (dynamic_symbol && bfd_link_dll (info)))) + || (dynamic_symbol + && (bfd_link_dll (info) || info->export_dynamic)))) { asection *srel; bfd_boolean is_plt = FALSE; -- cgit v1.1