1 |
24 |
jeremybenn |
/* SPARC ELF specific backend routines.
|
2 |
225 |
jeremybenn |
Copyright 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
|
3 |
24 |
jeremybenn |
|
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-cuts to get to dynamic linker sections. */
|
50 |
|
|
asection *sgot;
|
51 |
|
|
asection *srelgot;
|
52 |
|
|
asection *splt;
|
53 |
|
|
asection *srelplt;
|
54 |
|
|
asection *sdynbss;
|
55 |
|
|
asection *srelbss;
|
56 |
|
|
|
57 |
|
|
union {
|
58 |
|
|
bfd_signed_vma refcount;
|
59 |
|
|
bfd_vma offset;
|
60 |
|
|
} tls_ldm_got;
|
61 |
|
|
|
62 |
225 |
jeremybenn |
/* Small local sym cache. */
|
63 |
|
|
struct sym_cache sym_cache;
|
64 |
24 |
jeremybenn |
|
65 |
|
|
/* True if the target system is VxWorks. */
|
66 |
|
|
int is_vxworks;
|
67 |
|
|
|
68 |
|
|
/* The (unloaded but important) .rela.plt.unloaded section, for VxWorks. */
|
69 |
|
|
asection *srelplt2;
|
70 |
|
|
|
71 |
|
|
/* .got.plt is only used on VxWorks. */
|
72 |
|
|
asection *sgotplt;
|
73 |
|
|
|
74 |
|
|
void (*put_word) (bfd *, bfd_vma, void *);
|
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 |
|
|
|
98 |
|
|
extern reloc_howto_type *_bfd_sparc_elf_reloc_type_lookup
|
99 |
|
|
(bfd *, bfd_reloc_code_real_type);
|
100 |
|
|
extern reloc_howto_type *_bfd_sparc_elf_reloc_name_lookup
|
101 |
|
|
(bfd *, const char *);
|
102 |
|
|
extern void _bfd_sparc_elf_info_to_howto
|
103 |
|
|
(bfd *, arelent *, Elf_Internal_Rela *);
|
104 |
|
|
extern reloc_howto_type *_bfd_sparc_elf_info_to_howto_ptr
|
105 |
|
|
(unsigned int);
|
106 |
|
|
extern bfd_boolean _bfd_sparc_elf_mkobject
|
107 |
|
|
(bfd *);
|
108 |
|
|
extern struct bfd_link_hash_table *_bfd_sparc_elf_link_hash_table_create
|
109 |
|
|
(bfd *);
|
110 |
|
|
extern bfd_boolean _bfd_sparc_elf_create_dynamic_sections
|
111 |
|
|
(bfd *, struct bfd_link_info *);
|
112 |
|
|
extern void _bfd_sparc_elf_copy_indirect_symbol
|
113 |
|
|
(struct bfd_link_info *,
|
114 |
|
|
struct elf_link_hash_entry *,
|
115 |
|
|
struct elf_link_hash_entry *);
|
116 |
|
|
extern bfd_boolean _bfd_sparc_elf_check_relocs
|
117 |
|
|
(bfd *, struct bfd_link_info *,
|
118 |
|
|
asection *, const Elf_Internal_Rela *);
|
119 |
|
|
extern asection *_bfd_sparc_elf_gc_mark_hook
|
120 |
|
|
(asection *, struct bfd_link_info *,
|
121 |
|
|
Elf_Internal_Rela *, struct elf_link_hash_entry *,
|
122 |
|
|
Elf_Internal_Sym *);
|
123 |
|
|
extern bfd_boolean _bfd_sparc_elf_gc_sweep_hook
|
124 |
|
|
(bfd *, struct bfd_link_info *,
|
125 |
|
|
asection *, const Elf_Internal_Rela *);
|
126 |
|
|
extern bfd_boolean _bfd_sparc_elf_adjust_dynamic_symbol
|
127 |
|
|
(struct bfd_link_info *, struct elf_link_hash_entry *);
|
128 |
|
|
extern bfd_boolean _bfd_sparc_elf_omit_section_dynsym
|
129 |
|
|
(bfd *, struct bfd_link_info *, asection *);
|
130 |
|
|
extern bfd_boolean _bfd_sparc_elf_size_dynamic_sections
|
131 |
|
|
(bfd *, struct bfd_link_info *);
|
132 |
|
|
extern bfd_boolean _bfd_sparc_elf_new_section_hook
|
133 |
|
|
(bfd *, asection *);
|
134 |
|
|
extern bfd_boolean _bfd_sparc_elf_relax_section
|
135 |
|
|
(bfd *, struct bfd_section *, struct bfd_link_info *, bfd_boolean *);
|
136 |
|
|
extern bfd_boolean _bfd_sparc_elf_relocate_section
|
137 |
|
|
(bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
|
138 |
|
|
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **);
|
139 |
|
|
extern bfd_boolean _bfd_sparc_elf_finish_dynamic_symbol
|
140 |
|
|
(bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
|
141 |
|
|
Elf_Internal_Sym *sym);
|
142 |
|
|
extern bfd_boolean _bfd_sparc_elf_finish_dynamic_sections
|
143 |
|
|
(bfd *, struct bfd_link_info *);
|
144 |
|
|
extern bfd_boolean _bfd_sparc_elf_object_p
|
145 |
|
|
(bfd *);
|
146 |
|
|
extern bfd_vma _bfd_sparc_elf_plt_sym_val
|
147 |
|
|
(bfd_vma, const asection *, const arelent *);
|