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