0010-xtensa-fix-relaxation-of-undefined-weak-references-i.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. From 5d3a462f05cba5b0c0c96de899b84fb84155c760 Mon Sep 17 00:00:00 2001
  2. From: Max Filippov <jcmvbkbc@gmail.com>
  3. Date: Sun, 22 Jul 2018 13:52:28 -0700
  4. Subject: [PATCH] xtensa: fix relaxation of undefined weak references in
  5. shared objects
  6. The change c451bb34ae8b ("xtensa: don't emit dynamic relocation for weak
  7. undefined symbol") didn't properly handle shrinking of relocation
  8. sections due to coalescing of references to a dynamic undefined weak
  9. symbol in a shared object, which resulted in the following assertion
  10. failure in ld when linking uClibc-ng libthread_db for xtensa:
  11. BFD (GNU Binutils) 2.31 internal error, aborting at elf32-xtensa.c:3269
  12. in elf_xtensa_finish_dynamic_sections
  13. Shrink dynamic relocations section for dynamic undefined weak symbols
  14. when linking a shared object.
  15. bfd/
  16. 2018-07-23 Max Filippov <jcmvbkbc@gmail.com>
  17. * elf32-xtensa.c (shrink_dynamic_reloc_sections): Shrink dynamic
  18. relocations section for dynamic undefined weak symbols when
  19. linking a shared object.
  20. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
  21. Backported from: 5d3a462f05cba5b0c0c96de899b84fb84155c760
  22. ---
  23. bfd/elf32-xtensa.c | 3 ++-
  24. 1 file changed, 2 insertions(+), 1 deletion(-)
  25. diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
  26. index f7f569d0c086..a4b046e445f1 100644
  27. --- a/bfd/elf32-xtensa.c
  28. +++ b/bfd/elf32-xtensa.c
  29. @@ -10022,7 +10022,8 @@ shrink_dynamic_reloc_sections (struct bfd_link_info *info,
  30. if ((r_type == R_XTENSA_32 || r_type == R_XTENSA_PLT)
  31. && (input_section->flags & SEC_ALLOC) != 0
  32. && (dynamic_symbol || bfd_link_pic (info))
  33. - && (!h || h->root.type != bfd_link_hash_undefweak))
  34. + && (!h || h->root.type != bfd_link_hash_undefweak
  35. + || (dynamic_symbol && bfd_link_dll (info))))
  36. {
  37. asection *srel;
  38. bfd_boolean is_plt = FALSE;
  39. --
  40. 2.11.0