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