]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - bfd/elfxx-target.h
fix crinfo swapping
[thirdparty/binutils-gdb.git] / bfd / elfxx-target.h
CommitLineData
b968e4f4
KR
1/* Target definitions for NN-bit ELF
2 Copyright 1993, 1994, 1995 Free Software Foundation, Inc.
3adad029
KR
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
4e98461f 18Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
3adad029
KR
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
b968e4f4
KR
28#define bfd_elfNN_close_and_cleanup _bfd_generic_close_and_cleanup
29#define bfd_elfNN_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
30#ifndef bfd_elfNN_get_section_contents
31#define bfd_elfNN_get_section_contents _bfd_generic_get_section_contents
3adad029 32#endif
3adad029 33
ede4eed4
KR
34#define bfd_elfNN_canonicalize_dynamic_symtab _bfd_elf_canonicalize_dynamic_symtab
35#define bfd_elfNN_canonicalize_reloc _bfd_elf_canonicalize_reloc
36#ifndef bfd_elfNN_find_nearest_line
37#define bfd_elfNN_find_nearest_line _bfd_elf_find_nearest_line
38#endif
4e98461f
SC
39#define bfd_elfNN_read_minisymbols _bfd_elf_read_minisymbols
40#define bfd_elfNN_minisymbol_to_symbol _bfd_elf_minisymbol_to_symbol
ede4eed4
KR
41#define bfd_elfNN_get_dynamic_symtab_upper_bound _bfd_elf_get_dynamic_symtab_upper_bound
42#define bfd_elfNN_get_lineno _bfd_elf_get_lineno
43#define bfd_elfNN_get_reloc_upper_bound _bfd_elf_get_reloc_upper_bound
44#define bfd_elfNN_get_symbol_info _bfd_elf_get_symbol_info
45#define bfd_elfNN_get_symtab _bfd_elf_get_symtab
46#define bfd_elfNN_get_symtab_upper_bound _bfd_elf_get_symtab_upper_bound
6ab826bd 47#if 0 /* done in elf-bfd.h */
ede4eed4
KR
48#define bfd_elfNN_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol
49#endif
50#define bfd_elfNN_make_empty_symbol _bfd_elf_make_empty_symbol
51#define bfd_elfNN_new_section_hook _bfd_elf_new_section_hook
52#define bfd_elfNN_set_arch_mach _bfd_elf_set_arch_mach
53#ifndef bfd_elfNN_set_section_contents
54#define bfd_elfNN_set_section_contents _bfd_elf_set_section_contents
55#endif
56#define bfd_elfNN_sizeof_headers _bfd_elf_sizeof_headers
57#define bfd_elfNN_write_object_contents _bfd_elf_write_object_contents
58
631b10f4
ILT
59#define bfd_elfNN_get_section_contents_in_window \
60 _bfd_generic_get_section_contents_in_window
61
ede4eed4
KR
62#ifndef elf_backend_want_got_plt
63#define elf_backend_want_got_plt 0
64#endif
65#ifndef elf_backend_plt_readonly
66#define elf_backend_plt_readonly 0
67#endif
68#ifndef elf_backend_want_plt_sym
69#define elf_backend_want_plt_sym 0
70#endif
71
6ab826bd
FF
72#ifndef elf_backend_want_hdr_in_seg
73#define elf_backend_want_hdr_in_seg 0
74#endif
75
b968e4f4
KR
76#define bfd_elfNN_bfd_debug_info_start bfd_void
77#define bfd_elfNN_bfd_debug_info_end bfd_void
78#define bfd_elfNN_bfd_debug_info_accumulate (PROTO(void,(*),(bfd*, struct sec *))) bfd_void
79
80#ifndef bfd_elfNN_bfd_get_relocated_section_contents
81#define bfd_elfNN_bfd_get_relocated_section_contents \
3adad029 82 bfd_generic_get_relocated_section_contents
b968e4f4
KR
83#endif
84
85#define bfd_elfNN_bfd_relax_section bfd_generic_relax_section
86#define bfd_elfNN_bfd_make_debug_symbol \
3adad029
KR
87 ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
88
b968e4f4
KR
89#ifndef bfd_elfNN_bfd_copy_private_symbol_data
90#define bfd_elfNN_bfd_copy_private_symbol_data \
631b10f4 91 _bfd_elf_copy_private_symbol_data
6167a840 92#endif
631b10f4 93
b968e4f4
KR
94#ifndef bfd_elfNN_bfd_copy_private_section_data
95#define bfd_elfNN_bfd_copy_private_section_data \
631b10f4 96 _bfd_elf_copy_private_section_data
5b3577cb 97#endif
b968e4f4
KR
98#ifndef bfd_elfNN_bfd_copy_private_bfd_data
99#define bfd_elfNN_bfd_copy_private_bfd_data \
5b3577cb
JL
100 ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
101#endif
4e98461f
SC
102#ifndef bfd_elfNN_bfd_print_private_bfd_data
103#define bfd_elfNN_bfd_print_private_bfd_data \
27fb8f29 104 _bfd_elf_print_private_bfd_data
4e98461f 105#endif
b968e4f4
KR
106#ifndef bfd_elfNN_bfd_merge_private_bfd_data
107#define bfd_elfNN_bfd_merge_private_bfd_data \
d5fb1e2a
MM
108 ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
109#endif
b968e4f4
KR
110#ifndef bfd_elfNN_bfd_set_private_flags
111#define bfd_elfNN_bfd_set_private_flags \
d5fb1e2a
MM
112 ((boolean (*) PARAMS ((bfd *, flagword))) bfd_true)
113#endif
b968e4f4
KR
114#ifndef bfd_elfNN_bfd_is_local_label
115#define bfd_elfNN_bfd_is_local_label bfd_generic_is_local_label
5b3577cb
JL
116#endif
117
b968e4f4
KR
118#ifndef bfd_elfNN_get_dynamic_reloc_upper_bound
119#define bfd_elfNN_get_dynamic_reloc_upper_bound \
cb71adf1
PS
120 _bfd_nodynamic_get_dynamic_reloc_upper_bound
121#endif
b968e4f4
KR
122#ifndef bfd_elfNN_canonicalize_dynamic_reloc
123#define bfd_elfNN_canonicalize_dynamic_reloc \
cb71adf1
PS
124 _bfd_nodynamic_canonicalize_dynamic_reloc
125#endif
126
6ec3bb6a 127#ifdef elf_backend_relocate_section
b968e4f4
KR
128#ifndef bfd_elfNN_bfd_link_hash_table_create
129#define bfd_elfNN_bfd_link_hash_table_create _bfd_elf_link_hash_table_create
6ec3bb6a
ILT
130#endif
131#else /* ! defined (elf_backend_relocate_section) */
132/* If no backend relocate_section routine, use the generic linker. */
b968e4f4
KR
133#ifndef bfd_elfNN_bfd_link_hash_table_create
134#define bfd_elfNN_bfd_link_hash_table_create \
6ec3bb6a
ILT
135 _bfd_generic_link_hash_table_create
136#endif
b968e4f4
KR
137#ifndef bfd_elfNN_bfd_link_add_symbols
138#define bfd_elfNN_bfd_link_add_symbols _bfd_generic_link_add_symbols
6ec3bb6a 139#endif
b968e4f4
KR
140#ifndef bfd_elfNN_bfd_final_link
141#define bfd_elfNN_bfd_final_link _bfd_generic_final_link
6ec3bb6a
ILT
142#endif
143#endif /* ! defined (elf_backend_relocate_section) */
b968e4f4
KR
144#ifndef bfd_elfNN_bfd_link_split_section
145#define bfd_elfNN_bfd_link_split_section _bfd_generic_link_split_section
6167a840 146#endif
6ec3bb6a 147
b3024965
KR
148#ifndef elf_info_to_howto_rel
149#define elf_info_to_howto_rel 0
150#endif
151
152#ifndef ELF_MAXPAGESIZE
153#define ELF_MAXPAGESIZE 1
154#endif
155
6ec3bb6a
ILT
156#ifndef elf_backend_collect
157#define elf_backend_collect false
158#endif
5b3b9ff6
ILT
159#ifndef elf_backend_type_change_ok
160#define elf_backend_type_change_ok false
161#endif
6ec3bb6a 162
643e9fc7
ILT
163#ifndef elf_backend_sym_is_global
164#define elf_backend_sym_is_global 0
165#endif
a5ccdad1 166#ifndef elf_backend_object_p
643e9fc7 167#define elf_backend_object_p 0
a5ccdad1 168#endif
95469b02 169#ifndef elf_backend_symbol_processing
643e9fc7 170#define elf_backend_symbol_processing 0
95469b02
ILT
171#endif
172#ifndef elf_backend_symbol_table_processing
643e9fc7 173#define elf_backend_symbol_table_processing 0
95469b02
ILT
174#endif
175#ifndef elf_backend_section_processing
643e9fc7 176#define elf_backend_section_processing 0
95469b02
ILT
177#endif
178#ifndef elf_backend_section_from_shdr
643e9fc7 179#define elf_backend_section_from_shdr 0
95469b02
ILT
180#endif
181#ifndef elf_backend_fake_sections
643e9fc7 182#define elf_backend_fake_sections 0
95469b02
ILT
183#endif
184#ifndef elf_backend_section_from_bfd_section
643e9fc7
ILT
185#define elf_backend_section_from_bfd_section 0
186#endif
6ec3bb6a
ILT
187#ifndef elf_backend_add_symbol_hook
188#define elf_backend_add_symbol_hook 0
189#endif
ff5a090f
JL
190#ifndef elf_backend_link_output_symbol_hook
191#define elf_backend_link_output_symbol_hook 0
192#endif
013dec1a
ILT
193#ifndef elf_backend_create_dynamic_sections
194#define elf_backend_create_dynamic_sections 0
195#endif
374d2ef9
ILT
196#ifndef elf_backend_check_relocs
197#define elf_backend_check_relocs 0
198#endif
013dec1a
ILT
199#ifndef elf_backend_adjust_dynamic_symbol
200#define elf_backend_adjust_dynamic_symbol 0
201#endif
202#ifndef elf_backend_size_dynamic_sections
203#define elf_backend_size_dynamic_sections 0
204#endif
6ec3bb6a
ILT
205#ifndef elf_backend_relocate_section
206#define elf_backend_relocate_section 0
207#endif
013dec1a
ILT
208#ifndef elf_backend_finish_dynamic_symbol
209#define elf_backend_finish_dynamic_symbol 0
210#endif
211#ifndef elf_backend_finish_dynamic_sections
212#define elf_backend_finish_dynamic_sections 0
213#endif
99a6c761
JL
214#ifndef elf_backend_begin_write_processing
215#define elf_backend_begin_write_processing 0
216#endif
643e9fc7
ILT
217#ifndef elf_backend_final_write_processing
218#define elf_backend_final_write_processing 0
95469b02 219#endif
5b3b9ff6
ILT
220#ifndef elf_backend_additional_program_headers
221#define elf_backend_additional_program_headers 0
222#endif
223#ifndef elf_backend_modify_segment_map
224#define elf_backend_modify_segment_map 0
6ab826bd 225#endif
95469b02 226#ifndef elf_backend_ecoff_debug_swap
643e9fc7 227#define elf_backend_ecoff_debug_swap 0
95469b02
ILT
228#endif
229
8c9bfee3
MM
230#ifndef ELF_MACHINE_ALT1
231#define ELF_MACHINE_ALT1 0
232#endif
233
234#ifndef ELF_MACHINE_ALT2
235#define ELF_MACHINE_ALT2 0
236#endif
237
ede4eed4
KR
238extern const struct elf_size_info _bfd_elfNN_size_info;
239
b968e4f4 240static CONST struct elf_backend_data elfNN_bed =
3adad029
KR
241{
242#ifdef USE_REL
243 0, /* use_rela_p */
244#else
245 1, /* use_rela_p */
b968e4f4 246#endif
3adad029 247 ELF_ARCH, /* arch */
a5ccdad1 248 ELF_MACHINE_CODE, /* elf_machine_code */
95469b02 249 ELF_MAXPAGESIZE, /* maxpagesize */
6ec3bb6a 250 elf_backend_collect,
5b3b9ff6 251 elf_backend_type_change_ok,
643e9fc7
ILT
252 elf_info_to_howto,
253 elf_info_to_howto_rel,
254 elf_backend_sym_is_global,
255 elf_backend_object_p,
256 elf_backend_symbol_processing,
257 elf_backend_symbol_table_processing,
258 elf_backend_section_processing,
259 elf_backend_section_from_shdr,
260 elf_backend_fake_sections,
261 elf_backend_section_from_bfd_section,
6ec3bb6a 262 elf_backend_add_symbol_hook,
ff5a090f 263 elf_backend_link_output_symbol_hook,
013dec1a 264 elf_backend_create_dynamic_sections,
374d2ef9 265 elf_backend_check_relocs,
013dec1a
ILT
266 elf_backend_adjust_dynamic_symbol,
267 elf_backend_size_dynamic_sections,
6ec3bb6a 268 elf_backend_relocate_section,
013dec1a
ILT
269 elf_backend_finish_dynamic_symbol,
270 elf_backend_finish_dynamic_sections,
99a6c761
JL
271 elf_backend_begin_write_processing,
272 elf_backend_final_write_processing,
5b3b9ff6
ILT
273 elf_backend_additional_program_headers,
274 elf_backend_modify_segment_map,
8c9bfee3
MM
275 elf_backend_ecoff_debug_swap,
276 ELF_MACHINE_ALT1,
ede4eed4
KR
277 ELF_MACHINE_ALT2,
278 &_bfd_elfNN_size_info,
279 elf_backend_want_got_plt,
280 elf_backend_plt_readonly,
281 elf_backend_want_plt_sym,
6ab826bd 282 elf_backend_want_hdr_in_seg,
3adad029
KR
283};
284
285#ifdef TARGET_BIG_SYM
2f3508ad 286const bfd_target TARGET_BIG_SYM =
3adad029
KR
287{
288 /* name: identify kind of target */
289 TARGET_BIG_NAME,
290
291 /* flavour: general indication about file */
292 bfd_target_elf_flavour,
293
5b3b9ff6
ILT
294 /* byteorder: data is big endian */
295 BFD_ENDIAN_BIG,
3adad029 296
5b3b9ff6
ILT
297 /* header_byteorder: header is also big endian */
298 BFD_ENDIAN_BIG,
3adad029
KR
299
300 /* object_flags: mask of all file flags */
301 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
fa15568a 302 DYNAMIC | WP_TEXT | D_PAGED),
3adad029
KR
303
304 /* section_flags: mask of all section flags */
305 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
d6e5f950 306 SEC_CODE | SEC_DATA | SEC_DEBUGGING),
3adad029
KR
307
308 /* leading_symbol_char: is the first char of a user symbol
309 predictable, and if so what is it */
310 0,
311
312 /* ar_pad_char: pad character for filenames within an archive header
313 FIXME: this really has nothing to do with ELF, this is a characteristic
314 of the archiver and/or os and should be independently tunable */
315 '/',
316
317 /* ar_max_namelen: maximum number of characters in an archive header
318 FIXME: this really has nothing to do with ELF, this is a characteristic
319 of the archiver and should be independently tunable. This value is
320 a WAG (wild a** guess) */
7a0c782d 321 14,
3adad029 322
3adad029 323 /* Routines to byte-swap various sized integers from the data sections */
23f44e6f
ILT
324 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
325 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
326 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
3adad029
KR
327
328 /* Routines to byte-swap various sized integers from the file headers */
23f44e6f
ILT
329 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
330 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
331 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
3adad029
KR
332
333 /* bfd_check_format: check the format of a file being read */
334 { _bfd_dummy_target, /* unknown format */
b968e4f4 335 bfd_elfNN_object_p, /* assembler/linker output (object file) */
3adad029 336 bfd_generic_archive_p, /* an archive */
b968e4f4 337 bfd_elfNN_core_file_p /* a core file */
3adad029
KR
338 },
339
340 /* bfd_set_format: set the format of a file being written */
341 { bfd_false,
342 bfd_elf_mkobject,
343 _bfd_generic_mkarchive,
344 bfd_false
345 },
346
347 /* bfd_write_contents: write cached information into a file being written */
348 { bfd_false,
b968e4f4 349 bfd_elfNN_write_object_contents,
3adad029
KR
350 _bfd_write_archive_contents,
351 bfd_false
352 },
353
b968e4f4
KR
354 BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
355 BFD_JUMP_TABLE_COPY (bfd_elfNN),
356 BFD_JUMP_TABLE_CORE (bfd_elfNN),
6812b607 357 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
b968e4f4
KR
358 BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
359 BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
360 BFD_JUMP_TABLE_WRITE (bfd_elfNN),
361 BFD_JUMP_TABLE_LINK (bfd_elfNN),
362 BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
3adad029
KR
363
364 /* backend_data: */
b968e4f4 365 (PTR) &elfNN_bed,
3adad029
KR
366};
367#endif
368
369#ifdef TARGET_LITTLE_SYM
2f3508ad 370const bfd_target TARGET_LITTLE_SYM =
3adad029
KR
371{
372 /* name: identify kind of target */
373 TARGET_LITTLE_NAME,
374
375 /* flavour: general indication about file */
376 bfd_target_elf_flavour,
377
5b3b9ff6
ILT
378 /* byteorder: data is little endian */
379 BFD_ENDIAN_LITTLE,
3adad029 380
5b3b9ff6
ILT
381 /* header_byteorder: header is also little endian */
382 BFD_ENDIAN_LITTLE,
3adad029
KR
383
384 /* object_flags: mask of all file flags */
385 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
fa15568a 386 DYNAMIC | WP_TEXT | D_PAGED),
3adad029
KR
387
388 /* section_flags: mask of all section flags */
389 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
d6e5f950 390 SEC_CODE | SEC_DATA | SEC_DEBUGGING),
3adad029
KR
391
392 /* leading_symbol_char: is the first char of a user symbol
393 predictable, and if so what is it */
394 0,
395
396 /* ar_pad_char: pad character for filenames within an archive header
397 FIXME: this really has nothing to do with ELF, this is a characteristic
398 of the archiver and/or os and should be independently tunable */
399 '/',
400
401 /* ar_max_namelen: maximum number of characters in an archive header
402 FIXME: this really has nothing to do with ELF, this is a characteristic
403 of the archiver and should be independently tunable. This value is
404 a WAG (wild a** guess) */
7a0c782d 405 14,
3adad029 406
3adad029 407 /* Routines to byte-swap various sized integers from the data sections */
23f44e6f
ILT
408 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
409 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
410 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
3adad029
KR
411
412 /* Routines to byte-swap various sized integers from the file headers */
23f44e6f
ILT
413 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
414 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
415 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
3adad029
KR
416
417 /* bfd_check_format: check the format of a file being read */
418 { _bfd_dummy_target, /* unknown format */
b968e4f4 419 bfd_elfNN_object_p, /* assembler/linker output (object file) */
3adad029 420 bfd_generic_archive_p, /* an archive */
b968e4f4 421 bfd_elfNN_core_file_p /* a core file */
3adad029
KR
422 },
423
424 /* bfd_set_format: set the format of a file being written */
425 { bfd_false,
426 bfd_elf_mkobject,
427 _bfd_generic_mkarchive,
428 bfd_false
429 },
430
431 /* bfd_write_contents: write cached information into a file being written */
432 { bfd_false,
b968e4f4 433 bfd_elfNN_write_object_contents,
3adad029
KR
434 _bfd_write_archive_contents,
435 bfd_false
436 },
437
b968e4f4
KR
438 BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
439 BFD_JUMP_TABLE_COPY (bfd_elfNN),
440 BFD_JUMP_TABLE_CORE (bfd_elfNN),
6812b607 441 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
b968e4f4
KR
442 BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
443 BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
444 BFD_JUMP_TABLE_WRITE (bfd_elfNN),
445 BFD_JUMP_TABLE_LINK (bfd_elfNN),
446 BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
3adad029
KR
447
448 /* backend_data: */
b968e4f4 449 (PTR) &elfNN_bed,
3adad029
KR
450};
451#endif