400-arm_link_speed.patch 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. From Binutils CVS:
  2. http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-arm.c?rev=1.230&content-type=text/x-cvsweb-markup&cvsroot=src
  3. Improves linking time from large projects on ARM.
  4. diff -dupr binutils-2.20.orig/bfd/elf32-arm.c binutils-2.20/bfd/elf32-arm.c
  5. --- binutils-2.20.orig/bfd/elf32-arm.c 2010-04-19 10:08:50.000000000 -0700
  6. +++ binutils-2.20/bfd/elf32-arm.c 2010-04-19 10:12:45.000000000 -0700
  7. @@ -12736,108 +12736,15 @@ elf32_arm_section_from_shdr (bfd *abfd,
  8. return TRUE;
  9. }
  10. -/* A structure used to record a list of sections, independently
  11. - of the next and prev fields in the asection structure. */
  12. -typedef struct section_list
  13. -{
  14. - asection * sec;
  15. - struct section_list * next;
  16. - struct section_list * prev;
  17. -}
  18. -section_list;
  19. -
  20. -/* Unfortunately we need to keep a list of sections for which
  21. - an _arm_elf_section_data structure has been allocated. This
  22. - is because it is possible for functions like elf32_arm_write_section
  23. - to be called on a section which has had an elf_data_structure
  24. - allocated for it (and so the used_by_bfd field is valid) but
  25. - for which the ARM extended version of this structure - the
  26. - _arm_elf_section_data structure - has not been allocated. */
  27. -static section_list * sections_with_arm_elf_section_data = NULL;
  28. -
  29. -static void
  30. -record_section_with_arm_elf_section_data (asection * sec)
  31. -{
  32. - struct section_list * entry;
  33. -
  34. - entry = bfd_malloc (sizeof (* entry));
  35. - if (entry == NULL)
  36. - return;
  37. - entry->sec = sec;
  38. - entry->next = sections_with_arm_elf_section_data;
  39. - entry->prev = NULL;
  40. - if (entry->next != NULL)
  41. - entry->next->prev = entry;
  42. - sections_with_arm_elf_section_data = entry;
  43. -}
  44. -
  45. -static struct section_list *
  46. -find_arm_elf_section_entry (asection * sec)
  47. -{
  48. - struct section_list * entry;
  49. - static struct section_list * last_entry = NULL;
  50. -
  51. - /* This is a short cut for the typical case where the sections are added
  52. - to the sections_with_arm_elf_section_data list in forward order and
  53. - then looked up here in backwards order. This makes a real difference
  54. - to the ld-srec/sec64k.exp linker test. */
  55. - entry = sections_with_arm_elf_section_data;
  56. - if (last_entry != NULL)
  57. - {
  58. - if (last_entry->sec == sec)
  59. - entry = last_entry;
  60. - else if (last_entry->next != NULL
  61. - && last_entry->next->sec == sec)
  62. - entry = last_entry->next;
  63. - }
  64. -
  65. - for (; entry; entry = entry->next)
  66. - if (entry->sec == sec)
  67. - break;
  68. -
  69. - if (entry)
  70. - /* Record the entry prior to this one - it is the entry we are most
  71. - likely to want to locate next time. Also this way if we have been
  72. - called from unrecord_section_with_arm_elf_section_data() we will not
  73. - be caching a pointer that is about to be freed. */
  74. - last_entry = entry->prev;
  75. -
  76. - return entry;
  77. -}
  78. -
  79. static _arm_elf_section_data *
  80. get_arm_elf_section_data (asection * sec)
  81. {
  82. - struct section_list * entry;
  83. -
  84. - entry = find_arm_elf_section_entry (sec);
  85. -
  86. - if (entry)
  87. - return elf32_arm_section_data (entry->sec);
  88. + if (sec && sec->owner && is_arm_elf (sec->owner))
  89. + return elf32_arm_section_data (sec);
  90. else
  91. return NULL;
  92. }
  93. -static void
  94. -unrecord_section_with_arm_elf_section_data (asection * sec)
  95. -{
  96. - struct section_list * entry;
  97. -
  98. - entry = find_arm_elf_section_entry (sec);
  99. -
  100. - if (entry)
  101. - {
  102. - if (entry->prev != NULL)
  103. - entry->prev->next = entry->next;
  104. - if (entry->next != NULL)
  105. - entry->next->prev = entry->prev;
  106. - if (entry == sections_with_arm_elf_section_data)
  107. - sections_with_arm_elf_section_data = entry->next;
  108. - free (entry);
  109. - }
  110. -}
  111. -
  112. -
  113. typedef struct
  114. {
  115. void *finfo;
  116. @@ -13230,8 +13137,6 @@ elf32_arm_new_section_hook (bfd *abfd, a
  117. sec->used_by_bfd = sdata;
  118. }
  119. - record_section_with_arm_elf_section_data (sec);
  120. -
  121. return _bfd_elf_new_section_hook (abfd, sec);
  122. }
  123. @@ -13659,44 +13564,13 @@ elf32_arm_write_section (bfd *output_bfd
  124. }
  125. free (map);
  126. - arm_data->mapcount = 0;
  127. + arm_data->mapcount = -1;
  128. arm_data->mapsize = 0;
  129. arm_data->map = NULL;
  130. - unrecord_section_with_arm_elf_section_data (sec);
  131. return FALSE;
  132. }
  133. -static void
  134. -unrecord_section_via_map_over_sections (bfd * abfd ATTRIBUTE_UNUSED,
  135. - asection * sec,
  136. - void * ignore ATTRIBUTE_UNUSED)
  137. -{
  138. - unrecord_section_with_arm_elf_section_data (sec);
  139. -}
  140. -
  141. -static bfd_boolean
  142. -elf32_arm_close_and_cleanup (bfd * abfd)
  143. -{
  144. - if (abfd->sections)
  145. - bfd_map_over_sections (abfd,
  146. - unrecord_section_via_map_over_sections,
  147. - NULL);
  148. -
  149. - return _bfd_elf_close_and_cleanup (abfd);
  150. -}
  151. -
  152. -static bfd_boolean
  153. -elf32_arm_bfd_free_cached_info (bfd * abfd)
  154. -{
  155. - if (abfd->sections)
  156. - bfd_map_over_sections (abfd,
  157. - unrecord_section_via_map_over_sections,
  158. - NULL);
  159. -
  160. - return _bfd_free_cached_info (abfd);
  161. -}
  162. -
  163. /* Display STT_ARM_TFUNC symbols as functions. */
  164. static void
  165. @@ -13882,8 +13756,6 @@ const struct elf_size_info elf32_arm_siz
  166. #define bfd_elf32_find_inliner_info elf32_arm_find_inliner_info
  167. #define bfd_elf32_new_section_hook elf32_arm_new_section_hook
  168. #define bfd_elf32_bfd_is_target_special_symbol elf32_arm_is_target_special_symbol
  169. -#define bfd_elf32_close_and_cleanup elf32_arm_close_and_cleanup
  170. -#define bfd_elf32_bfd_free_cached_info elf32_arm_bfd_free_cached_info
  171. #define bfd_elf32_bfd_final_link elf32_arm_final_link
  172. #define elf_backend_get_symbol_type elf32_arm_get_symbol_type