Commit | Line | Data |
---|---|---|
3adad029 | 1 | /* Target definitions for 64-bit ELF |
dfc1c006 | 2 | Copyright 1993, 1994 Free Software Foundation, Inc. |
3adad029 KR |
3 | |
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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
19 | ||
20 | /* This structure contains everything that BFD knows about a target. | |
21 | It includes things like its byte order, name, what routines to call | |
22 | to do various operations, etc. Every BFD points to a target structure | |
23 | with its "xvec" member. | |
24 | ||
25 | There are two such structures here: one for big-endian machines and | |
26 | one for little-endian machines. */ | |
27 | ||
6812b607 ILT |
28 | #define bfd_elf64_close_and_cleanup _bfd_generic_close_and_cleanup |
29 | #define bfd_elf64_bfd_free_cached_info _bfd_generic_bfd_free_cached_info | |
30 | #ifndef bfd_elf64_get_section_contents | |
31 | #define bfd_elf64_get_section_contents _bfd_generic_get_section_contents | |
3adad029 | 32 | #endif |
3adad029 KR |
33 | |
34 | #define bfd_elf64_bfd_debug_info_start bfd_void | |
35 | #define bfd_elf64_bfd_debug_info_end bfd_void | |
36 | #define bfd_elf64_bfd_debug_info_accumulate (PROTO(void,(*),(bfd*, struct sec *))) bfd_void | |
37 | #define bfd_elf64_bfd_get_relocated_section_contents \ | |
38 | bfd_generic_get_relocated_section_contents | |
39 | #define bfd_elf64_bfd_relax_section bfd_generic_relax_section | |
3adad029 KR |
40 | #define bfd_elf64_bfd_make_debug_symbol \ |
41 | ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr) | |
42 | ||
5b3577cb JL |
43 | #ifndef bfd_elf64_bfd_copy_private_section_data |
44 | #define bfd_elf64_bfd_copy_private_section_data \ | |
45 | ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true) | |
46 | #endif | |
47 | #ifndef bfd_elf64_bfd_copy_private_bfd_data | |
48 | #define bfd_elf64_bfd_copy_private_bfd_data \ | |
49 | ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true) | |
50 | #endif | |
5b3577cb JL |
51 | #ifndef bfd_elf64_bfd_is_local_label |
52 | #define bfd_elf64_bfd_is_local_label bfd_generic_is_local_label | |
53 | #endif | |
54 | ||
cb71adf1 PS |
55 | #ifndef bfd_elf64_get_dynamic_reloc_upper_bound |
56 | #define bfd_elf64_get_dynamic_reloc_upper_bound \ | |
57 | _bfd_nodynamic_get_dynamic_reloc_upper_bound | |
58 | #endif | |
59 | #ifndef bfd_elf64_canonicalize_dynamic_reloc | |
60 | #define bfd_elf64_canonicalize_dynamic_reloc \ | |
61 | _bfd_nodynamic_canonicalize_dynamic_reloc | |
62 | #endif | |
63 | ||
6ec3bb6a ILT |
64 | #ifdef elf_backend_relocate_section |
65 | #ifndef bfd_elf64_bfd_link_hash_table_create | |
66 | #define bfd_elf64_bfd_link_hash_table_create _bfd_elf_link_hash_table_create | |
67 | #endif | |
68 | #else /* ! defined (elf_backend_relocate_section) */ | |
69 | /* If no backend relocate_section routine, use the generic linker. */ | |
70 | #ifndef bfd_elf64_bfd_link_hash_table_create | |
71 | #define bfd_elf64_bfd_link_hash_table_create \ | |
72 | _bfd_generic_link_hash_table_create | |
73 | #endif | |
74 | #ifndef bfd_elf64_bfd_link_add_symbols | |
75 | #define bfd_elf64_bfd_link_add_symbols _bfd_generic_link_add_symbols | |
76 | #endif | |
77 | #ifndef bfd_elf64_bfd_final_link | |
78 | #define bfd_elf64_bfd_final_link _bfd_generic_final_link | |
79 | #endif | |
80 | #endif /* ! defined (elf_backend_relocate_section) */ | |
81 | ||
b3024965 KR |
82 | #ifndef elf_info_to_howto_rel |
83 | #define elf_info_to_howto_rel 0 | |
84 | #endif | |
85 | ||
86 | #ifndef ELF_MAXPAGESIZE | |
87 | #define ELF_MAXPAGESIZE 1 | |
88 | #endif | |
89 | ||
6ec3bb6a ILT |
90 | #ifndef elf_backend_collect |
91 | #define elf_backend_collect false | |
92 | #endif | |
93 | ||
643e9fc7 ILT |
94 | #ifndef elf_backend_sym_is_global |
95 | #define elf_backend_sym_is_global 0 | |
96 | #endif | |
a5ccdad1 | 97 | #ifndef elf_backend_object_p |
643e9fc7 | 98 | #define elf_backend_object_p 0 |
a5ccdad1 | 99 | #endif |
95469b02 | 100 | #ifndef elf_backend_symbol_processing |
643e9fc7 | 101 | #define elf_backend_symbol_processing 0 |
95469b02 ILT |
102 | #endif |
103 | #ifndef elf_backend_symbol_table_processing | |
643e9fc7 | 104 | #define elf_backend_symbol_table_processing 0 |
95469b02 ILT |
105 | #endif |
106 | #ifndef elf_backend_section_processing | |
643e9fc7 | 107 | #define elf_backend_section_processing 0 |
95469b02 ILT |
108 | #endif |
109 | #ifndef elf_backend_section_from_shdr | |
643e9fc7 | 110 | #define elf_backend_section_from_shdr 0 |
95469b02 ILT |
111 | #endif |
112 | #ifndef elf_backend_fake_sections | |
643e9fc7 | 113 | #define elf_backend_fake_sections 0 |
95469b02 ILT |
114 | #endif |
115 | #ifndef elf_backend_section_from_bfd_section | |
643e9fc7 ILT |
116 | #define elf_backend_section_from_bfd_section 0 |
117 | #endif | |
6ec3bb6a ILT |
118 | #ifndef elf_backend_add_symbol_hook |
119 | #define elf_backend_add_symbol_hook 0 | |
120 | #endif | |
ff5a090f JL |
121 | #ifndef elf_backend_link_output_symbol_hook |
122 | #define elf_backend_link_output_symbol_hook 0 | |
123 | #endif | |
013dec1a ILT |
124 | #ifndef elf_backend_create_dynamic_sections |
125 | #define elf_backend_create_dynamic_sections 0 | |
126 | #endif | |
127 | #ifndef elf_backend_adjust_dynamic_symbol | |
128 | #define elf_backend_adjust_dynamic_symbol 0 | |
129 | #endif | |
130 | #ifndef elf_backend_size_dynamic_sections | |
131 | #define elf_backend_size_dynamic_sections 0 | |
132 | #endif | |
6ec3bb6a ILT |
133 | #ifndef elf_backend_relocate_section |
134 | #define elf_backend_relocate_section 0 | |
135 | #endif | |
013dec1a ILT |
136 | #ifndef elf_backend_finish_dynamic_symbol |
137 | #define elf_backend_finish_dynamic_symbol 0 | |
138 | #endif | |
139 | #ifndef elf_backend_finish_dynamic_sections | |
140 | #define elf_backend_finish_dynamic_sections 0 | |
141 | #endif | |
99a6c761 JL |
142 | #ifndef elf_backend_begin_write_processing |
143 | #define elf_backend_begin_write_processing 0 | |
144 | #endif | |
643e9fc7 ILT |
145 | #ifndef elf_backend_final_write_processing |
146 | #define elf_backend_final_write_processing 0 | |
95469b02 ILT |
147 | #endif |
148 | #ifndef elf_backend_ecoff_debug_swap | |
643e9fc7 | 149 | #define elf_backend_ecoff_debug_swap 0 |
95469b02 ILT |
150 | #endif |
151 | ||
3adad029 KR |
152 | static CONST struct elf_backend_data elf64_bed = |
153 | { | |
154 | #ifdef USE_REL | |
155 | 0, /* use_rela_p */ | |
156 | #else | |
157 | 1, /* use_rela_p */ | |
158 | #endif | |
95469b02 | 159 | 1, /* elf_64_p */ |
3adad029 | 160 | ELF_ARCH, /* arch */ |
a5ccdad1 | 161 | ELF_MACHINE_CODE, /* elf_machine_code */ |
95469b02 | 162 | ELF_MAXPAGESIZE, /* maxpagesize */ |
6ec3bb6a | 163 | elf_backend_collect, |
643e9fc7 ILT |
164 | elf_info_to_howto, |
165 | elf_info_to_howto_rel, | |
166 | elf_backend_sym_is_global, | |
167 | elf_backend_object_p, | |
168 | elf_backend_symbol_processing, | |
169 | elf_backend_symbol_table_processing, | |
170 | elf_backend_section_processing, | |
171 | elf_backend_section_from_shdr, | |
172 | elf_backend_fake_sections, | |
173 | elf_backend_section_from_bfd_section, | |
6ec3bb6a | 174 | elf_backend_add_symbol_hook, |
ff5a090f | 175 | elf_backend_link_output_symbol_hook, |
013dec1a ILT |
176 | elf_backend_create_dynamic_sections, |
177 | elf_backend_adjust_dynamic_symbol, | |
178 | elf_backend_size_dynamic_sections, | |
6ec3bb6a | 179 | elf_backend_relocate_section, |
013dec1a ILT |
180 | elf_backend_finish_dynamic_symbol, |
181 | elf_backend_finish_dynamic_sections, | |
99a6c761 JL |
182 | elf_backend_begin_write_processing, |
183 | elf_backend_final_write_processing, | |
643e9fc7 | 184 | elf_backend_ecoff_debug_swap |
3adad029 KR |
185 | }; |
186 | ||
187 | #ifdef TARGET_BIG_SYM | |
2f3508ad | 188 | const bfd_target TARGET_BIG_SYM = |
3adad029 KR |
189 | { |
190 | /* name: identify kind of target */ | |
191 | TARGET_BIG_NAME, | |
192 | ||
193 | /* flavour: general indication about file */ | |
194 | bfd_target_elf_flavour, | |
195 | ||
196 | /* byteorder_big_p: data is big endian */ | |
197 | true, | |
198 | ||
199 | /* header_byteorder_big_p: header is also big endian */ | |
200 | true, | |
201 | ||
202 | /* object_flags: mask of all file flags */ | |
203 | (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS | | |
fa15568a | 204 | DYNAMIC | WP_TEXT | D_PAGED), |
3adad029 KR |
205 | |
206 | /* section_flags: mask of all section flags */ | |
207 | (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY | | |
d6e5f950 | 208 | SEC_CODE | SEC_DATA | SEC_DEBUGGING), |
3adad029 KR |
209 | |
210 | /* leading_symbol_char: is the first char of a user symbol | |
211 | predictable, and if so what is it */ | |
212 | 0, | |
213 | ||
214 | /* ar_pad_char: pad character for filenames within an archive header | |
215 | FIXME: this really has nothing to do with ELF, this is a characteristic | |
216 | of the archiver and/or os and should be independently tunable */ | |
217 | '/', | |
218 | ||
219 | /* ar_max_namelen: maximum number of characters in an archive header | |
220 | FIXME: this really has nothing to do with ELF, this is a characteristic | |
221 | of the archiver and should be independently tunable. This value is | |
222 | a WAG (wild a** guess) */ | |
7a0c782d | 223 | 14, |
3adad029 KR |
224 | |
225 | /* align_power_min: minimum alignment restriction for any section | |
226 | FIXME: this value may be target machine dependent */ | |
227 | 3, | |
228 | ||
229 | /* Routines to byte-swap various sized integers from the data sections */ | |
23f44e6f ILT |
230 | bfd_getb64, bfd_getb_signed_64, bfd_putb64, |
231 | bfd_getb32, bfd_getb_signed_32, bfd_putb32, | |
232 | bfd_getb16, bfd_getb_signed_16, bfd_putb16, | |
3adad029 KR |
233 | |
234 | /* Routines to byte-swap various sized integers from the file headers */ | |
23f44e6f ILT |
235 | bfd_getb64, bfd_getb_signed_64, bfd_putb64, |
236 | bfd_getb32, bfd_getb_signed_32, bfd_putb32, | |
237 | bfd_getb16, bfd_getb_signed_16, bfd_putb16, | |
3adad029 KR |
238 | |
239 | /* bfd_check_format: check the format of a file being read */ | |
240 | { _bfd_dummy_target, /* unknown format */ | |
241 | bfd_elf64_object_p, /* assembler/linker output (object file) */ | |
242 | bfd_generic_archive_p, /* an archive */ | |
243 | bfd_elf64_core_file_p /* a core file */ | |
244 | }, | |
245 | ||
246 | /* bfd_set_format: set the format of a file being written */ | |
247 | { bfd_false, | |
248 | bfd_elf_mkobject, | |
249 | _bfd_generic_mkarchive, | |
250 | bfd_false | |
251 | }, | |
252 | ||
253 | /* bfd_write_contents: write cached information into a file being written */ | |
254 | { bfd_false, | |
255 | bfd_elf64_write_object_contents, | |
256 | _bfd_write_archive_contents, | |
257 | bfd_false | |
258 | }, | |
259 | ||
6812b607 ILT |
260 | BFD_JUMP_TABLE_GENERIC (bfd_elf64), |
261 | BFD_JUMP_TABLE_COPY (bfd_elf64), | |
262 | BFD_JUMP_TABLE_CORE (bfd_elf64), | |
263 | BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), | |
264 | BFD_JUMP_TABLE_SYMBOLS (bfd_elf64), | |
265 | BFD_JUMP_TABLE_RELOCS (bfd_elf64), | |
266 | BFD_JUMP_TABLE_WRITE (bfd_elf64), | |
267 | BFD_JUMP_TABLE_LINK (bfd_elf64), | |
cb71adf1 | 268 | BFD_JUMP_TABLE_DYNAMIC (bfd_elf64), |
3adad029 KR |
269 | |
270 | /* backend_data: */ | |
271 | (PTR) &elf64_bed, | |
272 | }; | |
273 | #endif | |
274 | ||
275 | #ifdef TARGET_LITTLE_SYM | |
2f3508ad | 276 | const bfd_target TARGET_LITTLE_SYM = |
3adad029 KR |
277 | { |
278 | /* name: identify kind of target */ | |
279 | TARGET_LITTLE_NAME, | |
280 | ||
281 | /* flavour: general indication about file */ | |
282 | bfd_target_elf_flavour, | |
283 | ||
284 | /* byteorder_big_p: data is big endian */ | |
285 | false, /* Nope -- this one's little endian */ | |
286 | ||
287 | /* header_byteorder_big_p: header is also big endian */ | |
288 | false, /* Nope -- this one's little endian */ | |
289 | ||
290 | /* object_flags: mask of all file flags */ | |
291 | (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS | | |
fa15568a | 292 | DYNAMIC | WP_TEXT | D_PAGED), |
3adad029 KR |
293 | |
294 | /* section_flags: mask of all section flags */ | |
295 | (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY | | |
d6e5f950 | 296 | SEC_CODE | SEC_DATA | SEC_DEBUGGING), |
3adad029 KR |
297 | |
298 | /* leading_symbol_char: is the first char of a user symbol | |
299 | predictable, and if so what is it */ | |
300 | 0, | |
301 | ||
302 | /* ar_pad_char: pad character for filenames within an archive header | |
303 | FIXME: this really has nothing to do with ELF, this is a characteristic | |
304 | of the archiver and/or os and should be independently tunable */ | |
305 | '/', | |
306 | ||
307 | /* ar_max_namelen: maximum number of characters in an archive header | |
308 | FIXME: this really has nothing to do with ELF, this is a characteristic | |
309 | of the archiver and should be independently tunable. This value is | |
310 | a WAG (wild a** guess) */ | |
7a0c782d | 311 | 14, |
3adad029 KR |
312 | |
313 | /* align_power_min: minimum alignment restriction for any section | |
314 | FIXME: this value may be target machine dependent */ | |
315 | 3, | |
316 | ||
317 | /* Routines to byte-swap various sized integers from the data sections */ | |
23f44e6f ILT |
318 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, |
319 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, | |
320 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, | |
3adad029 KR |
321 | |
322 | /* Routines to byte-swap various sized integers from the file headers */ | |
23f44e6f ILT |
323 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, |
324 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, | |
325 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, | |
3adad029 KR |
326 | |
327 | /* bfd_check_format: check the format of a file being read */ | |
328 | { _bfd_dummy_target, /* unknown format */ | |
329 | bfd_elf64_object_p, /* assembler/linker output (object file) */ | |
330 | bfd_generic_archive_p, /* an archive */ | |
331 | bfd_elf64_core_file_p /* a core file */ | |
332 | }, | |
333 | ||
334 | /* bfd_set_format: set the format of a file being written */ | |
335 | { bfd_false, | |
336 | bfd_elf_mkobject, | |
337 | _bfd_generic_mkarchive, | |
338 | bfd_false | |
339 | }, | |
340 | ||
341 | /* bfd_write_contents: write cached information into a file being written */ | |
342 | { bfd_false, | |
343 | bfd_elf64_write_object_contents, | |
344 | _bfd_write_archive_contents, | |
345 | bfd_false | |
346 | }, | |
347 | ||
6812b607 ILT |
348 | BFD_JUMP_TABLE_GENERIC (bfd_elf64), |
349 | BFD_JUMP_TABLE_COPY (bfd_elf64), | |
350 | BFD_JUMP_TABLE_CORE (bfd_elf64), | |
351 | BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), | |
352 | BFD_JUMP_TABLE_SYMBOLS (bfd_elf64), | |
353 | BFD_JUMP_TABLE_RELOCS (bfd_elf64), | |
354 | BFD_JUMP_TABLE_WRITE (bfd_elf64), | |
355 | BFD_JUMP_TABLE_LINK (bfd_elf64), | |
cb71adf1 | 356 | BFD_JUMP_TABLE_DYNAMIC (bfd_elf64), |
3adad029 KR |
357 | |
358 | /* backend_data: */ | |
359 | (PTR) &elf64_bed, | |
360 | }; | |
361 | #endif |