elfxx-sparc.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /* SPARC ELF specific backend routines.
  2. Copyright (C) 2005-2022 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-cut to get to dynamic linker sections. */
  39. asection *interp;
  40. union
  41. {
  42. bfd_signed_vma refcount;
  43. bfd_vma offset;
  44. } tls_ldm_got;
  45. /* Used by local STT_GNU_IFUNC symbols. */
  46. htab_t loc_hash_table;
  47. void *loc_hash_memory;
  48. /* The (unloaded but important) .rela.plt.unloaded section, for VxWorks. */
  49. asection *srelplt2;
  50. void (*put_word) (bfd *, bfd_vma, void *);
  51. bfd_vma (*r_info) (Elf_Internal_Rela *, bfd_vma, bfd_vma);
  52. bfd_vma (*r_symndx) (bfd_vma);
  53. int (*build_plt_entry) (bfd *, asection *, bfd_vma, bfd_vma, bfd_vma *);
  54. const char *dynamic_interpreter;
  55. int dynamic_interpreter_size;
  56. unsigned int word_align_power;
  57. unsigned int align_power_max;
  58. unsigned int plt_header_size;
  59. unsigned int plt_entry_size;
  60. int bytes_per_word;
  61. int bytes_per_rela;
  62. int dtpoff_reloc;
  63. int dtpmod_reloc;
  64. int tpoff_reloc;
  65. struct _bfd_sparc_elf_app_reg app_regs [4];
  66. };
  67. /* Get the SPARC ELF linker hash table from a link_info structure. */
  68. #define _bfd_sparc_elf_hash_table(p) \
  69. ((is_elf_hash_table ((p)->hash) \
  70. && elf_hash_table_id (elf_hash_table (p)) == SPARC_ELF_DATA) \
  71. ? (struct _bfd_sparc_elf_link_hash_table *) (p)->hash : NULL)
  72. extern reloc_howto_type *_bfd_sparc_elf_reloc_type_lookup
  73. (bfd *, bfd_reloc_code_real_type);
  74. extern reloc_howto_type *_bfd_sparc_elf_reloc_name_lookup
  75. (bfd *, const char *);
  76. extern bool _bfd_sparc_elf_info_to_howto
  77. (bfd *, arelent *, Elf_Internal_Rela *);
  78. extern reloc_howto_type *_bfd_sparc_elf_info_to_howto_ptr
  79. (bfd*, unsigned int);
  80. extern bool _bfd_sparc_elf_mkobject
  81. (bfd *);
  82. extern struct bfd_link_hash_table *_bfd_sparc_elf_link_hash_table_create
  83. (bfd *);
  84. extern bool _bfd_sparc_elf_create_dynamic_sections
  85. (bfd *, struct bfd_link_info *);
  86. extern void _bfd_sparc_elf_copy_indirect_symbol
  87. (struct bfd_link_info *,
  88. struct elf_link_hash_entry *,
  89. struct elf_link_hash_entry *);
  90. extern bool _bfd_sparc_elf_check_relocs
  91. (bfd *, struct bfd_link_info *,
  92. asection *, const Elf_Internal_Rela *);
  93. extern asection *_bfd_sparc_elf_gc_mark_hook
  94. (asection *, struct bfd_link_info *,
  95. Elf_Internal_Rela *, struct elf_link_hash_entry *,
  96. Elf_Internal_Sym *);
  97. extern bool _bfd_sparc_elf_adjust_dynamic_symbol
  98. (struct bfd_link_info *, struct elf_link_hash_entry *);
  99. extern bool _bfd_sparc_elf_omit_section_dynsym
  100. (bfd *, struct bfd_link_info *, asection *);
  101. extern bool _bfd_sparc_elf_size_dynamic_sections
  102. (bfd *, struct bfd_link_info *);
  103. extern bool _bfd_sparc_elf_new_section_hook
  104. (bfd *, asection *);
  105. extern bool _bfd_sparc_elf_relax_section
  106. (bfd *, struct bfd_section *, struct bfd_link_info *, bool *);
  107. extern int _bfd_sparc_elf_relocate_section
  108. (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
  109. Elf_Internal_Rela *, Elf_Internal_Sym *, asection **);
  110. extern bool _bfd_sparc_elf_finish_dynamic_symbol
  111. (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
  112. Elf_Internal_Sym *sym);
  113. extern bool _bfd_sparc_elf_finish_dynamic_sections
  114. (bfd *, struct bfd_link_info *);
  115. extern bool _bfd_sparc_elf_fixup_symbol
  116. (struct bfd_link_info *, struct elf_link_hash_entry *);
  117. extern bool _bfd_sparc_elf_object_p
  118. (bfd *);
  119. extern bfd_vma _bfd_sparc_elf_plt_sym_val
  120. (bfd_vma, const asection *, const arelent *);
  121. extern bool _bfd_sparc_elf_merge_private_bfd_data
  122. (bfd *, struct bfd_link_info *);