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