1179407Sobrien/* BFD backend for MIPS BSD (a.out) binaries.
2218822Sdim   Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
3218822Sdim   2007 Free Software Foundation, Inc.
4179407Sobrien   Written by Ralph Campbell.
5179407Sobrien
6179407SobrienThis file is part of BFD, the Binary File Descriptor library.
7179407Sobrien
8179407SobrienThis program is free software; you can redistribute it and/or modify
9179407Sobrienit under the terms of the GNU General Public License as published by
10179407Sobrienthe Free Software Foundation; either version 2 of the License, or
11179407Sobrien(at your option) any later version.
12179407Sobrien
13179407SobrienThis program is distributed in the hope that it will be useful,
14179407Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of
15179407SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16179407SobrienGNU General Public License for more details.
17179407Sobrien
18179407SobrienYou should have received a copy of the GNU General Public License
19179407Sobrienalong with this program; if not, write to the Free Software
20218822SdimFoundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
21179407Sobrien
22179407Sobrien/* #define ENTRY_CAN_BE_ZERO */
23179407Sobrien#define N_HEADER_IN_TEXT(x) 1
24179407Sobrien#define N_SHARED_LIB(x) 0
25179407Sobrien#define N_TXTADDR(x) \
26179407Sobrien    (N_MAGIC(x) != ZMAGIC ? (x).a_entry :	/* object file or NMAGIC */\
27179407Sobrien	    TEXT_START_ADDR + EXEC_BYTES_SIZE	/* no padding */\
28179407Sobrien    )
29179407Sobrien#define N_DATADDR(x) (N_TXTADDR(x)+N_TXTSIZE(x))
30179407Sobrien#define TEXT_START_ADDR 4096
31179407Sobrien#define TARGET_PAGE_SIZE 4096
32179407Sobrien#define SEGMENT_SIZE TARGET_PAGE_SIZE
33179407Sobrien#define DEFAULT_ARCH bfd_arch_mips
34179407Sobrien#define MACHTYPE_OK(mtype) ((mtype) == M_UNKNOWN \
35179407Sobrien			    || (mtype) == M_MIPS1 || (mtype) == M_MIPS2)
36179407Sobrien#define MY_symbol_leading_char '\0'
37179407Sobrien
38179407Sobrien/* Do not "beautify" the CONCAT* macro args.  Traditional C will not
39179407Sobrien   remove whitespace added here, and thus will fail to concatenate
40179407Sobrien   the tokens.  */
41179407Sobrien#define MY(OP) CONCAT2 (mipsbsd_,OP)
42179407Sobrien
43218822Sdim#include "sysdep.h"
44179407Sobrien#include "bfd.h"
45179407Sobrien#include "libbfd.h"
46179407Sobrien#include "libaout.h"
47179407Sobrien
48179407Sobrien#define SET_ARCH_MACH(ABFD, EXEC) \
49179407Sobrien  MY(set_arch_mach) (ABFD, N_MACHTYPE (EXEC)); \
50179407Sobrien  MY(choose_reloc_size) (ABFD);
51179407Sobrienstatic void MY(set_arch_mach) PARAMS ((bfd *abfd, unsigned long machtype));
52179407Sobrienstatic void MY(choose_reloc_size) PARAMS ((bfd *abfd));
53179407Sobrien
54179407Sobrien#define MY_write_object_contents MY(write_object_contents)
55179407Sobrienstatic bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd));
56179407Sobrien
57179407Sobrien/* We can't use MY(x) here because it leads to a recursive call to CONCAT2
58179407Sobrien   when expanded inside JUMP_TABLE.  */
59218822Sdim#define MY_bfd_reloc_type_lookup mipsbsd_reloc_type_lookup
60218822Sdim#define MY_bfd_reloc_name_lookup mipsbsd_reloc_name_lookup
61179407Sobrien#define MY_canonicalize_reloc mipsbsd_canonicalize_reloc
62179407Sobrien
63179407Sobrien#define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
64179407Sobrien#define MY_bfd_link_add_symbols _bfd_generic_link_add_symbols
65179407Sobrien#define MY_final_link_callback unused
66179407Sobrien#define MY_bfd_final_link _bfd_generic_final_link
67179407Sobrien
68179407Sobrien#define MY_backend_data &MY(backend_data)
69179407Sobrien#define MY_BFD_TARGET
70179407Sobrien
71179407Sobrien#include "aout-target.h"
72179407Sobrien
73179407Sobrienstatic bfd_reloc_status_type mips_fix_jmp_addr
74179407Sobrien  PARAMS ((bfd *, arelent *, struct bfd_symbol *, PTR, asection *,
75179407Sobrien	   bfd *, char **));
76179407Sobrien
77179407Sobrienlong MY(canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
78179407Sobrien
79179407Sobrienstatic void
80179407SobrienMY(set_arch_mach) (abfd, machtype)
81179407Sobrien     bfd *abfd;
82179407Sobrien     unsigned long machtype;
83179407Sobrien{
84179407Sobrien  enum bfd_architecture arch;
85179407Sobrien  unsigned int machine;
86179407Sobrien
87179407Sobrien  /* Determine the architecture and machine type of the object file.  */
88179407Sobrien  switch (machtype)
89179407Sobrien    {
90179407Sobrien    case M_MIPS1:
91179407Sobrien      arch = bfd_arch_mips;
92179407Sobrien      machine = bfd_mach_mips3000;
93179407Sobrien      break;
94179407Sobrien
95179407Sobrien    case M_MIPS2:
96179407Sobrien      arch = bfd_arch_mips;
97179407Sobrien      machine = bfd_mach_mips4000;
98179407Sobrien      break;
99179407Sobrien
100179407Sobrien    default:
101179407Sobrien      arch = bfd_arch_obscure;
102179407Sobrien      machine = 0;
103179407Sobrien      break;
104179407Sobrien    }
105179407Sobrien
106179407Sobrien  bfd_set_arch_mach (abfd, arch, machine);
107179407Sobrien}
108179407Sobrien
109179407Sobrien/* Determine the size of a relocation entry, based on the architecture */
110179407Sobrienstatic void
111179407SobrienMY (choose_reloc_size) (abfd)
112179407Sobrien     bfd *abfd;
113179407Sobrien{
114179407Sobrien  switch (bfd_get_arch (abfd))
115179407Sobrien    {
116179407Sobrien    case bfd_arch_sparc:
117179407Sobrien    case bfd_arch_mips:
118179407Sobrien      obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
119179407Sobrien      break;
120179407Sobrien    default:
121179407Sobrien      obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
122179407Sobrien      break;
123179407Sobrien    }
124179407Sobrien}
125179407Sobrien
126179407Sobrien/* Write an object file in BSD a.out format.
127179407Sobrien  Section contents have already been written.  We write the
128179407Sobrien  file header, symbols, and relocation.  */
129179407Sobrien
130179407Sobrienstatic bfd_boolean
131179407SobrienMY (write_object_contents) (abfd)
132179407Sobrien     bfd *abfd;
133179407Sobrien{
134179407Sobrien  struct external_exec exec_bytes;
135179407Sobrien  struct internal_exec *execp = exec_hdr (abfd);
136179407Sobrien
137179407Sobrien  /* Magic number, maestro, please!  */
138179407Sobrien  switch (bfd_get_arch (abfd))
139179407Sobrien    {
140179407Sobrien    case bfd_arch_m68k:
141179407Sobrien      switch (bfd_get_mach (abfd))
142179407Sobrien	{
143179407Sobrien	case bfd_mach_m68010:
144179407Sobrien	  N_SET_MACHTYPE (*execp, M_68010);
145179407Sobrien	  break;
146179407Sobrien	default:
147179407Sobrien	case bfd_mach_m68020:
148179407Sobrien	  N_SET_MACHTYPE (*execp, M_68020);
149179407Sobrien	  break;
150179407Sobrien	}
151179407Sobrien      break;
152179407Sobrien    case bfd_arch_sparc:
153179407Sobrien      N_SET_MACHTYPE (*execp, M_SPARC);
154179407Sobrien      break;
155179407Sobrien    case bfd_arch_i386:
156179407Sobrien      N_SET_MACHTYPE (*execp, M_386);
157179407Sobrien      break;
158179407Sobrien    case bfd_arch_mips:
159179407Sobrien      switch (bfd_get_mach (abfd))
160179407Sobrien	{
161179407Sobrien	case bfd_mach_mips4000:
162179407Sobrien	case bfd_mach_mips6000:
163179407Sobrien	  N_SET_MACHTYPE (*execp, M_MIPS2);
164179407Sobrien	  break;
165179407Sobrien	default:
166179407Sobrien	  N_SET_MACHTYPE (*execp, M_MIPS1);
167179407Sobrien	  break;
168179407Sobrien	}
169179407Sobrien      break;
170179407Sobrien    default:
171179407Sobrien      N_SET_MACHTYPE (*execp, M_UNKNOWN);
172179407Sobrien    }
173179407Sobrien
174179407Sobrien  MY (choose_reloc_size) (abfd);
175179407Sobrien
176179407Sobrien  WRITE_HEADERS (abfd, execp);
177179407Sobrien
178179407Sobrien  return TRUE;
179179407Sobrien}
180179407Sobrien
181179407Sobrien/* MIPS relocation types.  */
182179407Sobrien#define MIPS_RELOC_32		0
183179407Sobrien#define MIPS_RELOC_JMP		1
184179407Sobrien#define MIPS_RELOC_WDISP16	2
185179407Sobrien#define MIPS_RELOC_HI16		3
186179407Sobrien#define MIPS_RELOC_HI16_S	4
187179407Sobrien#define MIPS_RELOC_LO16		5
188179407Sobrien
189179407Sobrien/* This is only called when performing a BFD_RELOC_MIPS_JMP relocation.
190179407Sobrien   The jump destination address is formed from the upper 4 bits of the
191179407Sobrien   "current" program counter concatenated with the jump instruction's
192179407Sobrien   26 bit field and two trailing zeros.
193179407Sobrien   If the destination address is not in the same segment as the "current"
194179407Sobrien   program counter, then we need to signal an error.  */
195179407Sobrien
196179407Sobrienstatic bfd_reloc_status_type
197179407Sobrienmips_fix_jmp_addr (abfd, reloc_entry, symbol, data, input_section, output_bfd,
198179407Sobrien		   error_message)
199179407Sobrien     bfd *abfd ATTRIBUTE_UNUSED;
200179407Sobrien     arelent *reloc_entry;
201179407Sobrien     struct bfd_symbol *symbol;
202179407Sobrien     PTR data ATTRIBUTE_UNUSED;
203179407Sobrien     asection *input_section;
204179407Sobrien     bfd *output_bfd;
205179407Sobrien     char **error_message ATTRIBUTE_UNUSED;
206179407Sobrien{
207179407Sobrien  bfd_vma relocation, pc;
208179407Sobrien
209179407Sobrien  /* If this is a partial relocation, just continue.  */
210179407Sobrien  if (output_bfd != (bfd *)NULL)
211179407Sobrien    return bfd_reloc_continue;
212179407Sobrien
213179407Sobrien  /* If this is an undefined symbol, return error */
214179407Sobrien  if (bfd_is_und_section (symbol->section)
215179407Sobrien      && (symbol->flags & BSF_WEAK) == 0)
216179407Sobrien    return bfd_reloc_undefined;
217179407Sobrien
218179407Sobrien  /* Work out which section the relocation is targeted at and the
219179407Sobrien     initial relocation command value.  */
220179407Sobrien  if (bfd_is_com_section (symbol->section))
221179407Sobrien    relocation = 0;
222179407Sobrien  else
223179407Sobrien    relocation = symbol->value;
224179407Sobrien
225179407Sobrien  relocation += symbol->section->output_section->vma;
226179407Sobrien  relocation += symbol->section->output_offset;
227179407Sobrien  relocation += reloc_entry->addend;
228179407Sobrien
229179407Sobrien  pc = input_section->output_section->vma + input_section->output_offset +
230179407Sobrien    reloc_entry->address + 4;
231179407Sobrien
232179407Sobrien  if ((relocation & 0xF0000000) != (pc & 0xF0000000))
233179407Sobrien    return bfd_reloc_overflow;
234179407Sobrien
235179407Sobrien  return bfd_reloc_continue;
236179407Sobrien}
237179407Sobrien
238179407Sobrien/* This is only called when performing a BFD_RELOC_HI16_S relocation.
239179407Sobrien   We need to see if bit 15 is set in the result. If it is, we add
240179407Sobrien   0x10000 and continue normally. This will compensate for the sign extension
241179407Sobrien   when the low bits are added at run time.  */
242179407Sobrien
243179407Sobrienstatic bfd_reloc_status_type
244179407Sobrienmips_fix_hi16_s PARAMS ((bfd *, arelent *, asymbol *, PTR,
245179407Sobrien			 asection *, bfd *, char **));
246179407Sobrien
247179407Sobrienstatic bfd_reloc_status_type
248179407Sobrienmips_fix_hi16_s (abfd, reloc_entry, symbol, data, input_section,
249179407Sobrien		 output_bfd, error_message)
250179407Sobrien     bfd *abfd ATTRIBUTE_UNUSED;
251179407Sobrien     arelent *reloc_entry;
252179407Sobrien     asymbol *symbol;
253179407Sobrien     PTR data ATTRIBUTE_UNUSED;
254179407Sobrien     asection *input_section ATTRIBUTE_UNUSED;
255179407Sobrien     bfd *output_bfd;
256179407Sobrien     char **error_message ATTRIBUTE_UNUSED;
257179407Sobrien{
258179407Sobrien  bfd_vma relocation;
259179407Sobrien
260179407Sobrien  /* If this is a partial relocation, just continue.  */
261179407Sobrien  if (output_bfd != (bfd *)NULL)
262179407Sobrien    return bfd_reloc_continue;
263179407Sobrien
264179407Sobrien  /* If this is an undefined symbol, return error.  */
265179407Sobrien  if (bfd_is_und_section (symbol->section)
266179407Sobrien      && (symbol->flags & BSF_WEAK) == 0)
267179407Sobrien    return bfd_reloc_undefined;
268179407Sobrien
269179407Sobrien  /* Work out which section the relocation is targeted at and the
270179407Sobrien     initial relocation command value.  */
271179407Sobrien  if (bfd_is_com_section (symbol->section))
272179407Sobrien    relocation = 0;
273179407Sobrien  else
274179407Sobrien    relocation = symbol->value;
275179407Sobrien
276179407Sobrien  relocation += symbol->section->output_section->vma;
277179407Sobrien  relocation += symbol->section->output_offset;
278179407Sobrien  relocation += reloc_entry->addend;
279179407Sobrien
280179407Sobrien  if (relocation & 0x8000)
281179407Sobrien    reloc_entry->addend += 0x10000;
282179407Sobrien
283179407Sobrien  return bfd_reloc_continue;
284179407Sobrien}
285179407Sobrien
286179407Sobrienstatic reloc_howto_type mips_howto_table_ext[] = {
287179407Sobrien  {MIPS_RELOC_32,      0, 2, 32, FALSE, 0,  complain_overflow_bitfield, 0,
288179407Sobrien	"32",       FALSE, 0, 0xffffffff, FALSE},
289179407Sobrien  {MIPS_RELOC_JMP,     2, 2, 26, FALSE, 0, complain_overflow_dont,
290179407Sobrien	mips_fix_jmp_addr,
291179407Sobrien	"MIPS_JMP", FALSE, 0, 0x03ffffff, FALSE},
292179407Sobrien  {MIPS_RELOC_WDISP16, 2, 2, 16, TRUE,  0, complain_overflow_signed, 0,
293179407Sobrien	"WDISP16",  FALSE, 0, 0x0000ffff, FALSE},
294179407Sobrien  {MIPS_RELOC_HI16,   16, 2, 16, FALSE, 0, complain_overflow_bitfield, 0,
295179407Sobrien	"HI16",     FALSE, 0, 0x0000ffff, FALSE},
296179407Sobrien  {MIPS_RELOC_HI16_S, 16, 2, 16, FALSE, 0, complain_overflow_bitfield,
297179407Sobrien        mips_fix_hi16_s,
298179407Sobrien        "HI16_S",   FALSE, 0, 0x0000ffff, FALSE},
299179407Sobrien  {MIPS_RELOC_LO16,    0, 2, 16, FALSE, 0, complain_overflow_dont, 0,
300179407Sobrien	"LO16",     FALSE, 0, 0x0000ffff, FALSE},
301179407Sobrien};
302179407Sobrien
303179407Sobrienstatic reloc_howto_type *
304218822SdimMY(reloc_type_lookup) (bfd *abfd, bfd_reloc_code_real_type code)
305179407Sobrien{
306179407Sobrien
307179407Sobrien  if (bfd_get_arch (abfd) != bfd_arch_mips)
308179407Sobrien    return 0;
309179407Sobrien
310179407Sobrien  switch (code)
311179407Sobrien    {
312179407Sobrien    case BFD_RELOC_CTOR:
313179407Sobrien    case BFD_RELOC_32:
314179407Sobrien      return (&mips_howto_table_ext[MIPS_RELOC_32]);
315179407Sobrien    case BFD_RELOC_MIPS_JMP:
316179407Sobrien      return (&mips_howto_table_ext[MIPS_RELOC_JMP]);
317179407Sobrien    case BFD_RELOC_16_PCREL_S2:
318179407Sobrien      return (&mips_howto_table_ext[MIPS_RELOC_WDISP16]);
319179407Sobrien    case BFD_RELOC_HI16:
320179407Sobrien      return (&mips_howto_table_ext[MIPS_RELOC_HI16]);
321179407Sobrien    case BFD_RELOC_HI16_S:
322179407Sobrien      return (&mips_howto_table_ext[MIPS_RELOC_HI16_S]);
323179407Sobrien    case BFD_RELOC_LO16:
324179407Sobrien      return (&mips_howto_table_ext[MIPS_RELOC_LO16]);
325179407Sobrien    default:
326179407Sobrien      return 0;
327179407Sobrien    }
328179407Sobrien}
329179407Sobrien
330218822Sdimstatic reloc_howto_type *
331218822SdimMY(reloc_name_lookup) (bfd *abfd ATTRIBUTE_UNUSED,
332218822Sdim			     const char *r_name)
333218822Sdim{
334218822Sdim  unsigned int i;
335218822Sdim
336218822Sdim  for (i = 0;
337218822Sdim       i < sizeof (mips_howto_table_ext) / sizeof (mips_howto_table_ext[0]);
338218822Sdim       i++)
339218822Sdim    if (mips_howto_table_ext[i].name != NULL
340218822Sdim	&& strcasecmp (mips_howto_table_ext[i].name, r_name) == 0)
341218822Sdim      return &mips_howto_table_ext[i];
342218822Sdim
343218822Sdim  return NULL;
344218822Sdim}
345218822Sdim
346179407Sobrien/* This is just like the standard aoutx.h version but we need to do our
347179407Sobrien   own mapping of external reloc type values to howto entries.  */
348179407Sobrienlong
349179407SobrienMY(canonicalize_reloc) (abfd, section, relptr, symbols)
350179407Sobrien      bfd *abfd;
351179407Sobrien      sec_ptr section;
352179407Sobrien      arelent **relptr;
353179407Sobrien      asymbol **symbols;
354179407Sobrien{
355179407Sobrien  arelent *tblptr = section->relocation;
356179407Sobrien  unsigned int count, c;
357179407Sobrien  extern reloc_howto_type NAME(aout,ext_howto_table)[];
358179407Sobrien
359179407Sobrien  /* If we have already read in the relocation table, return the values.  */
360179407Sobrien  if (section->flags & SEC_CONSTRUCTOR)
361179407Sobrien    {
362179407Sobrien      arelent_chain *chain = section->constructor_chain;
363179407Sobrien
364179407Sobrien      for (count = 0; count < section->reloc_count; count++)
365179407Sobrien	{
366179407Sobrien	  *relptr++ = &chain->relent;
367179407Sobrien	  chain = chain->next;
368179407Sobrien	}
369179407Sobrien      *relptr = 0;
370179407Sobrien      return section->reloc_count;
371179407Sobrien    }
372179407Sobrien
373179407Sobrien  if (tblptr && section->reloc_count)
374179407Sobrien    {
375179407Sobrien      for (count = 0; count++ < section->reloc_count;)
376179407Sobrien	*relptr++ = tblptr++;
377179407Sobrien      *relptr = 0;
378179407Sobrien      return section->reloc_count;
379179407Sobrien    }
380179407Sobrien
381179407Sobrien  if (!NAME(aout,slurp_reloc_table) (abfd, section, symbols))
382179407Sobrien    return -1;
383179407Sobrien  tblptr = section->relocation;
384179407Sobrien
385179407Sobrien  /* fix up howto entries.  */
386179407Sobrien  for (count = 0; count++ < section->reloc_count;)
387179407Sobrien    {
388179407Sobrien      c = tblptr->howto - NAME(aout,ext_howto_table);
389179407Sobrien      tblptr->howto = &mips_howto_table_ext[c];
390179407Sobrien
391179407Sobrien      *relptr++ = tblptr++;
392179407Sobrien    }
393179407Sobrien  *relptr = 0;
394179407Sobrien  return section->reloc_count;
395179407Sobrien}
396179407Sobrien
397179407Sobrienstatic const struct aout_backend_data MY(backend_data) = {
398179407Sobrien  0,				/* zmagic contiguous */
399179407Sobrien  1,				/* text incl header */
400179407Sobrien  0,				/* entry is text address */
401179407Sobrien  0,				/* exec_hdr_flags */
402179407Sobrien  TARGET_PAGE_SIZE,			/* text vma */
403179407Sobrien  MY_set_sizes,
404179407Sobrien  0,				/* text size includes exec header */
405179407Sobrien  0,				/* add_dynamic_symbols */
406179407Sobrien  0,				/* add_one_symbol */
407179407Sobrien  0,				/* link_dynamic_object */
408179407Sobrien  0,				/* write_dynamic_symbol */
409179407Sobrien  0,				/* check_dynamic_reloc */
410179407Sobrien  0				/* finish_dynamic_link */
411179407Sobrien};
412179407Sobrien
413179407Sobrienextern const bfd_target aout_mips_big_vec;
414179407Sobrien
415179407Sobrienconst bfd_target aout_mips_little_vec =
416179407Sobrien  {
417179407Sobrien    "a.out-mips-little",		/* name */
418179407Sobrien    bfd_target_aout_flavour,
419179407Sobrien    BFD_ENDIAN_LITTLE,		/* target byte order (little) */
420179407Sobrien    BFD_ENDIAN_LITTLE,		/* target headers byte order (little) */
421179407Sobrien    (HAS_RELOC | EXEC_P |		/* object flags */
422179407Sobrien     HAS_LINENO | HAS_DEBUG |
423179407Sobrien     HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
424179407Sobrien    (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
425179407Sobrien    MY_symbol_leading_char,
426179407Sobrien    ' ',				/* ar_pad_char */
427179407Sobrien    15,				/* ar_max_namelen */
428179407Sobrien    bfd_getl64, bfd_getl_signed_64, bfd_putl64,
429179407Sobrien    bfd_getl32, bfd_getl_signed_32, bfd_putl32,
430179407Sobrien    bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
431179407Sobrien    bfd_getl64, bfd_getl_signed_64, bfd_putl64,
432179407Sobrien    bfd_getl32, bfd_getl_signed_32, bfd_putl32,
433179407Sobrien    bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
434179407Sobrien    {_bfd_dummy_target, MY_object_p, /* bfd_check_format */
435179407Sobrien     bfd_generic_archive_p, MY_core_file_p},
436179407Sobrien    {bfd_false, MY_mkobject,	/* bfd_set_format */
437179407Sobrien     _bfd_generic_mkarchive, bfd_false},
438179407Sobrien    {bfd_false, MY_write_object_contents, /* bfd_write_contents */
439179407Sobrien     _bfd_write_archive_contents, bfd_false},
440179407Sobrien
441179407Sobrien    BFD_JUMP_TABLE_GENERIC (MY),
442179407Sobrien    BFD_JUMP_TABLE_COPY (MY),
443179407Sobrien    BFD_JUMP_TABLE_CORE (MY),
444179407Sobrien    BFD_JUMP_TABLE_ARCHIVE (MY),
445179407Sobrien    BFD_JUMP_TABLE_SYMBOLS (MY),
446179407Sobrien    BFD_JUMP_TABLE_RELOCS (MY),
447179407Sobrien    BFD_JUMP_TABLE_WRITE (MY),
448179407Sobrien    BFD_JUMP_TABLE_LINK (MY),
449179407Sobrien    BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
450179407Sobrien
451179407Sobrien    & aout_mips_big_vec,
452179407Sobrien
453179407Sobrien    (PTR) MY_backend_data
454179407Sobrien  };
455179407Sobrien
456179407Sobrienconst bfd_target aout_mips_big_vec =
457179407Sobrien  {
458179407Sobrien    "a.out-mips-big",		/* name */
459179407Sobrien    bfd_target_aout_flavour,
460179407Sobrien    BFD_ENDIAN_BIG,		/* target byte order (big) */
461179407Sobrien    BFD_ENDIAN_BIG,		/* target headers byte order (big) */
462179407Sobrien    (HAS_RELOC | EXEC_P |		/* object flags */
463179407Sobrien     HAS_LINENO | HAS_DEBUG |
464179407Sobrien     HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
465179407Sobrien    (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
466179407Sobrien    MY_symbol_leading_char,
467179407Sobrien    ' ',				/* ar_pad_char */
468179407Sobrien    15,				/* ar_max_namelen */
469179407Sobrien    bfd_getb64, bfd_getb_signed_64, bfd_putb64,
470179407Sobrien    bfd_getb32, bfd_getb_signed_32, bfd_putb32,
471179407Sobrien    bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
472179407Sobrien    bfd_getb64, bfd_getb_signed_64, bfd_putb64,
473179407Sobrien    bfd_getb32, bfd_getb_signed_32, bfd_putb32,
474179407Sobrien    bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
475179407Sobrien    {_bfd_dummy_target, MY_object_p, /* bfd_check_format */
476179407Sobrien     bfd_generic_archive_p, MY_core_file_p},
477179407Sobrien    {bfd_false, MY_mkobject,	/* bfd_set_format */
478179407Sobrien     _bfd_generic_mkarchive, bfd_false},
479179407Sobrien    {bfd_false, MY_write_object_contents, /* bfd_write_contents */
480179407Sobrien     _bfd_write_archive_contents, bfd_false},
481179407Sobrien
482179407Sobrien    BFD_JUMP_TABLE_GENERIC (MY),
483179407Sobrien    BFD_JUMP_TABLE_COPY (MY),
484179407Sobrien    BFD_JUMP_TABLE_CORE (MY),
485179407Sobrien    BFD_JUMP_TABLE_ARCHIVE (MY),
486179407Sobrien    BFD_JUMP_TABLE_SYMBOLS (MY),
487179407Sobrien    BFD_JUMP_TABLE_RELOCS (MY),
488179407Sobrien    BFD_JUMP_TABLE_WRITE (MY),
489179407Sobrien    BFD_JUMP_TABLE_LINK (MY),
490179407Sobrien    BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
491179407Sobrien
492179407Sobrien    & aout_mips_little_vec,
493179407Sobrien
494179407Sobrien    (PTR) MY_backend_data
495179407Sobrien  };
496