elfxx-sparc.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /* SPARC ELF specific backend routines.
  2. Copyright (C) 2005-2015 Free Software Foundation, Inc.
  3. This file is part of BFD, the Binary File Descriptor library.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  15. MA 02110-1301, USA. */
  16. #include "elf/common.h"
  17. #include "elf/internal.h"
  18. struct _bfd_sparc_elf_section_data
  19. {
  20. struct bfd_elf_section_data elf;
  21. unsigned int do_relax, reloc_count;
  22. };
  23. #define sec_do_relax(sec) \
  24. ((struct _bfd_sparc_elf_section_data *) elf_section_data (sec))->do_relax
  25. #define canon_reloc_count(sec) \
  26. ((struct _bfd_sparc_elf_section_data *) elf_section_data (sec))->reloc_count
  27. struct _bfd_sparc_elf_app_reg
  28. {
  29. unsigned char bind;
  30. unsigned short shndx;
  31. bfd *abfd;
  32. char *name;
  33. };
  34. /* Sparc ELF linker hash table. */
  35. struct _bfd_sparc_elf_link_hash_table
  36. {
  37. struct elf_link_hash_table elf;
  38. /* Short-cuts to get to dynamic linker sections. */
  39. asection *sdynbss;
  40. asection *srelbss;
  41. union
  42. {
  43. bfd_signed_vma refcount;
  44. bfd_vma offset;
  45. } tls_ldm_got;
  46. /* Small local sym cache. */
  47. struct sym_cache sym_cache;
  48. /* Used by local STT_GNU_IFUNC symbols. */
  49. htab_t loc_hash_table;
  50. void *loc_hash_memory;
  51. /* True if the target system is VxWorks. */
  52. int is_vxworks;
  53. /* The (unloaded but important) .rela.plt.unloaded section, for VxWorks. */
  54. asection *srelplt2;
  55. void (*put_word) (bfd *, bfd_vma, void *);
  56. bfd_vma (*r_info) (Elf_Internal_Rela *, bfd_vma, bfd_vma);
  57. bfd_vma (*r_symndx) (bfd_vma);
  58. int (*build_plt_entry) (bfd *, asection *, bfd_vma, bfd_vma, bfd_vma *);
  59. const char *dynamic_interpreter;
  60. int dynamic_interpreter_size;
  61. unsigned int word_align_power;
  62. unsigned int align_power_max;
  63. unsigned int plt_header_size;
  64. unsigned int plt_entry_size;
  65. int bytes_per_word;
  66. int bytes_per_rela;
  67. int dtpoff_reloc;
  68. int dtpmod_reloc;
  69. int tpoff_reloc;
  70. struct _bfd_sparc_elf_app_reg app_regs [4];
  71. };
  72. /* Get the SPARC ELF linker hash table from a link_info structure. */
  73. #define _bfd_sparc_elf_hash_table(p) \
  74. (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
  75. == SPARC_ELF_DATA ? ((struct _bfd_sparc_elf_link_hash_table *) ((p)->hash)) : NULL)
  76. extern reloc_howto_type *_bfd_sparc_elf_reloc_type_lookup
  77. (bfd *, bfd_reloc_code_real_type);
  78. extern reloc_howto_type *_bfd_sparc_elf_reloc_name_lookup
  79. (bfd *, const char *);
  80. extern void _bfd_sparc_elf_info_to_howto
  81. (bfd *, arelent *, Elf_Internal_Rela *);
  82. extern reloc_howto_type *_bfd_sparc_elf_info_to_howto_ptr
  83. (unsigned int);
  84. extern bfd_boolean _bfd_sparc_elf_mkobject
  85. (bfd *);
  86. extern struct bfd_link_hash_table *_bfd_sparc_elf_link_hash_table_create
  87. (bfd *);
  88. extern bfd_boolean _bfd_sparc_elf_create_dynamic_sections
  89. (bfd *, struct bfd_link_info *);
  90. extern void _bfd_sparc_elf_copy_indirect_symbol
  91. (struct bfd_link_info *,
  92. struct elf_link_hash_entry *,
  93. struct elf_link_hash_entry *);
  94. extern bfd_boolean _bfd_sparc_elf_check_relocs
  95. (bfd *, struct bfd_link_info *,
  96. asection *, const Elf_Internal_Rela *);
  97. extern asection *_bfd_sparc_elf_gc_mark_hook
  98. (asection *, struct bfd_link_info *,
  99. Elf_Internal_Rela *, struct elf_link_hash_entry *,
  100. Elf_Internal_Sym *);
  101. extern bfd_boolean _bfd_sparc_elf_gc_sweep_hook
  102. (bfd *, struct bfd_link_info *,
  103. asection *, const Elf_Internal_Rela *);
  104. extern bfd_boolean _bfd_sparc_elf_adjust_dynamic_symbol
  105. (struct bfd_link_info *, struct elf_link_hash_entry *);
  106. extern bfd_boolean _bfd_sparc_elf_omit_section_dynsym
  107. (bfd *, struct bfd_link_info *, asection *);
  108. extern bfd_boolean _bfd_sparc_elf_size_dynamic_sections
  109. (bfd *, struct bfd_link_info *);
  110. extern bfd_boolean _bfd_sparc_elf_new_section_hook
  111. (bfd *, asection *);
  112. extern bfd_boolean _bfd_sparc_elf_relax_section
  113. (bfd *, struct bfd_section *, struct bfd_link_info *, bfd_boolean *);
  114. extern bfd_boolean _bfd_sparc_elf_relocate_section
  115. (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
  116. Elf_Internal_Rela *, Elf_Internal_Sym *, asection **);
  117. extern bfd_boolean _bfd_sparc_elf_finish_dynamic_symbol
  118. (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
  119. Elf_Internal_Sym *sym);
  120. extern bfd_boolean _bfd_sparc_elf_finish_dynamic_sections
  121. (bfd *, struct bfd_link_info *);
  122. extern bfd_boolean _bfd_sparc_elf_object_p
  123. (bfd *);
  124. extern bfd_vma _bfd_sparc_elf_plt_sym_val
  125. (bfd_vma, const asection *, const arelent *);
  126. extern bfd_boolean _bfd_sparc_elf_merge_private_bfd_data
  127. (bfd *, bfd *);