openadk_binutils_fix.patch 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
  2. index fba58cb..d99da93 100644
  3. --- a/bfd/elf32-arc.c
  4. +++ b/bfd/elf32-arc.c
  5. @@ -70,13 +70,7 @@ name_for_global_symbol (struct elf_link_hash_entry *h)
  6. struct dynamic_sections
  7. {
  8. bfd_boolean initialized;
  9. - asection * sgot;
  10. - asection * srelgot;
  11. - asection * sgotplt;
  12. - asection * srelgotplt;
  13. asection * sdyn;
  14. - asection * splt;
  15. - asection * srelplt;
  16. };
  17. enum dyn_section_types
  18. @@ -1578,13 +1572,7 @@ arc_create_dynamic_sections (bfd * abfd, struct bfd_link_info *info)
  19. struct dynamic_sections ds =
  20. {
  21. .initialized = FALSE,
  22. - .sgot = NULL,
  23. - .srelgot = NULL,
  24. - .sgotplt = NULL,
  25. - .srelgotplt = NULL,
  26. .sdyn = NULL,
  27. - .splt = NULL,
  28. - .srelplt = NULL
  29. };
  30. htab = elf_hash_table (info);
  31. @@ -1592,7 +1580,7 @@ arc_create_dynamic_sections (bfd * abfd, struct bfd_link_info *info)
  32. /* Create dynamic sections for relocatable executables so that we
  33. can copy relocations. */
  34. - if (! htab->dynamic_sections_created && bfd_link_pic (info))
  35. + if (! htab->dynamic_sections_created)
  36. {
  37. if (! _bfd_elf_link_create_dynamic_sections (abfd, info))
  38. BFD_ASSERT (0);
  39. @@ -1600,18 +1588,6 @@ arc_create_dynamic_sections (bfd * abfd, struct bfd_link_info *info)
  40. dynobj = (elf_hash_table (info))->dynobj;
  41. - if (dynobj)
  42. - {
  43. - ds.sgot = htab->sgot;
  44. - ds.srelgot = htab->srelgot;
  45. -
  46. - ds.sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
  47. - ds.srelgotplt = ds.srelplt;
  48. -
  49. - ds.splt = bfd_get_section_by_name (dynobj, ".plt");
  50. - ds.srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
  51. - }
  52. -
  53. if (htab->dynamic_sections_created)
  54. {
  55. ds.sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
  56. @@ -1634,10 +1610,20 @@ elf_arc_check_relocs (bfd * abfd,
  57. const Elf_Internal_Rela * rel_end;
  58. bfd * dynobj;
  59. asection * sreloc = NULL;
  60. + struct elf_link_hash_table * htab = elf_hash_table (info);
  61. if (bfd_link_relocatable (info))
  62. return TRUE;
  63. + if (htab->dynobj == NULL)
  64. + htab->dynobj = abfd;
  65. +
  66. + if (! htab->dynamic_sections_created)
  67. + {
  68. + if (! _bfd_elf_link_create_dynamic_sections (abfd, info))
  69. + return FALSE;
  70. + }
  71. +
  72. dynobj = (elf_hash_table (info))->dynobj;
  73. symtab_hdr = &((elf_tdata (abfd))->symtab_hdr);
  74. sym_hashes = elf_sym_hashes (abfd);
  75. @@ -1659,15 +1645,6 @@ elf_arc_check_relocs (bfd * abfd,
  76. }
  77. howto = arc_elf_howto (r_type);
  78. - if (dynobj == NULL
  79. - && (is_reloc_for_GOT (howto) == TRUE
  80. - || is_reloc_for_TLS (howto) == TRUE))
  81. - {
  82. - dynobj = elf_hash_table (info)->dynobj = abfd;
  83. - if (! _bfd_elf_create_got_section (abfd, info))
  84. - return FALSE;
  85. - }
  86. -
  87. /* Load symbol information. */
  88. r_symndx = ELF32_R_SYM (rel->r_info);
  89. if (r_symndx < symtab_hdr->sh_info) /* Is a local symbol. */