OSDN Git Service

update copyright dates
[pf3gnuchains/pf3gnuchains4x.git] / bfd / aout-target.h
1 /* Define a target vector and some small routines for a variant of a.out.
2    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3    2000, 2001, 2002, 2003, 2004, 2005
4    Free Software Foundation, Inc.
5
6 This file is part of BFD, the Binary File Descriptor library.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
21
22 #include "aout/aout64.h"
23 #include "aout/stab_gnu.h"
24 #include "aout/ar.h"
25 /*#include "libaout.h"*/
26
27 #ifndef SEGMENT_SIZE
28 #define SEGMENT_SIZE TARGET_PAGE_SIZE
29 #endif
30
31 extern reloc_howto_type * NAME(aout,reloc_type_lookup)
32   PARAMS ((bfd *, bfd_reloc_code_real_type));
33
34 /* Set parameters about this a.out file that are machine-dependent.
35    This routine is called from some_aout_object_p just before it returns.  */
36 #ifndef MY_callback
37
38 static const bfd_target *MY(callback) PARAMS ((bfd *));
39
40 static const bfd_target *
41 MY(callback) (abfd)
42      bfd *abfd;
43 {
44   struct internal_exec *execp = exec_hdr (abfd);
45   unsigned int arch_align_power;
46   unsigned long arch_align;
47
48   /* Calculate the file positions of the parts of a newly read aout header */
49   obj_textsec (abfd)->size = N_TXTSIZE(*execp);
50
51   /* The virtual memory addresses of the sections */
52   obj_textsec (abfd)->vma = N_TXTADDR(*execp);
53   obj_datasec (abfd)->vma = N_DATADDR(*execp);
54   obj_bsssec  (abfd)->vma = N_BSSADDR(*execp);
55
56   /* For some targets, if the entry point is not in the same page
57      as the start of the text, then adjust the VMA so that it is.
58      FIXME: Do this with a macro like SET_ARCH_MACH instead?  */
59   if (aout_backend_info (abfd)->entry_is_text_address
60       && execp->a_entry > obj_textsec (abfd)->vma)
61     {
62       bfd_vma adjust;
63
64       adjust = execp->a_entry - obj_textsec (abfd)->vma;
65       /* Adjust only by whole pages.  */
66       adjust &= ~(TARGET_PAGE_SIZE - 1);
67       obj_textsec (abfd)->vma += adjust;
68       obj_datasec (abfd)->vma += adjust;
69       obj_bsssec (abfd)->vma += adjust;
70     }
71
72   /* Set the load addresses to be the same as the virtual addresses.  */
73   obj_textsec (abfd)->lma = obj_textsec (abfd)->vma;
74   obj_datasec (abfd)->lma = obj_datasec (abfd)->vma;
75   obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma;
76
77   /* The file offsets of the sections */
78   obj_textsec (abfd)->filepos = N_TXTOFF (*execp);
79   obj_datasec (abfd)->filepos = N_DATOFF (*execp);
80
81   /* The file offsets of the relocation info */
82   obj_textsec (abfd)->rel_filepos = N_TRELOFF(*execp);
83   obj_datasec (abfd)->rel_filepos = N_DRELOFF(*execp);
84
85   /* The file offsets of the string table and symbol table.  */
86   obj_sym_filepos (abfd) = N_SYMOFF (*execp);
87   obj_str_filepos (abfd) = N_STROFF (*execp);
88
89   /* Determine the architecture and machine type of the object file.  */
90 #ifdef SET_ARCH_MACH
91   SET_ARCH_MACH (abfd, *execp);
92 #else
93   bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0);
94 #endif
95
96   /* The number of relocation records.  This must be called after
97      SET_ARCH_MACH.  It assumes that SET_ARCH_MACH will set
98      obj_reloc_entry_size correctly, if the reloc size is not
99      RELOC_STD_SIZE.  */
100   obj_textsec (abfd)->reloc_count =
101     execp->a_trsize / obj_reloc_entry_size (abfd);
102   obj_datasec (abfd)->reloc_count =
103     execp->a_drsize / obj_reloc_entry_size (abfd);
104
105   /* Now that we know the architecture, set the alignments of the
106      sections.  This is normally done by NAME(aout,new_section_hook),
107      but when the initial sections were created the architecture had
108      not yet been set.  However, for backward compatibility, we don't
109      set the alignment power any higher than as required by the size
110      of the section.  */
111   arch_align_power = bfd_get_arch_info (abfd)->section_align_power;
112   arch_align = 1 << arch_align_power;
113   if ((BFD_ALIGN (obj_textsec (abfd)->size, arch_align)
114        == obj_textsec (abfd)->size)
115       && (BFD_ALIGN (obj_datasec (abfd)->size, arch_align)
116           == obj_datasec (abfd)->size)
117       && (BFD_ALIGN (obj_bsssec (abfd)->size, arch_align)
118           == obj_bsssec (abfd)->size))
119     {
120       obj_textsec (abfd)->alignment_power = arch_align_power;
121       obj_datasec (abfd)->alignment_power = arch_align_power;
122       obj_bsssec (abfd)->alignment_power = arch_align_power;
123     }
124
125   /* Don't set sizes now -- can't be sure until we know arch & mach.
126      Sizes get set in set_sizes callback, later.  */
127
128   return abfd->xvec;
129 }
130 #endif
131
132 #ifndef MY_object_p
133 /* Finish up the reading of an a.out file header */
134
135 static const bfd_target *MY(object_p) PARAMS ((bfd *));
136
137 static const bfd_target *
138 MY(object_p) (abfd)
139      bfd *abfd;
140 {
141   struct external_exec exec_bytes;      /* Raw exec header from file */
142   struct internal_exec exec;            /* Cleaned-up exec header */
143   const bfd_target *target;
144   bfd_size_type amt = EXEC_BYTES_SIZE;
145
146   if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt)
147     {
148       if (bfd_get_error () != bfd_error_system_call)
149         bfd_set_error (bfd_error_wrong_format);
150       return 0;
151     }
152
153 #ifdef SWAP_MAGIC
154   exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
155 #else
156   exec.a_info = GET_MAGIC (abfd, exec_bytes.e_info);
157 #endif /* SWAP_MAGIC */
158
159   if (N_BADMAG (exec)) return 0;
160 #ifdef MACHTYPE_OK
161   if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) return 0;
162 #endif
163
164   NAME(aout,swap_exec_header_in) (abfd, &exec_bytes, &exec);
165
166 #ifdef SWAP_MAGIC
167   /* swap_exec_header_in read in a_info with the wrong byte order */
168   exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
169 #endif /* SWAP_MAGIC */
170
171   target = NAME(aout,some_aout_object_p) (abfd, &exec, MY(callback));
172
173 #ifdef ENTRY_CAN_BE_ZERO
174   /* The NEWSOS3 entry-point is/was 0, which (amongst other lossage)
175    * means that it isn't obvious if EXEC_P should be set.
176    * All of the following must be true for an executable:
177    * There must be no relocations, the bfd can be neither an
178    * archive nor an archive element, and the file must be executable.  */
179
180   if (exec.a_trsize + exec.a_drsize == 0
181       && bfd_get_format(abfd) == bfd_object && abfd->my_archive == NULL)
182     {
183       struct stat buf;
184 #ifndef S_IXUSR
185 #define S_IXUSR 0100    /* Execute by owner.  */
186 #endif
187       if (stat(abfd->filename, &buf) == 0 && (buf.st_mode & S_IXUSR))
188         abfd->flags |= EXEC_P;
189     }
190 #endif /* ENTRY_CAN_BE_ZERO */
191
192   return target;
193 }
194 #define MY_object_p MY(object_p)
195 #endif
196
197 #ifndef MY_mkobject
198
199 static bfd_boolean MY(mkobject) PARAMS ((bfd *));
200
201 static bfd_boolean
202 MY(mkobject) (abfd)
203      bfd *abfd;
204 {
205   return NAME (aout, mkobject (abfd));
206 }
207
208 #define MY_mkobject MY(mkobject)
209 #endif
210
211 #ifndef MY_bfd_copy_private_section_data
212
213 /* Copy private section data.  This actually does nothing with the
214    sections.  It copies the subformat field.  We copy it here, because
215    we need to know whether this is a QMAGIC file before we set the
216    section contents, and copy_private_bfd_data is not called until
217    after the section contents have been set.  */
218
219 static bfd_boolean MY_bfd_copy_private_section_data
220   PARAMS ((bfd *, asection *, bfd *, asection *));
221
222 static bfd_boolean
223 MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
224      bfd *ibfd;
225      asection *isec ATTRIBUTE_UNUSED;
226      bfd *obfd;
227      asection *osec ATTRIBUTE_UNUSED;
228 {
229   if (bfd_get_flavour (ibfd) == bfd_target_aout_flavour
230       && bfd_get_flavour (obfd) == bfd_target_aout_flavour)
231     obj_aout_subformat (obfd) = obj_aout_subformat (ibfd);
232   return TRUE;
233 }
234
235 #endif
236
237 /* Write an object file.
238    Section contents have already been written.  We write the
239    file header, symbols, and relocation.  */
240
241 #ifndef MY_write_object_contents
242 static bfd_boolean MY(write_object_contents) PARAMS ((bfd *));
243
244 static bfd_boolean
245 MY(write_object_contents) (abfd)
246      bfd *abfd;
247 {
248   struct external_exec exec_bytes;
249   struct internal_exec *execp = exec_hdr (abfd);
250
251   obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
252
253   WRITE_HEADERS(abfd, execp);
254
255   return TRUE;
256 }
257 #define MY_write_object_contents MY(write_object_contents)
258 #endif
259
260 #ifndef MY_set_sizes
261
262 static bfd_boolean MY(set_sizes) PARAMS ((bfd *));
263
264 static bfd_boolean
265 MY(set_sizes) (abfd)
266      bfd *abfd;
267 {
268   adata(abfd).page_size = TARGET_PAGE_SIZE;
269   adata(abfd).segment_size = SEGMENT_SIZE;
270
271 #ifdef ZMAGIC_DISK_BLOCK_SIZE
272   adata(abfd).zmagic_disk_block_size = ZMAGIC_DISK_BLOCK_SIZE;
273 #else
274   adata(abfd).zmagic_disk_block_size = TARGET_PAGE_SIZE;
275 #endif
276
277   adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
278   return TRUE;
279 }
280 #define MY_set_sizes MY(set_sizes)
281 #endif
282
283 #ifndef MY_exec_hdr_flags
284 #define MY_exec_hdr_flags 0
285 #endif
286
287 #ifndef MY_backend_data
288
289 #ifndef MY_zmagic_contiguous
290 #define MY_zmagic_contiguous 0
291 #endif
292 #ifndef MY_text_includes_header
293 #define MY_text_includes_header 0
294 #endif
295 #ifndef MY_entry_is_text_address
296 #define MY_entry_is_text_address 0
297 #endif
298 #ifndef MY_exec_header_not_counted
299 #define MY_exec_header_not_counted 0
300 #endif
301 #ifndef MY_add_dynamic_symbols
302 #define MY_add_dynamic_symbols 0
303 #endif
304 #ifndef MY_add_one_symbol
305 #define MY_add_one_symbol 0
306 #endif
307 #ifndef MY_link_dynamic_object
308 #define MY_link_dynamic_object 0
309 #endif
310 #ifndef MY_write_dynamic_symbol
311 #define MY_write_dynamic_symbol 0
312 #endif
313 #ifndef MY_check_dynamic_reloc
314 #define MY_check_dynamic_reloc 0
315 #endif
316 #ifndef MY_finish_dynamic_link
317 #define MY_finish_dynamic_link 0
318 #endif
319
320 static const struct aout_backend_data MY(backend_data) = {
321   MY_zmagic_contiguous,
322   MY_text_includes_header,
323   MY_entry_is_text_address,
324   MY_exec_hdr_flags,
325   0,                            /* text vma? */
326   MY_set_sizes,
327   MY_exec_header_not_counted,
328   MY_add_dynamic_symbols,
329   MY_add_one_symbol,
330   MY_link_dynamic_object,
331   MY_write_dynamic_symbol,
332   MY_check_dynamic_reloc,
333   MY_finish_dynamic_link
334 };
335 #define MY_backend_data &MY(backend_data)
336 #endif
337
338 #ifndef MY_final_link_callback
339
340 /* Callback for the final_link routine to set the section offsets.  */
341
342 static void MY_final_link_callback
343   PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *));
344
345 static void
346 MY_final_link_callback (abfd, ptreloff, pdreloff, psymoff)
347      bfd *abfd;
348      file_ptr *ptreloff;
349      file_ptr *pdreloff;
350      file_ptr *psymoff;
351 {
352   struct internal_exec *execp = exec_hdr (abfd);
353
354   *ptreloff = N_TRELOFF (*execp);
355   *pdreloff = N_DRELOFF (*execp);
356   *psymoff = N_SYMOFF (*execp);
357 }
358
359 #endif
360
361 #ifndef MY_bfd_final_link
362
363 /* Final link routine.  We need to use a call back to get the correct
364    offsets in the output file.  */
365
366 static bfd_boolean MY_bfd_final_link PARAMS ((bfd *, struct bfd_link_info *));
367
368 static bfd_boolean
369 MY_bfd_final_link (abfd, info)
370      bfd *abfd;
371      struct bfd_link_info *info;
372 {
373   return NAME(aout,final_link) (abfd, info, MY_final_link_callback);
374 }
375
376 #endif
377
378 /* We assume BFD generic archive files.  */
379 #ifndef MY_openr_next_archived_file
380 #define MY_openr_next_archived_file     bfd_generic_openr_next_archived_file
381 #endif
382 #ifndef MY_get_elt_at_index
383 #define MY_get_elt_at_index             _bfd_generic_get_elt_at_index
384 #endif
385 #ifndef MY_generic_stat_arch_elt
386 #define MY_generic_stat_arch_elt        bfd_generic_stat_arch_elt
387 #endif
388 #ifndef MY_slurp_armap
389 #define MY_slurp_armap                  bfd_slurp_bsd_armap
390 #endif
391 #ifndef MY_slurp_extended_name_table
392 #define MY_slurp_extended_name_table    _bfd_slurp_extended_name_table
393 #endif
394 #ifndef MY_construct_extended_name_table
395 #define MY_construct_extended_name_table \
396   _bfd_archive_bsd_construct_extended_name_table
397 #endif
398 #ifndef MY_write_armap
399 #define MY_write_armap          bsd_write_armap
400 #endif
401 #ifndef MY_read_ar_hdr
402 #define MY_read_ar_hdr          _bfd_generic_read_ar_hdr
403 #endif
404 #ifndef MY_truncate_arname
405 #define MY_truncate_arname              bfd_bsd_truncate_arname
406 #endif
407 #ifndef MY_update_armap_timestamp
408 #define MY_update_armap_timestamp _bfd_archive_bsd_update_armap_timestamp
409 #endif
410
411 /* No core file defined here -- configure in trad-core.c separately.  */
412 #ifndef MY_core_file_failing_command
413 #define MY_core_file_failing_command _bfd_nocore_core_file_failing_command
414 #endif
415 #ifndef MY_core_file_failing_signal
416 #define MY_core_file_failing_signal     _bfd_nocore_core_file_failing_signal
417 #endif
418 #ifndef MY_core_file_matches_executable_p
419 #define MY_core_file_matches_executable_p       \
420                                 _bfd_nocore_core_file_matches_executable_p
421 #endif
422 #ifndef MY_core_file_p
423 #define MY_core_file_p          _bfd_dummy_target
424 #endif
425
426 #ifndef MY_bfd_debug_info_start
427 #define MY_bfd_debug_info_start         bfd_void
428 #endif
429 #ifndef MY_bfd_debug_info_end
430 #define MY_bfd_debug_info_end           bfd_void
431 #endif
432 #ifndef MY_bfd_debug_info_accumulate
433 #define MY_bfd_debug_info_accumulate    \
434                 (void (*) PARAMS ((bfd*, struct bfd_section *))) bfd_void
435 #endif
436
437 #ifndef MY_core_file_failing_command
438 #define MY_core_file_failing_command NAME(aout,core_file_failing_command)
439 #endif
440 #ifndef MY_core_file_failing_signal
441 #define MY_core_file_failing_signal NAME(aout,core_file_failing_signal)
442 #endif
443 #ifndef MY_core_file_matches_executable_p
444 #define MY_core_file_matches_executable_p NAME(aout,core_file_matches_executable_p)
445 #endif
446 #ifndef MY_set_section_contents
447 #define MY_set_section_contents NAME(aout,set_section_contents)
448 #endif
449 #ifndef MY_get_section_contents
450 #define MY_get_section_contents NAME(aout,get_section_contents)
451 #endif
452 #ifndef MY_get_section_contents_in_window
453 #define MY_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
454 #endif
455 #ifndef MY_new_section_hook
456 #define MY_new_section_hook NAME(aout,new_section_hook)
457 #endif
458 #ifndef MY_get_symtab_upper_bound
459 #define MY_get_symtab_upper_bound NAME(aout,get_symtab_upper_bound)
460 #endif
461 #ifndef MY_canonicalize_symtab
462 #define MY_canonicalize_symtab NAME(aout,canonicalize_symtab)
463 #endif
464 #ifndef MY_get_reloc_upper_bound
465 #define MY_get_reloc_upper_bound NAME(aout,get_reloc_upper_bound)
466 #endif
467 #ifndef MY_canonicalize_reloc
468 #define MY_canonicalize_reloc NAME(aout,canonicalize_reloc)
469 #endif
470 #ifndef MY_make_empty_symbol
471 #define MY_make_empty_symbol NAME(aout,make_empty_symbol)
472 #endif
473 #ifndef MY_print_symbol
474 #define MY_print_symbol NAME(aout,print_symbol)
475 #endif
476 #ifndef MY_get_symbol_info
477 #define MY_get_symbol_info NAME(aout,get_symbol_info)
478 #endif
479 #ifndef MY_get_lineno
480 #define MY_get_lineno NAME(aout,get_lineno)
481 #endif
482 #ifndef MY_set_arch_mach
483 #define MY_set_arch_mach NAME(aout,set_arch_mach)
484 #endif
485 #ifndef MY_find_nearest_line
486 #define MY_find_nearest_line NAME(aout,find_nearest_line)
487 #endif
488 #ifndef MY_sizeof_headers
489 #define MY_sizeof_headers NAME(aout,sizeof_headers)
490 #endif
491 #ifndef MY_bfd_get_relocated_section_contents
492 #define MY_bfd_get_relocated_section_contents \
493                         bfd_generic_get_relocated_section_contents
494 #endif
495 #ifndef MY_bfd_relax_section
496 #define MY_bfd_relax_section bfd_generic_relax_section
497 #endif
498 #ifndef MY_bfd_gc_sections
499 #define MY_bfd_gc_sections bfd_generic_gc_sections
500 #endif
501 #ifndef MY_bfd_merge_sections
502 #define MY_bfd_merge_sections bfd_generic_merge_sections
503 #endif
504 #ifndef MY_bfd_is_group_section
505 #define MY_bfd_is_group_section bfd_generic_is_group_section
506 #endif
507 #ifndef MY_bfd_discard_group
508 #define MY_bfd_discard_group bfd_generic_discard_group
509 #endif
510 #ifndef MY_section_already_linked
511 #define MY_section_already_linked \
512   _bfd_generic_section_already_linked
513 #endif
514 #ifndef MY_bfd_reloc_type_lookup
515 #define MY_bfd_reloc_type_lookup NAME(aout,reloc_type_lookup)
516 #endif
517 #ifndef MY_bfd_make_debug_symbol
518 #define MY_bfd_make_debug_symbol 0
519 #endif
520 #ifndef MY_read_minisymbols
521 #define MY_read_minisymbols NAME(aout,read_minisymbols)
522 #endif
523 #ifndef MY_minisymbol_to_symbol
524 #define MY_minisymbol_to_symbol NAME(aout,minisymbol_to_symbol)
525 #endif
526 #ifndef MY_bfd_link_hash_table_create
527 #define MY_bfd_link_hash_table_create NAME(aout,link_hash_table_create)
528 #endif
529 #ifndef MY_bfd_link_hash_table_free
530 #define MY_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
531 #endif
532 #ifndef MY_bfd_link_add_symbols
533 #define MY_bfd_link_add_symbols NAME(aout,link_add_symbols)
534 #endif
535 #ifndef MY_bfd_link_just_syms
536 #define MY_bfd_link_just_syms _bfd_generic_link_just_syms
537 #endif
538 #ifndef MY_bfd_link_split_section
539 #define MY_bfd_link_split_section  _bfd_generic_link_split_section
540 #endif
541
542 #ifndef MY_bfd_copy_private_bfd_data
543 #define MY_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data
544 #endif
545
546 #ifndef MY_bfd_merge_private_bfd_data
547 #define MY_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
548 #endif
549
550 #ifndef MY_bfd_copy_private_symbol_data
551 #define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
552 #endif
553
554 #ifndef MY_bfd_copy_private_header_data
555 #define MY_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
556 #endif
557
558 #ifndef MY_bfd_print_private_bfd_data
559 #define MY_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data
560 #endif
561
562 #ifndef MY_bfd_set_private_flags
563 #define MY_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
564 #endif
565
566 #ifndef MY_bfd_is_local_label_name
567 #define MY_bfd_is_local_label_name bfd_generic_is_local_label_name
568 #endif
569
570 #ifndef MY_bfd_is_target_special_symbol
571 #define MY_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
572 #endif
573
574 #ifndef MY_bfd_free_cached_info
575 #define MY_bfd_free_cached_info NAME(aout,bfd_free_cached_info)
576 #endif
577
578 #ifndef MY_close_and_cleanup
579 #define MY_close_and_cleanup MY_bfd_free_cached_info
580 #endif
581
582 #ifndef MY_get_dynamic_symtab_upper_bound
583 #define MY_get_dynamic_symtab_upper_bound \
584   _bfd_nodynamic_get_dynamic_symtab_upper_bound
585 #endif
586 #ifndef MY_canonicalize_dynamic_symtab
587 #define MY_canonicalize_dynamic_symtab \
588   _bfd_nodynamic_canonicalize_dynamic_symtab
589 #endif
590 #ifndef MY_get_synthetic_symtab
591 #define MY_get_synthetic_symtab \
592   _bfd_nodynamic_get_synthetic_symtab
593 #endif
594 #ifndef MY_get_dynamic_reloc_upper_bound
595 #define MY_get_dynamic_reloc_upper_bound \
596   _bfd_nodynamic_get_dynamic_reloc_upper_bound
597 #endif
598 #ifndef MY_canonicalize_dynamic_reloc
599 #define MY_canonicalize_dynamic_reloc \
600   _bfd_nodynamic_canonicalize_dynamic_reloc
601 #endif
602
603 /* Aout symbols normally have leading underscores */
604 #ifndef MY_symbol_leading_char
605 #define MY_symbol_leading_char '_'
606 #endif
607
608 /* Aout archives normally use spaces for padding */
609 #ifndef AR_PAD_CHAR
610 #define AR_PAD_CHAR ' '
611 #endif
612
613 #ifndef MY_BFD_TARGET
614 const bfd_target MY(vec) =
615 {
616   TARGETNAME,           /* name */
617   bfd_target_aout_flavour,
618 #ifdef TARGET_IS_BIG_ENDIAN_P
619   BFD_ENDIAN_BIG,               /* target byte order (big) */
620   BFD_ENDIAN_BIG,               /* target headers byte order (big) */
621 #else
622   BFD_ENDIAN_LITTLE,            /* target byte order (little) */
623   BFD_ENDIAN_LITTLE,            /* target headers byte order (little) */
624 #endif
625   (HAS_RELOC | EXEC_P |         /* object flags */
626    HAS_LINENO | HAS_DEBUG |
627    HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
628   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
629   MY_symbol_leading_char,
630   AR_PAD_CHAR,                  /* ar_pad_char */
631   15,                           /* ar_max_namelen */
632 #ifdef TARGET_IS_BIG_ENDIAN_P
633   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
634      bfd_getb32, bfd_getb_signed_32, bfd_putb32,
635      bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
636   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
637      bfd_getb32, bfd_getb_signed_32, bfd_putb32,
638      bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
639 #else
640   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
641      bfd_getl32, bfd_getl_signed_32, bfd_putl32,
642      bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
643   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
644      bfd_getl32, bfd_getl_signed_32, bfd_putl32,
645      bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
646 #endif
647     {_bfd_dummy_target, MY_object_p, /* bfd_check_format */
648        bfd_generic_archive_p, MY_core_file_p},
649     {bfd_false, MY_mkobject,    /* bfd_set_format */
650        _bfd_generic_mkarchive, bfd_false},
651     {bfd_false, MY_write_object_contents, /* bfd_write_contents */
652        _bfd_write_archive_contents, bfd_false},
653
654      BFD_JUMP_TABLE_GENERIC (MY),
655      BFD_JUMP_TABLE_COPY (MY),
656      BFD_JUMP_TABLE_CORE (MY),
657      BFD_JUMP_TABLE_ARCHIVE (MY),
658      BFD_JUMP_TABLE_SYMBOLS (MY),
659      BFD_JUMP_TABLE_RELOCS (MY),
660      BFD_JUMP_TABLE_WRITE (MY),
661      BFD_JUMP_TABLE_LINK (MY),
662      BFD_JUMP_TABLE_DYNAMIC (MY),
663
664   /* Alternative_target */
665   NULL,
666
667   (PTR) MY_backend_data
668 };
669 #endif /* MY_BFD_TARGET */