001-ELF-BFD-Limit-_bfd_elf_link_renumber_dynsyms-call-in.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. From 2424aef3a744bc6ca4099a655065c70a63f0fb49 Mon Sep 17 00:00:00 2001
  2. From: "Maciej W. Rozycki" <[email protected]>
  3. Date: Wed, 26 Apr 2017 22:18:13 +0100
  4. Subject: ELF/BFD: Limit `_bfd_elf_link_renumber_dynsyms' call in section GC
  5. Consistently call `_bfd_elf_link_renumber_dynsyms' only if linking a
  6. dynamic binary, complementing code in `bfd_elf_size_dynsym_hash_dynstr'
  7. and commit ccabcbe51e85 ("New attempt at fixing MIPS --gc-sections et
  8. al."), <https://sourceware.org/ml/binutils/2005-08/msg00258.html>.
  9. bfd/
  10. * elflink.c (elf_gc_sweep): Only call
  11. `_bfd_elf_link_renumber_dynsyms' if dynamic sections have been
  12. created.
  13. (backported from commit c46cec3a8cfe02fbe0f6c67ba53abc5369c5c659)
  14. ---
  15. bfd/ChangeLog | 6 ++++++
  16. bfd/elflink.c | 3 ++-
  17. 2 files changed, 8 insertions(+), 1 deletion(-)
  18. diff --git a/bfd/ChangeLog b/bfd/ChangeLog
  19. index 85c6a817e5..537ebb5e2c 100644
  20. --- a/bfd/ChangeLog
  21. +++ b/bfd/ChangeLog
  22. @@ -1,3 +1,9 @@
  23. +2017-04-26 Maciej W. Rozycki <[email protected]>
  24. +
  25. + * elflink.c (elf_gc_sweep): Only call
  26. + `_bfd_elf_link_renumber_dynsyms' if dynamic sections have been
  27. + created.
  28. +
  29. 2017-03-02 Tristan Gingold <[email protected]>
  30. * version.m4: Bump version to 2.28
  31. diff --git a/bfd/elflink.c b/bfd/elflink.c
  32. index 69b66f2831..75d6543dcc 100644
  33. --- a/bfd/elflink.c
  34. +++ b/bfd/elflink.c
  35. @@ -12986,7 +12986,8 @@ elf_gc_sweep (bfd *abfd, struct bfd_link_info *info)
  36. elf_link_hash_traverse (elf_hash_table (info), elf_gc_sweep_symbol,
  37. &sweep_info);
  38. - _bfd_elf_link_renumber_dynsyms (abfd, info, &section_sym_count);
  39. + if (elf_hash_table (info)->dynamic_sections_created)
  40. + _bfd_elf_link_renumber_dynsyms (abfd, info, &section_sym_count);
  41. return TRUE;
  42. }
  43. --
  44. 2.11.0