1 /* SPARC ELF specific backend routines.
2 Copyright 2005 Free Software Foundation, Inc.
4 This file is part of BFD, the Binary File Descriptor library.
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 2 of the License, or
9 (at your option) any later version.
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.
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, MA 02110-1301, USA. */
20 #include "elf/common.h"
21 #include "elf/internal.h"
23 struct _bfd_sparc_elf_section_data
25 struct bfd_elf_section_data elf;
26 unsigned int do_relax, reloc_count;
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
34 struct _bfd_sparc_elf_app_reg
42 /* Sparc ELF linker hash table. */
44 struct _bfd_sparc_elf_link_hash_table
46 struct elf_link_hash_table elf;
48 /* Short-cuts to get to dynamic linker sections. */
57 bfd_signed_vma refcount;
61 /* Small local sym to section mapping cache. */
62 struct sym_sec_cache sym_sec;
64 void (*put_word) (bfd *, bfd_vma, void *);
65 void (*append_rela) (bfd *, asection *, Elf_Internal_Rela *);
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;
79 struct _bfd_sparc_elf_app_reg app_regs [4];
82 /* Get the SPARC ELF linker hash table from a link_info structure. */
84 #define _bfd_sparc_elf_hash_table(p) \
85 ((struct _bfd_sparc_elf_link_hash_table *) ((p)->hash))
87 extern reloc_howto_type *_bfd_sparc_elf_reloc_type_lookup
88 (bfd *, bfd_reloc_code_real_type);
89 extern void _bfd_sparc_elf_info_to_howto
90 (bfd *, arelent *, Elf_Internal_Rela *);
91 extern reloc_howto_type *_bfd_sparc_elf_info_to_howto_ptr
93 extern bfd_boolean _bfd_sparc_elf_mkobject
95 extern struct bfd_link_hash_table *_bfd_sparc_elf_link_hash_table_create
97 extern bfd_boolean _bfd_sparc_elf_create_dynamic_sections
98 (bfd *, struct bfd_link_info *);
99 extern void _bfd_sparc_elf_copy_indirect_symbol
100 (struct bfd_link_info *,
101 struct elf_link_hash_entry *,
102 struct elf_link_hash_entry *);
103 extern bfd_boolean _bfd_sparc_elf_check_relocs
104 (bfd *, struct bfd_link_info *,
105 asection *, const Elf_Internal_Rela *);
106 extern asection *_bfd_sparc_elf_gc_mark_hook
107 (asection *, struct bfd_link_info *,
108 Elf_Internal_Rela *, struct elf_link_hash_entry *,
110 extern bfd_boolean _bfd_sparc_elf_gc_sweep_hook
111 (bfd *, struct bfd_link_info *,
112 asection *, const Elf_Internal_Rela *);
113 extern bfd_boolean _bfd_sparc_elf_adjust_dynamic_symbol
114 (struct bfd_link_info *, struct elf_link_hash_entry *);
115 extern bfd_boolean _bfd_sparc_elf_omit_section_dynsym
116 (bfd *, struct bfd_link_info *, asection *);
117 extern bfd_boolean _bfd_sparc_elf_size_dynamic_sections
118 (bfd *, struct bfd_link_info *);
119 extern bfd_boolean _bfd_sparc_elf_new_section_hook
121 extern bfd_boolean _bfd_sparc_elf_relax_section
122 (bfd *, struct bfd_section *, struct bfd_link_info *, bfd_boolean *);
123 extern bfd_boolean _bfd_sparc_elf_relocate_section
124 (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
125 Elf_Internal_Rela *, Elf_Internal_Sym *, asection **);
126 extern bfd_boolean _bfd_sparc_elf_finish_dynamic_symbol
127 (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
128 Elf_Internal_Sym *sym);
129 extern bfd_boolean _bfd_sparc_elf_finish_dynamic_sections
130 (bfd *, struct bfd_link_info *);
131 extern bfd_boolean _bfd_sparc_elf_object_p
133 extern bfd_vma _bfd_sparc_elf_plt_sym_val
134 (bfd_vma, const asection *, const arelent *);