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