* elf-bfd.h (struct elf_backend_data): New function pointer member
[external/binutils.git] / bfd / elfxx-target.h
1 /* Target definitions for NN-bit ELF
2    Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
3    2003 Free Software Foundation, Inc.
4
5    This file is part of BFD, the Binary File Descriptor library.
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
20
21 /* This structure contains everything that BFD knows about a target.
22    It includes things like its byte order, name, what routines to call
23    to do various operations, etc.  Every BFD points to a target structure
24    with its "xvec" member.
25
26    There are two such structures here:  one for big-endian machines and
27    one for little-endian machines.   */
28
29 #define bfd_elfNN_close_and_cleanup _bfd_elf_close_and_cleanup
30 #define bfd_elfNN_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
31 #ifndef bfd_elfNN_get_section_contents
32 #define bfd_elfNN_get_section_contents _bfd_generic_get_section_contents
33 #endif
34
35 #define bfd_elfNN_canonicalize_dynamic_symtab \
36   _bfd_elf_canonicalize_dynamic_symtab
37 #ifndef bfd_elfNN_canonicalize_reloc
38 #define bfd_elfNN_canonicalize_reloc    _bfd_elf_canonicalize_reloc
39 #endif
40 #ifndef bfd_elfNN_find_nearest_line
41 #define bfd_elfNN_find_nearest_line     _bfd_elf_find_nearest_line
42 #endif
43 #define bfd_elfNN_read_minisymbols      _bfd_elf_read_minisymbols
44 #define bfd_elfNN_minisymbol_to_symbol  _bfd_elf_minisymbol_to_symbol
45 #define bfd_elfNN_get_dynamic_symtab_upper_bound \
46   _bfd_elf_get_dynamic_symtab_upper_bound
47 #define bfd_elfNN_get_lineno            _bfd_elf_get_lineno
48 #ifndef bfd_elfNN_get_reloc_upper_bound
49 #define bfd_elfNN_get_reloc_upper_bound _bfd_elf_get_reloc_upper_bound
50 #endif
51 #ifndef bfd_elfNN_get_symbol_info
52 #define bfd_elfNN_get_symbol_info       _bfd_elf_get_symbol_info
53 #endif
54 #define bfd_elfNN_get_symtab            _bfd_elf_get_symtab
55 #define bfd_elfNN_get_symtab_upper_bound _bfd_elf_get_symtab_upper_bound
56 #define bfd_elfNN_make_empty_symbol     _bfd_elf_make_empty_symbol
57 #ifndef bfd_elfNN_new_section_hook
58 #define bfd_elfNN_new_section_hook      _bfd_elf_new_section_hook
59 #endif
60 #define bfd_elfNN_set_arch_mach         _bfd_elf_set_arch_mach
61 #ifndef bfd_elfNN_set_section_contents
62 #define bfd_elfNN_set_section_contents  _bfd_elf_set_section_contents
63 #endif
64 #define bfd_elfNN_sizeof_headers        _bfd_elf_sizeof_headers
65 #define bfd_elfNN_write_object_contents _bfd_elf_write_object_contents
66 #define bfd_elfNN_write_corefile_contents _bfd_elf_write_corefile_contents
67
68 #define bfd_elfNN_get_section_contents_in_window \
69   _bfd_generic_get_section_contents_in_window
70
71 #ifndef elf_backend_got_symbol_offset
72 #define elf_backend_got_symbol_offset (bfd_vma) 0
73 #endif
74 #ifndef elf_backend_can_refcount
75 #define elf_backend_can_refcount 0
76 #endif
77 #ifndef elf_backend_want_got_plt
78 #define elf_backend_want_got_plt 0
79 #endif
80 #ifndef elf_backend_plt_readonly
81 #define elf_backend_plt_readonly 0
82 #endif
83 #ifndef elf_backend_want_plt_sym
84 #define elf_backend_want_plt_sym 0
85 #endif
86 #ifndef elf_backend_plt_not_loaded
87 #define elf_backend_plt_not_loaded 0
88 #endif
89 #ifndef elf_backend_plt_alignment
90 #define elf_backend_plt_alignment 2
91 #endif
92 #ifndef elf_backend_want_dynbss
93 #define elf_backend_want_dynbss 1
94 #endif
95 #ifndef elf_backend_want_p_paddr_set_to_zero
96 #define elf_backend_want_p_paddr_set_to_zero 0
97 #endif
98
99 #define bfd_elfNN_bfd_debug_info_start  bfd_void
100 #define bfd_elfNN_bfd_debug_info_end    bfd_void
101 #define bfd_elfNN_bfd_debug_info_accumulate \
102   ((void (*) (bfd*, struct sec *)) bfd_void)
103
104 #ifndef bfd_elfNN_bfd_get_relocated_section_contents
105 #define bfd_elfNN_bfd_get_relocated_section_contents \
106   bfd_generic_get_relocated_section_contents
107 #endif
108
109 #ifndef bfd_elfNN_bfd_relax_section
110 #define bfd_elfNN_bfd_relax_section bfd_generic_relax_section
111 #endif
112
113 #ifndef elf_backend_can_gc_sections
114 #define elf_backend_can_gc_sections 0
115 #endif
116 #ifndef elf_backend_can_refcount
117 #define elf_backend_can_refcount 0
118 #endif
119 #ifndef elf_backend_want_got_sym
120 #define elf_backend_want_got_sym 1
121 #endif
122 #ifndef elf_backend_gc_mark_hook
123 #define elf_backend_gc_mark_hook        NULL
124 #endif
125 #ifndef elf_backend_gc_sweep_hook
126 #define elf_backend_gc_sweep_hook       NULL
127 #endif
128 #ifndef bfd_elfNN_bfd_gc_sections
129 #define bfd_elfNN_bfd_gc_sections _bfd_elfNN_gc_sections
130 #endif
131
132 #ifndef bfd_elfNN_bfd_merge_sections
133 #define bfd_elfNN_bfd_merge_sections \
134   _bfd_elf_merge_sections
135 #endif
136
137 #ifndef bfd_elfNN_bfd_discard_group
138 #define bfd_elfNN_bfd_discard_group bfd_elf_discard_group
139 #endif
140
141 #ifndef bfd_elfNN_bfd_make_debug_symbol
142 #define bfd_elfNN_bfd_make_debug_symbol \
143   ((asymbol * (*) (bfd *, void *, unsigned long)) bfd_nullvoidptr)
144 #endif
145
146 #ifndef bfd_elfNN_bfd_copy_private_symbol_data
147 #define bfd_elfNN_bfd_copy_private_symbol_data \
148   _bfd_elf_copy_private_symbol_data
149 #endif
150
151 #ifndef bfd_elfNN_bfd_copy_private_section_data
152 #define bfd_elfNN_bfd_copy_private_section_data \
153   _bfd_elf_copy_private_section_data
154 #endif
155 #ifndef bfd_elfNN_bfd_copy_private_bfd_data
156 #define bfd_elfNN_bfd_copy_private_bfd_data \
157   _bfd_elf_copy_private_bfd_data
158 #endif
159 #ifndef bfd_elfNN_bfd_print_private_bfd_data
160 #define bfd_elfNN_bfd_print_private_bfd_data \
161   _bfd_elf_print_private_bfd_data
162 #endif
163 #ifndef bfd_elfNN_bfd_merge_private_bfd_data
164 #define bfd_elfNN_bfd_merge_private_bfd_data \
165   ((bfd_boolean (*) (bfd *, bfd *)) bfd_true)
166 #endif
167 #ifndef bfd_elfNN_bfd_set_private_flags
168 #define bfd_elfNN_bfd_set_private_flags \
169   ((bfd_boolean (*) (bfd *, flagword)) bfd_true)
170 #endif
171 #ifndef bfd_elfNN_bfd_is_local_label_name
172 #define bfd_elfNN_bfd_is_local_label_name _bfd_elf_is_local_label_name
173 #endif
174
175 #ifndef bfd_elfNN_get_dynamic_reloc_upper_bound
176 #define bfd_elfNN_get_dynamic_reloc_upper_bound \
177   _bfd_elf_get_dynamic_reloc_upper_bound
178 #endif
179 #ifndef bfd_elfNN_canonicalize_dynamic_reloc
180 #define bfd_elfNN_canonicalize_dynamic_reloc \
181   _bfd_elf_canonicalize_dynamic_reloc
182 #endif
183
184 #ifndef bfd_elfNN_bfd_link_hash_table_free
185 #define bfd_elfNN_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
186 #endif
187
188 #ifdef elf_backend_relocate_section
189 #ifndef bfd_elfNN_bfd_link_hash_table_create
190 #define bfd_elfNN_bfd_link_hash_table_create _bfd_elf_link_hash_table_create
191 #endif
192 #else /* ! defined (elf_backend_relocate_section) */
193 /* If no backend relocate_section routine, use the generic linker.
194    Note - this will prevent the port from being able to use some of
195    the other features of the ELF linker, because the generic hash structure
196    does not have the fields needed by the ELF linker.  In particular it
197    means that linking directly to S-records will not work.  */
198 #ifndef bfd_elfNN_bfd_link_hash_table_create
199 #define bfd_elfNN_bfd_link_hash_table_create \
200   _bfd_generic_link_hash_table_create
201 #endif
202 #ifndef bfd_elfNN_bfd_link_add_symbols
203 #define bfd_elfNN_bfd_link_add_symbols  _bfd_generic_link_add_symbols
204 #endif
205 #ifndef bfd_elfNN_bfd_final_link
206 #define bfd_elfNN_bfd_final_link        _bfd_generic_final_link
207 #endif
208 #endif /* ! defined (elf_backend_relocate_section) */
209
210 #ifndef bfd_elfNN_bfd_link_just_syms
211 #define bfd_elfNN_bfd_link_just_syms    _bfd_elf_link_just_syms
212 #endif
213
214 #ifndef bfd_elfNN_bfd_link_split_section
215 #define bfd_elfNN_bfd_link_split_section _bfd_generic_link_split_section
216 #endif
217
218 #ifndef bfd_elfNN_archive_p
219 #define bfd_elfNN_archive_p bfd_generic_archive_p
220 #endif
221
222 #ifndef bfd_elfNN_write_archive_contents
223 #define bfd_elfNN_write_archive_contents _bfd_write_archive_contents
224 #endif
225
226 #ifndef bfd_elfNN_mkobject
227 #define bfd_elfNN_mkobject bfd_elf_mkobject
228 #endif
229
230 #ifndef bfd_elfNN_mkcorefile
231 #define bfd_elfNN_mkcorefile bfd_elf_mkcorefile
232 #endif
233
234 #ifndef bfd_elfNN_mkarchive
235 #define bfd_elfNN_mkarchive _bfd_generic_mkarchive
236 #endif
237
238 #ifndef elf_symbol_leading_char
239 #define elf_symbol_leading_char 0
240 #endif
241
242 #ifndef elf_info_to_howto
243 #define elf_info_to_howto 0
244 #endif
245
246 #ifndef elf_info_to_howto_rel
247 #define elf_info_to_howto_rel 0
248 #endif
249
250 #ifndef ELF_MAXPAGESIZE
251   #error ELF_MAXPAGESIZE is not defined
252 #define ELF_MAXPAGESIZE 1
253 #endif
254
255 #ifndef elf_backend_collect
256 #define elf_backend_collect FALSE
257 #endif
258 #ifndef elf_backend_type_change_ok
259 #define elf_backend_type_change_ok FALSE
260 #endif
261
262 #ifndef elf_backend_sym_is_global
263 #define elf_backend_sym_is_global       0
264 #endif
265 #ifndef elf_backend_object_p
266 #define elf_backend_object_p            0
267 #endif
268 #ifndef elf_backend_symbol_processing
269 #define elf_backend_symbol_processing   0
270 #endif
271 #ifndef elf_backend_symbol_table_processing
272 #define elf_backend_symbol_table_processing     0
273 #endif
274 #ifndef elf_backend_get_symbol_type
275 #define elf_backend_get_symbol_type 0
276 #endif
277 #ifndef elf_backend_section_processing
278 #define elf_backend_section_processing  0
279 #endif
280 #ifndef elf_backend_section_from_shdr
281 #define elf_backend_section_from_shdr   0
282 #endif
283 #ifndef elf_backend_section_flags
284 #define elf_backend_section_flags       0
285 #endif
286 #ifndef elf_backend_section_from_phdr
287 #define elf_backend_section_from_phdr   0
288 #endif
289 #ifndef elf_backend_fake_sections
290 #define elf_backend_fake_sections       0
291 #endif
292 #ifndef elf_backend_section_from_bfd_section
293 #define elf_backend_section_from_bfd_section    0
294 #endif
295 #ifndef elf_backend_add_symbol_hook
296 #define elf_backend_add_symbol_hook     0
297 #endif
298 #ifndef elf_backend_link_output_symbol_hook
299 #define elf_backend_link_output_symbol_hook 0
300 #endif
301 #ifndef elf_backend_create_dynamic_sections
302 #define elf_backend_create_dynamic_sections 0
303 #endif
304 #ifndef elf_backend_check_relocs
305 #define elf_backend_check_relocs        0
306 #endif
307 #ifndef elf_backend_adjust_dynamic_symbol
308 #define elf_backend_adjust_dynamic_symbol 0
309 #endif
310 #ifndef elf_backend_always_size_sections
311 #define elf_backend_always_size_sections 0
312 #endif
313 #ifndef elf_backend_size_dynamic_sections
314 #define elf_backend_size_dynamic_sections 0
315 #endif
316 #ifndef elf_backend_relocate_section
317 #define elf_backend_relocate_section    0
318 #endif
319 #ifndef elf_backend_finish_dynamic_symbol
320 #define elf_backend_finish_dynamic_symbol       0
321 #endif
322 #ifndef elf_backend_finish_dynamic_sections
323 #define elf_backend_finish_dynamic_sections     0
324 #endif
325 #ifndef elf_backend_begin_write_processing
326 #define elf_backend_begin_write_processing      0
327 #endif
328 #ifndef elf_backend_final_write_processing
329 #define elf_backend_final_write_processing      0
330 #endif
331 #ifndef elf_backend_additional_program_headers
332 #define elf_backend_additional_program_headers  0
333 #endif
334 #ifndef elf_backend_modify_segment_map
335 #define elf_backend_modify_segment_map  0
336 #endif
337 #ifndef elf_backend_ecoff_debug_swap
338 #define elf_backend_ecoff_debug_swap    0
339 #endif
340 #ifndef elf_backend_bfd_from_remote_memory
341 #define elf_backend_bfd_from_remote_memory _bfd_elfNN_bfd_from_remote_memory
342 #endif
343 #ifndef elf_backend_got_header_size
344 #define elf_backend_got_header_size     0
345 #endif
346 #ifndef elf_backend_plt_header_size
347 #define elf_backend_plt_header_size     0
348 #endif
349 #ifndef elf_backend_post_process_headers
350 #define elf_backend_post_process_headers        NULL
351 #endif
352 #ifndef elf_backend_print_symbol_all
353 #define elf_backend_print_symbol_all            NULL
354 #endif
355 #ifndef elf_backend_output_arch_syms
356 #define elf_backend_output_arch_syms            NULL
357 #endif
358 #ifndef elf_backend_copy_indirect_symbol
359 #define elf_backend_copy_indirect_symbol  _bfd_elf_link_hash_copy_indirect
360 #endif
361 #ifndef elf_backend_hide_symbol
362 #define elf_backend_hide_symbol         _bfd_elf_link_hash_hide_symbol
363 #endif
364 #ifndef elf_backend_merge_symbol_attribute
365 #define elf_backend_merge_symbol_attribute      NULL
366 #endif
367 #ifndef elf_backend_emit_relocs
368 #define elf_backend_emit_relocs                 NULL
369 #endif
370 #ifndef elf_backend_count_relocs
371 #define elf_backend_count_relocs                NULL
372 #endif
373 #ifndef elf_backend_grok_prstatus
374 #define elf_backend_grok_prstatus               NULL
375 #endif
376 #ifndef elf_backend_grok_psinfo
377 #define elf_backend_grok_psinfo                 NULL
378 #endif
379 #ifndef elf_backend_sprintf_vma
380 #define elf_backend_sprintf_vma                 _bfd_elf_sprintf_vma
381 #endif
382 #ifndef elf_backend_fprintf_vma
383 #define elf_backend_fprintf_vma                 _bfd_elf_fprintf_vma
384 #endif
385 #ifndef elf_backend_reloc_type_class
386 #define elf_backend_reloc_type_class            _bfd_elf_reloc_type_class
387 #endif
388 #ifndef elf_backend_discard_info
389 #define elf_backend_discard_info                NULL
390 #endif
391 #ifndef elf_backend_ignore_discarded_relocs
392 #define elf_backend_ignore_discarded_relocs     NULL
393 #endif
394 #ifndef elf_backend_write_section
395 #define elf_backend_write_section               NULL
396 #endif
397 #ifndef elf_backend_mips_irix_compat
398 #define elf_backend_mips_irix_compat            NULL
399 #endif
400 #ifndef elf_backend_mips_rtype_to_howto
401 #define elf_backend_mips_rtype_to_howto         NULL
402 #endif
403
404 /* Previously, backends could only use SHT_REL or SHT_RELA relocation
405    sections, but not both.  They defined USE_REL to indicate SHT_REL
406    sections, and left it undefined to indicated SHT_RELA sections.
407    For backwards compatibility, we still support this usage.  */
408 #ifndef USE_REL
409 #define USE_REL 0
410 #endif
411
412 /* Use these in new code.  */
413 #ifndef elf_backend_may_use_rel_p
414 #define elf_backend_may_use_rel_p USE_REL
415 #endif
416 #ifndef elf_backend_may_use_rela_p
417 #define elf_backend_may_use_rela_p !USE_REL
418 #endif
419 #ifndef elf_backend_default_use_rela_p
420 #define elf_backend_default_use_rela_p !USE_REL
421 #endif
422
423 #ifndef elf_backend_rela_normal
424 #define elf_backend_rela_normal 0
425 #endif
426
427 #ifndef ELF_MACHINE_ALT1
428 #define ELF_MACHINE_ALT1 0
429 #endif
430
431 #ifndef ELF_MACHINE_ALT2
432 #define ELF_MACHINE_ALT2 0
433 #endif
434
435 #ifndef elf_backend_size_info
436 #define elf_backend_size_info _bfd_elfNN_size_info
437 #endif
438
439 #ifndef elf_backend_special_sections
440 #define elf_backend_special_sections NULL
441 #endif
442
443 #ifndef elf_backend_sign_extend_vma
444 #define elf_backend_sign_extend_vma 0
445 #endif
446
447 extern const struct elf_size_info _bfd_elfNN_size_info;
448
449 #ifndef INCLUDED_TARGET_FILE
450 static const struct elf_backend_data elfNN_bed =
451 {
452   ELF_ARCH,                     /* arch */
453   ELF_MACHINE_CODE,             /* elf_machine_code */
454   ELF_MAXPAGESIZE,              /* maxpagesize */
455   elf_info_to_howto,
456   elf_info_to_howto_rel,
457   elf_backend_sym_is_global,
458   elf_backend_object_p,
459   elf_backend_symbol_processing,
460   elf_backend_symbol_table_processing,
461   elf_backend_get_symbol_type,
462   elf_backend_section_processing,
463   elf_backend_section_from_shdr,
464   elf_backend_section_flags,
465   elf_backend_section_from_phdr,
466   elf_backend_fake_sections,
467   elf_backend_section_from_bfd_section,
468   elf_backend_add_symbol_hook,
469   elf_backend_link_output_symbol_hook,
470   elf_backend_create_dynamic_sections,
471   elf_backend_check_relocs,
472   elf_backend_adjust_dynamic_symbol,
473   elf_backend_always_size_sections,
474   elf_backend_size_dynamic_sections,
475   elf_backend_relocate_section,
476   elf_backend_finish_dynamic_symbol,
477   elf_backend_finish_dynamic_sections,
478   elf_backend_begin_write_processing,
479   elf_backend_final_write_processing,
480   elf_backend_additional_program_headers,
481   elf_backend_modify_segment_map,
482   elf_backend_gc_mark_hook,
483   elf_backend_gc_sweep_hook,
484   elf_backend_post_process_headers,
485   elf_backend_print_symbol_all,
486   elf_backend_output_arch_syms,
487   elf_backend_copy_indirect_symbol,
488   elf_backend_hide_symbol,
489   elf_backend_merge_symbol_attribute,
490   elf_backend_emit_relocs,
491   elf_backend_count_relocs,
492   elf_backend_grok_prstatus,
493   elf_backend_grok_psinfo,
494   elf_backend_sprintf_vma,
495   elf_backend_fprintf_vma,
496   elf_backend_reloc_type_class,
497   elf_backend_discard_info,
498   elf_backend_ignore_discarded_relocs,
499   elf_backend_write_section,
500   elf_backend_mips_irix_compat,
501   elf_backend_mips_rtype_to_howto,
502   elf_backend_ecoff_debug_swap,
503   elf_backend_bfd_from_remote_memory,
504   ELF_MACHINE_ALT1,
505   ELF_MACHINE_ALT2,
506   &elf_backend_size_info,
507   elf_backend_special_sections,
508   elf_backend_got_symbol_offset,
509   elf_backend_got_header_size,
510   elf_backend_plt_header_size,
511   elf_backend_collect,
512   elf_backend_type_change_ok,
513   elf_backend_may_use_rel_p,
514   elf_backend_may_use_rela_p,
515   elf_backend_default_use_rela_p,
516   elf_backend_rela_normal,
517   elf_backend_sign_extend_vma,
518   elf_backend_want_got_plt,
519   elf_backend_plt_readonly,
520   elf_backend_want_plt_sym,
521   elf_backend_plt_not_loaded,
522   elf_backend_plt_alignment,
523   elf_backend_can_gc_sections,
524   elf_backend_can_refcount,
525   elf_backend_want_got_sym,
526   elf_backend_want_dynbss,
527   elf_backend_want_p_paddr_set_to_zero
528 };
529 #endif
530
531 /* Forward declaration for use when initialising alternative_target field.  */
532 #ifdef TARGET_LITTLE_SYM
533 extern const bfd_target TARGET_LITTLE_SYM;
534 #endif
535
536 #ifdef TARGET_BIG_SYM
537 const bfd_target TARGET_BIG_SYM =
538 {
539   /* name: identify kind of target */
540   TARGET_BIG_NAME,
541
542   /* flavour: general indication about file */
543   bfd_target_elf_flavour,
544
545   /* byteorder: data is big endian */
546   BFD_ENDIAN_BIG,
547
548   /* header_byteorder: header is also big endian */
549   BFD_ENDIAN_BIG,
550
551   /* object_flags: mask of all file flags */
552   (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS
553    | DYNAMIC | WP_TEXT | D_PAGED),
554
555   /* section_flags: mask of all section flags */
556   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY
557    | SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_EXCLUDE | SEC_SORT_ENTRIES
558    | SEC_ARCH_BIT_0 | SEC_SMALL_DATA | SEC_MERGE | SEC_STRINGS | SEC_GROUP),
559
560    /* leading_symbol_char: is the first char of a user symbol
561       predictable, and if so what is it */
562   elf_symbol_leading_char,
563
564   /* ar_pad_char: pad character for filenames within an archive header
565      FIXME:  this really has nothing to do with ELF, this is a characteristic
566      of the archiver and/or os and should be independently tunable */
567   '/',
568
569   /* ar_max_namelen: maximum number of characters in an archive header
570      FIXME:  this really has nothing to do with ELF, this is a characteristic
571      of the archiver and should be independently tunable.  The System V ABI,
572      Chapter 7 (Formats & Protocols), Archive section sets this as 15.  */
573   15,
574
575   /* Routines to byte-swap various sized integers from the data sections */
576   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
577     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
578     bfd_getb16, bfd_getb_signed_16, bfd_putb16,
579
580   /* Routines to byte-swap various sized integers from the file headers */
581   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
582     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
583     bfd_getb16, bfd_getb_signed_16, bfd_putb16,
584
585   /* bfd_check_format: check the format of a file being read */
586   { _bfd_dummy_target,          /* unknown format */
587     bfd_elfNN_object_p,         /* assembler/linker output (object file) */
588     bfd_elfNN_archive_p,        /* an archive */
589     bfd_elfNN_core_file_p       /* a core file */
590   },
591
592   /* bfd_set_format: set the format of a file being written */
593   { bfd_false,
594     bfd_elfNN_mkobject,
595     bfd_elfNN_mkarchive,
596     bfd_elfNN_mkcorefile
597   },
598
599   /* bfd_write_contents: write cached information into a file being written */
600   { bfd_false,
601     bfd_elfNN_write_object_contents,
602     bfd_elfNN_write_archive_contents,
603     bfd_elfNN_write_corefile_contents,
604   },
605
606   BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
607   BFD_JUMP_TABLE_COPY (bfd_elfNN),
608   BFD_JUMP_TABLE_CORE (bfd_elfNN),
609 #ifdef bfd_elfNN_archive_functions
610   BFD_JUMP_TABLE_ARCHIVE (bfd_elfNN_archive),
611 #else
612   BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
613 #endif
614   BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
615   BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
616   BFD_JUMP_TABLE_WRITE (bfd_elfNN),
617   BFD_JUMP_TABLE_LINK (bfd_elfNN),
618   BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
619
620   /* Alternative endian target.  */
621 #ifdef TARGET_LITTLE_SYM
622   & TARGET_LITTLE_SYM,
623 #else
624   NULL,
625 #endif
626
627   /* backend_data: */
628   &elfNN_bed
629 };
630 #endif
631
632 #ifdef TARGET_LITTLE_SYM
633 const bfd_target TARGET_LITTLE_SYM =
634 {
635   /* name: identify kind of target */
636   TARGET_LITTLE_NAME,
637
638   /* flavour: general indication about file */
639   bfd_target_elf_flavour,
640
641   /* byteorder: data is little endian */
642   BFD_ENDIAN_LITTLE,
643
644   /* header_byteorder: header is also little endian */
645   BFD_ENDIAN_LITTLE,
646
647   /* object_flags: mask of all file flags */
648   (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS
649    | DYNAMIC | WP_TEXT | D_PAGED),
650
651   /* section_flags: mask of all section flags */
652   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY
653    | SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_EXCLUDE | SEC_SORT_ENTRIES
654    | SEC_ARCH_BIT_0 | SEC_SMALL_DATA | SEC_MERGE | SEC_STRINGS | SEC_GROUP),
655
656    /* leading_symbol_char: is the first char of a user symbol
657       predictable, and if so what is it */
658   elf_symbol_leading_char,
659
660   /* ar_pad_char: pad character for filenames within an archive header
661      FIXME:  this really has nothing to do with ELF, this is a characteristic
662      of the archiver and/or os and should be independently tunable */
663   '/',
664
665   /* ar_max_namelen: maximum number of characters in an archive header
666      FIXME:  this really has nothing to do with ELF, this is a characteristic
667      of the archiver and should be independently tunable.  The System V ABI,
668      Chapter 7 (Formats & Protocols), Archive section sets this as 15.  */
669   15,
670
671   /* Routines to byte-swap various sized integers from the data sections */
672   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
673     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
674     bfd_getl16, bfd_getl_signed_16, bfd_putl16,
675
676   /* Routines to byte-swap various sized integers from the file headers */
677   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
678     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
679     bfd_getl16, bfd_getl_signed_16, bfd_putl16,
680
681   /* bfd_check_format: check the format of a file being read */
682   { _bfd_dummy_target,          /* unknown format */
683     bfd_elfNN_object_p,         /* assembler/linker output (object file) */
684     bfd_elfNN_archive_p,        /* an archive */
685     bfd_elfNN_core_file_p       /* a core file */
686   },
687
688   /* bfd_set_format: set the format of a file being written */
689   { bfd_false,
690     bfd_elfNN_mkobject,
691     bfd_elfNN_mkarchive,
692     bfd_elfNN_mkcorefile
693   },
694
695   /* bfd_write_contents: write cached information into a file being written */
696   { bfd_false,
697     bfd_elfNN_write_object_contents,
698     bfd_elfNN_write_archive_contents,
699     bfd_elfNN_write_corefile_contents,
700   },
701
702   BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
703   BFD_JUMP_TABLE_COPY (bfd_elfNN),
704   BFD_JUMP_TABLE_CORE (bfd_elfNN),
705 #ifdef bfd_elfNN_archive_functions
706   BFD_JUMP_TABLE_ARCHIVE (bfd_elfNN_archive),
707 #else
708   BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
709 #endif
710   BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
711   BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
712   BFD_JUMP_TABLE_WRITE (bfd_elfNN),
713   BFD_JUMP_TABLE_LINK (bfd_elfNN),
714   BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
715
716   /* Alternative endian target.  */
717 #ifdef TARGET_BIG_SYM
718   & TARGET_BIG_SYM,
719 #else
720   NULL,
721 #endif
722
723   /* backend_data: */
724   &elfNN_bed
725 };
726 #endif