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
4   Free Software Foundation, Inc.
5
6This file is part of BFD, the Binary File Descriptor library.
7
8This program is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 2 of the License, or
11(at your option) any later version.
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with this program; if not, write to the Free Software
20Foundation, 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
31extern 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
38static const bfd_target *MY(callback) PARAMS ((bfd *));
39
40static const bfd_target *
41MY(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#if 0
128  adata(abfd).page_size = TARGET_PAGE_SIZE;
129  adata(abfd).segment_size = SEGMENT_SIZE;
130  adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
131#endif
132
133  return abfd->xvec;
134}
135#endif
136
137#ifndef MY_object_p
138/* Finish up the reading of an a.out file header */
139
140static const bfd_target *MY(object_p) PARAMS ((bfd *));
141
142static const bfd_target *
143MY(object_p) (abfd)
144     bfd *abfd;
145{
146  struct external_exec exec_bytes;	/* Raw exec header from file */
147  struct internal_exec exec;		/* Cleaned-up exec header */
148  const bfd_target *target;
149  bfd_size_type amt = EXEC_BYTES_SIZE;
150
151  if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt)
152    {
153      if (bfd_get_error () != bfd_error_system_call)
154	bfd_set_error (bfd_error_wrong_format);
155      return 0;
156    }
157
158#ifdef SWAP_MAGIC
159  exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
160#else
161  exec.a_info = GET_MAGIC (abfd, exec_bytes.e_info);
162#endif /* SWAP_MAGIC */
163
164  if (N_BADMAG (exec)) return 0;
165#ifdef MACHTYPE_OK
166  if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) return 0;
167#endif
168
169  NAME(aout,swap_exec_header_in) (abfd, &exec_bytes, &exec);
170
171#ifdef SWAP_MAGIC
172  /* swap_exec_header_in read in a_info with the wrong byte order */
173  exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
174#endif /* SWAP_MAGIC */
175
176  target = NAME(aout,some_aout_object_p) (abfd, &exec, MY(callback));
177
178#ifdef ENTRY_CAN_BE_ZERO
179  /* The NEWSOS3 entry-point is/was 0, which (amongst other lossage)
180   * means that it isn't obvious if EXEC_P should be set.
181   * All of the following must be true for an executable:
182   * There must be no relocations, the bfd can be neither an
183   * archive nor an archive element, and the file must be executable.  */
184
185  if (exec.a_trsize + exec.a_drsize == 0
186      && bfd_get_format(abfd) == bfd_object && abfd->my_archive == NULL)
187    {
188      struct stat buf;
189#ifndef S_IXUSR
190#define S_IXUSR 0100	/* Execute by owner.  */
191#endif
192      if (stat(abfd->filename, &buf) == 0 && (buf.st_mode & S_IXUSR))
193	abfd->flags |= EXEC_P;
194    }
195#endif /* ENTRY_CAN_BE_ZERO */
196
197  return target;
198}
199#define MY_object_p MY(object_p)
200#endif
201
202#ifndef MY_mkobject
203
204static bfd_boolean MY(mkobject) PARAMS ((bfd *));
205
206static bfd_boolean
207MY(mkobject) (abfd)
208     bfd *abfd;
209{
210  if (! NAME(aout,mkobject) (abfd))
211    return FALSE;
212#if 0 /* Sizes get set in set_sizes callback, later, after we know
213	 the architecture and machine.  */
214  adata(abfd).page_size = TARGET_PAGE_SIZE;
215  adata(abfd).segment_size = SEGMENT_SIZE;
216  adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
217#endif
218  return TRUE;
219}
220#define MY_mkobject MY(mkobject)
221#endif
222
223#ifndef MY_bfd_copy_private_section_data
224
225/* Copy private section data.  This actually does nothing with the
226   sections.  It copies the subformat field.  We copy it here, because
227   we need to know whether this is a QMAGIC file before we set the
228   section contents, and copy_private_bfd_data is not called until
229   after the section contents have been set.  */
230
231static bfd_boolean MY_bfd_copy_private_section_data
232  PARAMS ((bfd *, asection *, bfd *, asection *));
233
234static bfd_boolean
235MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
236     bfd *ibfd;
237     asection *isec ATTRIBUTE_UNUSED;
238     bfd *obfd;
239     asection *osec ATTRIBUTE_UNUSED;
240{
241  if (bfd_get_flavour (ibfd) == bfd_target_aout_flavour
242      && bfd_get_flavour (obfd) == bfd_target_aout_flavour)
243    obj_aout_subformat (obfd) = obj_aout_subformat (ibfd);
244  return TRUE;
245}
246
247#endif
248
249/* Write an object file.
250   Section contents have already been written.  We write the
251   file header, symbols, and relocation.  */
252
253#ifndef MY_write_object_contents
254static bfd_boolean MY(write_object_contents) PARAMS ((bfd *));
255
256static bfd_boolean
257MY(write_object_contents) (abfd)
258     bfd *abfd;
259{
260  struct external_exec exec_bytes;
261  struct internal_exec *execp = exec_hdr (abfd);
262
263  obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
264
265  WRITE_HEADERS(abfd, execp);
266
267  return TRUE;
268}
269#define MY_write_object_contents MY(write_object_contents)
270#endif
271
272#ifndef MY_set_sizes
273
274static bfd_boolean MY(set_sizes) PARAMS ((bfd *));
275
276static bfd_boolean
277MY(set_sizes) (abfd)
278     bfd *abfd;
279{
280  adata(abfd).page_size = TARGET_PAGE_SIZE;
281  adata(abfd).segment_size = SEGMENT_SIZE;
282
283#ifdef ZMAGIC_DISK_BLOCK_SIZE
284  adata(abfd).zmagic_disk_block_size = ZMAGIC_DISK_BLOCK_SIZE;
285#else
286  adata(abfd).zmagic_disk_block_size = TARGET_PAGE_SIZE;
287#endif
288
289  adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
290  return TRUE;
291}
292#define MY_set_sizes MY(set_sizes)
293#endif
294
295#ifndef MY_exec_hdr_flags
296#define MY_exec_hdr_flags 0
297#endif
298
299#ifndef MY_backend_data
300
301#ifndef MY_zmagic_contiguous
302#define MY_zmagic_contiguous 0
303#endif
304#ifndef MY_text_includes_header
305#define MY_text_includes_header 0
306#endif
307#ifndef MY_entry_is_text_address
308#define MY_entry_is_text_address 0
309#endif
310#ifndef MY_exec_header_not_counted
311#define MY_exec_header_not_counted 0
312#endif
313#ifndef MY_add_dynamic_symbols
314#define MY_add_dynamic_symbols 0
315#endif
316#ifndef MY_add_one_symbol
317#define MY_add_one_symbol 0
318#endif
319#ifndef MY_link_dynamic_object
320#define MY_link_dynamic_object 0
321#endif
322#ifndef MY_write_dynamic_symbol
323#define MY_write_dynamic_symbol 0
324#endif
325#ifndef MY_check_dynamic_reloc
326#define MY_check_dynamic_reloc 0
327#endif
328#ifndef MY_finish_dynamic_link
329#define MY_finish_dynamic_link 0
330#endif
331
332static const struct aout_backend_data MY(backend_data) = {
333  MY_zmagic_contiguous,
334  MY_text_includes_header,
335  MY_entry_is_text_address,
336  MY_exec_hdr_flags,
337  0,				/* text vma? */
338  MY_set_sizes,
339  MY_exec_header_not_counted,
340  MY_add_dynamic_symbols,
341  MY_add_one_symbol,
342  MY_link_dynamic_object,
343  MY_write_dynamic_symbol,
344  MY_check_dynamic_reloc,
345  MY_finish_dynamic_link
346};
347#define MY_backend_data &MY(backend_data)
348#endif
349
350#ifndef MY_final_link_callback
351
352/* Callback for the final_link routine to set the section offsets.  */
353
354static void MY_final_link_callback
355  PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *));
356
357static void
358MY_final_link_callback (abfd, ptreloff, pdreloff, psymoff)
359     bfd *abfd;
360     file_ptr *ptreloff;
361     file_ptr *pdreloff;
362     file_ptr *psymoff;
363{
364  struct internal_exec *execp = exec_hdr (abfd);
365
366  *ptreloff = N_TRELOFF (*execp);
367  *pdreloff = N_DRELOFF (*execp);
368  *psymoff = N_SYMOFF (*execp);
369}
370
371#endif
372
373#ifndef MY_bfd_final_link
374
375/* Final link routine.  We need to use a call back to get the correct
376   offsets in the output file.  */
377
378static bfd_boolean MY_bfd_final_link PARAMS ((bfd *, struct bfd_link_info *));
379
380static bfd_boolean
381MY_bfd_final_link (abfd, info)
382     bfd *abfd;
383     struct bfd_link_info *info;
384{
385  return NAME(aout,final_link) (abfd, info, MY_final_link_callback);
386}
387
388#endif
389
390/* We assume BFD generic archive files.  */
391#ifndef	MY_openr_next_archived_file
392#define	MY_openr_next_archived_file	bfd_generic_openr_next_archived_file
393#endif
394#ifndef MY_get_elt_at_index
395#define MY_get_elt_at_index		_bfd_generic_get_elt_at_index
396#endif
397#ifndef	MY_generic_stat_arch_elt
398#define	MY_generic_stat_arch_elt	bfd_generic_stat_arch_elt
399#endif
400#ifndef	MY_slurp_armap
401#define	MY_slurp_armap			bfd_slurp_bsd_armap
402#endif
403#ifndef	MY_slurp_extended_name_table
404#define	MY_slurp_extended_name_table	_bfd_slurp_extended_name_table
405#endif
406#ifndef MY_construct_extended_name_table
407#define MY_construct_extended_name_table \
408  _bfd_archive_bsd_construct_extended_name_table
409#endif
410#ifndef	MY_write_armap
411#define	MY_write_armap		bsd_write_armap
412#endif
413#ifndef MY_read_ar_hdr
414#define MY_read_ar_hdr		_bfd_generic_read_ar_hdr
415#endif
416#ifndef	MY_truncate_arname
417#define	MY_truncate_arname		bfd_bsd_truncate_arname
418#endif
419#ifndef MY_update_armap_timestamp
420#define MY_update_armap_timestamp _bfd_archive_bsd_update_armap_timestamp
421#endif
422
423/* No core file defined here -- configure in trad-core.c separately.  */
424#ifndef	MY_core_file_failing_command
425#define	MY_core_file_failing_command _bfd_nocore_core_file_failing_command
426#endif
427#ifndef	MY_core_file_failing_signal
428#define	MY_core_file_failing_signal	_bfd_nocore_core_file_failing_signal
429#endif
430#ifndef	MY_core_file_matches_executable_p
431#define	MY_core_file_matches_executable_p	\
432				_bfd_nocore_core_file_matches_executable_p
433#endif
434#ifndef	MY_core_file_p
435#define	MY_core_file_p		_bfd_dummy_target
436#endif
437
438#ifndef MY_bfd_debug_info_start
439#define MY_bfd_debug_info_start		bfd_void
440#endif
441#ifndef MY_bfd_debug_info_end
442#define MY_bfd_debug_info_end		bfd_void
443#endif
444#ifndef MY_bfd_debug_info_accumulate
445#define MY_bfd_debug_info_accumulate	\
446		(void (*) PARAMS ((bfd*, struct bfd_section *))) bfd_void
447#endif
448
449#ifndef MY_core_file_failing_command
450#define MY_core_file_failing_command NAME(aout,core_file_failing_command)
451#endif
452#ifndef MY_core_file_failing_signal
453#define MY_core_file_failing_signal NAME(aout,core_file_failing_signal)
454#endif
455#ifndef MY_core_file_matches_executable_p
456#define MY_core_file_matches_executable_p NAME(aout,core_file_matches_executable_p)
457#endif
458#ifndef MY_set_section_contents
459#define MY_set_section_contents NAME(aout,set_section_contents)
460#endif
461#ifndef MY_get_section_contents
462#define MY_get_section_contents NAME(aout,get_section_contents)
463#endif
464#ifndef MY_get_section_contents_in_window
465#define MY_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
466#endif
467#ifndef MY_new_section_hook
468#define MY_new_section_hook NAME(aout,new_section_hook)
469#endif
470#ifndef MY_get_symtab_upper_bound
471#define MY_get_symtab_upper_bound NAME(aout,get_symtab_upper_bound)
472#endif
473#ifndef MY_canonicalize_symtab
474#define MY_canonicalize_symtab NAME(aout,canonicalize_symtab)
475#endif
476#ifndef MY_get_reloc_upper_bound
477#define MY_get_reloc_upper_bound NAME(aout,get_reloc_upper_bound)
478#endif
479#ifndef MY_canonicalize_reloc
480#define MY_canonicalize_reloc NAME(aout,canonicalize_reloc)
481#endif
482#ifndef MY_make_empty_symbol
483#define MY_make_empty_symbol NAME(aout,make_empty_symbol)
484#endif
485#ifndef MY_print_symbol
486#define MY_print_symbol NAME(aout,print_symbol)
487#endif
488#ifndef MY_get_symbol_info
489#define MY_get_symbol_info NAME(aout,get_symbol_info)
490#endif
491#ifndef MY_get_lineno
492#define MY_get_lineno NAME(aout,get_lineno)
493#endif
494#ifndef MY_set_arch_mach
495#define MY_set_arch_mach NAME(aout,set_arch_mach)
496#endif
497#ifndef MY_find_nearest_line
498#define MY_find_nearest_line NAME(aout,find_nearest_line)
499#endif
500#ifndef MY_sizeof_headers
501#define MY_sizeof_headers NAME(aout,sizeof_headers)
502#endif
503#ifndef MY_bfd_get_relocated_section_contents
504#define MY_bfd_get_relocated_section_contents \
505			bfd_generic_get_relocated_section_contents
506#endif
507#ifndef MY_bfd_relax_section
508#define MY_bfd_relax_section bfd_generic_relax_section
509#endif
510#ifndef MY_bfd_gc_sections
511#define MY_bfd_gc_sections bfd_generic_gc_sections
512#endif
513#ifndef MY_bfd_merge_sections
514#define MY_bfd_merge_sections bfd_generic_merge_sections
515#endif
516#ifndef MY_bfd_is_group_section
517#define MY_bfd_is_group_section bfd_generic_is_group_section
518#endif
519#ifndef MY_bfd_discard_group
520#define MY_bfd_discard_group bfd_generic_discard_group
521#endif
522#ifndef MY_section_already_linked
523#define MY_section_already_linked \
524  _bfd_generic_section_already_linked
525#endif
526#ifndef MY_bfd_reloc_type_lookup
527#define MY_bfd_reloc_type_lookup NAME(aout,reloc_type_lookup)
528#endif
529#ifndef MY_bfd_make_debug_symbol
530#define MY_bfd_make_debug_symbol 0
531#endif
532#ifndef MY_read_minisymbols
533#define MY_read_minisymbols NAME(aout,read_minisymbols)
534#endif
535#ifndef MY_minisymbol_to_symbol
536#define MY_minisymbol_to_symbol NAME(aout,minisymbol_to_symbol)
537#endif
538#ifndef MY_bfd_link_hash_table_create
539#define MY_bfd_link_hash_table_create NAME(aout,link_hash_table_create)
540#endif
541#ifndef MY_bfd_link_hash_table_free
542#define MY_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
543#endif
544#ifndef MY_bfd_link_add_symbols
545#define MY_bfd_link_add_symbols NAME(aout,link_add_symbols)
546#endif
547#ifndef MY_bfd_link_just_syms
548#define MY_bfd_link_just_syms _bfd_generic_link_just_syms
549#endif
550#ifndef MY_bfd_link_split_section
551#define MY_bfd_link_split_section  _bfd_generic_link_split_section
552#endif
553
554#ifndef MY_bfd_copy_private_bfd_data
555#define MY_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data
556#endif
557
558#ifndef MY_bfd_merge_private_bfd_data
559#define MY_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
560#endif
561
562#ifndef MY_bfd_copy_private_symbol_data
563#define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
564#endif
565
566#ifndef MY_bfd_copy_private_header_data
567#define MY_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
568#endif
569
570#ifndef MY_bfd_print_private_bfd_data
571#define MY_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data
572#endif
573
574#ifndef MY_bfd_set_private_flags
575#define MY_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
576#endif
577
578#ifndef MY_bfd_is_local_label_name
579#define MY_bfd_is_local_label_name bfd_generic_is_local_label_name
580#endif
581
582#ifndef MY_bfd_is_target_special_symbol
583#define MY_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
584#endif
585
586#ifndef MY_bfd_free_cached_info
587#define MY_bfd_free_cached_info NAME(aout,bfd_free_cached_info)
588#endif
589
590#ifndef MY_close_and_cleanup
591#define MY_close_and_cleanup MY_bfd_free_cached_info
592#endif
593
594#ifndef MY_get_dynamic_symtab_upper_bound
595#define MY_get_dynamic_symtab_upper_bound \
596  _bfd_nodynamic_get_dynamic_symtab_upper_bound
597#endif
598#ifndef MY_canonicalize_dynamic_symtab
599#define MY_canonicalize_dynamic_symtab \
600  _bfd_nodynamic_canonicalize_dynamic_symtab
601#endif
602#ifndef MY_get_synthetic_symtab
603#define MY_get_synthetic_symtab \
604  _bfd_nodynamic_get_synthetic_symtab
605#endif
606#ifndef MY_get_dynamic_reloc_upper_bound
607#define MY_get_dynamic_reloc_upper_bound \
608  _bfd_nodynamic_get_dynamic_reloc_upper_bound
609#endif
610#ifndef MY_canonicalize_dynamic_reloc
611#define MY_canonicalize_dynamic_reloc \
612  _bfd_nodynamic_canonicalize_dynamic_reloc
613#endif
614
615/* Aout symbols normally have leading underscores */
616#ifndef MY_symbol_leading_char
617#define MY_symbol_leading_char '_'
618#endif
619
620/* Aout archives normally use spaces for padding */
621#ifndef AR_PAD_CHAR
622#define AR_PAD_CHAR ' '
623#endif
624
625#ifndef MY_BFD_TARGET
626const bfd_target MY(vec) =
627{
628  TARGETNAME,		/* name */
629  bfd_target_aout_flavour,
630#ifdef TARGET_IS_BIG_ENDIAN_P
631  BFD_ENDIAN_BIG,		/* target byte order (big) */
632  BFD_ENDIAN_BIG,		/* target headers byte order (big) */
633#else
634  BFD_ENDIAN_LITTLE,		/* target byte order (little) */
635  BFD_ENDIAN_LITTLE,		/* target headers byte order (little) */
636#endif
637  (HAS_RELOC | EXEC_P |		/* object flags */
638   HAS_LINENO | HAS_DEBUG |
639   HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
640  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
641  MY_symbol_leading_char,
642  AR_PAD_CHAR,			/* ar_pad_char */
643  15,				/* ar_max_namelen */
644#ifdef TARGET_IS_BIG_ENDIAN_P
645  bfd_getb64, bfd_getb_signed_64, bfd_putb64,
646     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
647     bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
648  bfd_getb64, bfd_getb_signed_64, bfd_putb64,
649     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
650     bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
651#else
652  bfd_getl64, bfd_getl_signed_64, bfd_putl64,
653     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
654     bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
655  bfd_getl64, bfd_getl_signed_64, bfd_putl64,
656     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
657     bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
658#endif
659    {_bfd_dummy_target, MY_object_p, /* bfd_check_format */
660       bfd_generic_archive_p, MY_core_file_p},
661    {bfd_false, MY_mkobject,	/* bfd_set_format */
662       _bfd_generic_mkarchive, bfd_false},
663    {bfd_false, MY_write_object_contents, /* bfd_write_contents */
664       _bfd_write_archive_contents, bfd_false},
665
666     BFD_JUMP_TABLE_GENERIC (MY),
667     BFD_JUMP_TABLE_COPY (MY),
668     BFD_JUMP_TABLE_CORE (MY),
669     BFD_JUMP_TABLE_ARCHIVE (MY),
670     BFD_JUMP_TABLE_SYMBOLS (MY),
671     BFD_JUMP_TABLE_RELOCS (MY),
672     BFD_JUMP_TABLE_WRITE (MY),
673     BFD_JUMP_TABLE_LINK (MY),
674     BFD_JUMP_TABLE_DYNAMIC (MY),
675
676  /* Alternative_target */
677  NULL,
678
679  (PTR) MY_backend_data
680};
681#endif /* MY_BFD_TARGET */
682