0003-bfd-xtensa-fix-shrink_dynamic_reloc_sections-for-exp.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. From 278989f23735aa501be1052e085540c75c126dbb Mon Sep 17 00:00:00 2001
  2. From: Max Filippov <jcmvbkbc@gmail.com>
  3. Date: Thu, 28 Mar 2019 17:03:57 -0700
  4. Subject: [PATCH] bfd: xtensa: fix shrink_dynamic_reloc_sections for
  5. export-dynamic
  6. shrink_dynamic_reloc_sections must remove PLT entry that was created for
  7. an undefined weak symbol in the presence of --export-dynamic option when
  8. relaxation coalesces literals pointing to that symbol. This fixes the
  9. following assertion:
  10. ld: BFD (GNU Binutils) 2.31.1 internal error, aborting at
  11. elf32-xtensa.c:3292 in elf_xtensa_finish_dynamic_sections
  12. 2019-03-28 Max Filippov <jcmvbkbc@gmail.com>
  13. bfd/
  14. * elf32-xtensa.c (shrink_dynamic_reloc_sections): Add
  15. info->export_dynamic to the conditional.
  16. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
  17. ---
  18. bfd/elf32-xtensa.c | 3 ++-
  19. 1 file changed, 2 insertions(+), 1 deletion(-)
  20. diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
  21. index c3df3d6db756..37ea200eea74 100644
  22. --- a/bfd/elf32-xtensa.c
  23. +++ b/bfd/elf32-xtensa.c
  24. @@ -10083,7 +10083,8 @@ shrink_dynamic_reloc_sections (struct bfd_link_info *info,
  25. && (input_section->flags & SEC_ALLOC) != 0
  26. && (dynamic_symbol || bfd_link_pic (info))
  27. && (!h || h->root.type != bfd_link_hash_undefweak
  28. - || (dynamic_symbol && bfd_link_dll (info))))
  29. + || (dynamic_symbol
  30. + && (bfd_link_dll (info) || info->export_dynamic))))
  31. {
  32. asection *srel;
  33. bfd_boolean is_plt = FALSE;
  34. --
  35. 2.11.0