xref: /openbsd-src/gnu/usr.bin/binutils/bfd/mipsbsd.c (revision 007c2a4539b8b8aaa95c5e73e77620090abe113b)
12159047fSniklas /* BFD backend for MIPS BSD (a.out) binaries.
2c074d1c9Sdrahn    Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003
3b55d4692Sfgsch    Free Software Foundation, Inc.
42159047fSniklas    Written by Ralph Campbell.
52159047fSniklas 
62159047fSniklas This file is part of BFD, the Binary File Descriptor library.
72159047fSniklas 
82159047fSniklas This program is free software; you can redistribute it and/or modify
92159047fSniklas it under the terms of the GNU General Public License as published by
102159047fSniklas the Free Software Foundation; either version 2 of the License, or
112159047fSniklas (at your option) any later version.
122159047fSniklas 
132159047fSniklas This program is distributed in the hope that it will be useful,
142159047fSniklas but WITHOUT ANY WARRANTY; without even the implied warranty of
152159047fSniklas MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
162159047fSniklas GNU General Public License for more details.
172159047fSniklas 
182159047fSniklas You should have received a copy of the GNU General Public License
192159047fSniklas along with this program; if not, write to the Free Software
202159047fSniklas Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
212159047fSniklas 
222159047fSniklas /* #define ENTRY_CAN_BE_ZERO */
232159047fSniklas #define N_HEADER_IN_TEXT(x) 1
242159047fSniklas #define N_SHARED_LIB(x) 0
252159047fSniklas #define N_TXTADDR(x) \
262159047fSniklas     (N_MAGIC(x) != ZMAGIC ? (x).a_entry :	/* object file or NMAGIC */\
272159047fSniklas 	    TEXT_START_ADDR + EXEC_BYTES_SIZE	/* no padding */\
282159047fSniklas     )
292159047fSniklas #define N_DATADDR(x) (N_TXTADDR(x)+N_TXTSIZE(x))
302159047fSniklas #define TEXT_START_ADDR 4096
312159047fSniklas #define TARGET_PAGE_SIZE 4096
322159047fSniklas #define SEGMENT_SIZE TARGET_PAGE_SIZE
332159047fSniklas #define DEFAULT_ARCH bfd_arch_mips
342159047fSniklas #define MACHTYPE_OK(mtype) ((mtype) == M_UNKNOWN \
352159047fSniklas 			    || (mtype) == M_MIPS1 || (mtype) == M_MIPS2)
362159047fSniklas #define MY_symbol_leading_char '\0'
372159047fSniklas 
38c074d1c9Sdrahn /* Do not "beautify" the CONCAT* macro args.  Traditional C will not
39c074d1c9Sdrahn    remove whitespace added here, and thus will fail to concatenate
40c074d1c9Sdrahn    the tokens.  */
41c074d1c9Sdrahn #define MY(OP) CONCAT2 (mipsbsd_,OP)
422159047fSniklas 
432159047fSniklas #include "bfd.h"
442159047fSniklas #include "sysdep.h"
452159047fSniklas #include "libbfd.h"
462159047fSniklas #include "libaout.h"
472159047fSniklas 
482159047fSniklas #define SET_ARCH_MACH(ABFD, EXEC) \
492159047fSniklas   MY(set_arch_mach) (ABFD, N_MACHTYPE (EXEC)); \
502159047fSniklas   MY(choose_reloc_size) (ABFD);
51c074d1c9Sdrahn static void MY(set_arch_mach) PARAMS ((bfd *abfd, unsigned long machtype));
522159047fSniklas static void MY(choose_reloc_size) PARAMS ((bfd *abfd));
532159047fSniklas 
542159047fSniklas #define MY_write_object_contents MY(write_object_contents)
55c074d1c9Sdrahn static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd));
562159047fSniklas 
57c074d1c9Sdrahn /* We can't use MY(x) here because it leads to a recursive call to CONCAT2
582159047fSniklas    when expanded inside JUMP_TABLE.  */
592159047fSniklas #define MY_bfd_reloc_type_lookup mipsbsd_reloc_howto_type_lookup
602159047fSniklas #define MY_canonicalize_reloc mipsbsd_canonicalize_reloc
612159047fSniklas 
622159047fSniklas #define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
632159047fSniklas #define MY_bfd_link_add_symbols _bfd_generic_link_add_symbols
642159047fSniklas #define MY_final_link_callback unused
652159047fSniklas #define MY_bfd_final_link _bfd_generic_final_link
662159047fSniklas 
672159047fSniklas #define MY_backend_data &MY(backend_data)
682159047fSniklas #define MY_BFD_TARGET
692159047fSniklas 
702159047fSniklas #include "aout-target.h"
712159047fSniklas 
72c074d1c9Sdrahn static bfd_reloc_status_type mips_fix_jmp_addr
73*007c2a45Smiod   PARAMS ((bfd *, arelent *, struct bfd_symbol *, PTR, asection *,
74c074d1c9Sdrahn 	   bfd *, char **));
75c074d1c9Sdrahn static reloc_howto_type *MY(reloc_howto_type_lookup)
76c074d1c9Sdrahn   PARAMS ((bfd *, bfd_reloc_code_real_type));
77c074d1c9Sdrahn 
78c074d1c9Sdrahn long MY(canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
79c074d1c9Sdrahn 
80b305b0f1Sespie static void
812159047fSniklas MY(set_arch_mach) (abfd, machtype)
822159047fSniklas      bfd *abfd;
83c074d1c9Sdrahn      unsigned long machtype;
842159047fSniklas {
852159047fSniklas   enum bfd_architecture arch;
86c074d1c9Sdrahn   unsigned int machine;
872159047fSniklas 
882159047fSniklas   /* Determine the architecture and machine type of the object file.  */
89c074d1c9Sdrahn   switch (machtype)
90c074d1c9Sdrahn     {
912159047fSniklas     case M_MIPS1:
922159047fSniklas       arch = bfd_arch_mips;
93c074d1c9Sdrahn       machine = bfd_mach_mips3000;
942159047fSniklas       break;
952159047fSniklas 
962159047fSniklas     case M_MIPS2:
972159047fSniklas       arch = bfd_arch_mips;
98c074d1c9Sdrahn       machine = bfd_mach_mips4000;
992159047fSniklas       break;
1002159047fSniklas 
1012159047fSniklas     default:
1022159047fSniklas       arch = bfd_arch_obscure;
1032159047fSniklas       machine = 0;
1042159047fSniklas       break;
1052159047fSniklas     }
106c074d1c9Sdrahn 
1072159047fSniklas   bfd_set_arch_mach (abfd, arch, machine);
1082159047fSniklas }
1092159047fSniklas 
1102159047fSniklas /* Determine the size of a relocation entry, based on the architecture */
1112159047fSniklas static void
1122159047fSniklas MY (choose_reloc_size) (abfd)
1132159047fSniklas      bfd *abfd;
1142159047fSniklas {
115c074d1c9Sdrahn   switch (bfd_get_arch (abfd))
116c074d1c9Sdrahn     {
1172159047fSniklas     case bfd_arch_sparc:
1182159047fSniklas     case bfd_arch_a29k:
1192159047fSniklas     case bfd_arch_mips:
1202159047fSniklas       obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
1212159047fSniklas       break;
1222159047fSniklas     default:
1232159047fSniklas       obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
1242159047fSniklas       break;
1252159047fSniklas     }
1262159047fSniklas }
1272159047fSniklas 
1282159047fSniklas /* Write an object file in BSD a.out format.
1292159047fSniklas   Section contents have already been written.  We write the
1302159047fSniklas   file header, symbols, and relocation.  */
1312159047fSniklas 
132c074d1c9Sdrahn static bfd_boolean
1332159047fSniklas MY (write_object_contents) (abfd)
1342159047fSniklas      bfd *abfd;
1352159047fSniklas {
1362159047fSniklas   struct external_exec exec_bytes;
1372159047fSniklas   struct internal_exec *execp = exec_hdr (abfd);
1382159047fSniklas 
1392159047fSniklas   /* Magic number, maestro, please!  */
140c074d1c9Sdrahn   switch (bfd_get_arch (abfd))
141c074d1c9Sdrahn     {
1422159047fSniklas     case bfd_arch_m68k:
143c074d1c9Sdrahn       switch (bfd_get_mach (abfd))
144c074d1c9Sdrahn 	{
145b305b0f1Sespie 	case bfd_mach_m68010:
1462159047fSniklas 	  N_SET_MACHTYPE (*execp, M_68010);
1472159047fSniklas 	  break;
1482159047fSniklas 	default:
149b305b0f1Sespie 	case bfd_mach_m68020:
1502159047fSniklas 	  N_SET_MACHTYPE (*execp, M_68020);
1512159047fSniklas 	  break;
1522159047fSniklas 	}
1532159047fSniklas       break;
1542159047fSniklas     case bfd_arch_sparc:
1552159047fSniklas       N_SET_MACHTYPE (*execp, M_SPARC);
1562159047fSniklas       break;
1572159047fSniklas     case bfd_arch_i386:
1582159047fSniklas       N_SET_MACHTYPE (*execp, M_386);
1592159047fSniklas       break;
1602159047fSniklas     case bfd_arch_a29k:
1612159047fSniklas       N_SET_MACHTYPE (*execp, M_29K);
1622159047fSniklas       break;
1632159047fSniklas     case bfd_arch_mips:
164c074d1c9Sdrahn       switch (bfd_get_mach (abfd))
165c074d1c9Sdrahn 	{
166c074d1c9Sdrahn 	case bfd_mach_mips4000:
167c074d1c9Sdrahn 	case bfd_mach_mips6000:
1682159047fSniklas 	  N_SET_MACHTYPE (*execp, M_MIPS2);
1692159047fSniklas 	  break;
1702159047fSniklas 	default:
1712159047fSniklas 	  N_SET_MACHTYPE (*execp, M_MIPS1);
1722159047fSniklas 	  break;
1732159047fSniklas 	}
1742159047fSniklas       break;
1752159047fSniklas     default:
1762159047fSniklas       N_SET_MACHTYPE (*execp, M_UNKNOWN);
1772159047fSniklas     }
1782159047fSniklas 
1792159047fSniklas   MY (choose_reloc_size) (abfd);
1802159047fSniklas 
1812159047fSniklas   WRITE_HEADERS (abfd, execp);
1822159047fSniklas 
183c074d1c9Sdrahn   return TRUE;
1842159047fSniklas }
1852159047fSniklas 
186c074d1c9Sdrahn /* MIPS relocation types.  */
1872159047fSniklas #define MIPS_RELOC_32		0
1882159047fSniklas #define MIPS_RELOC_JMP		1
1892159047fSniklas #define MIPS_RELOC_WDISP16	2
1902159047fSniklas #define MIPS_RELOC_HI16		3
1912159047fSniklas #define MIPS_RELOC_HI16_S	4
1922159047fSniklas #define MIPS_RELOC_LO16		5
1932159047fSniklas 
194c074d1c9Sdrahn /* This is only called when performing a BFD_RELOC_MIPS_JMP relocation.
195c074d1c9Sdrahn    The jump destination address is formed from the upper 4 bits of the
196c074d1c9Sdrahn    "current" program counter concatenated with the jump instruction's
197c074d1c9Sdrahn    26 bit field and two trailing zeros.
198c074d1c9Sdrahn    If the destination address is not in the same segment as the "current"
199c074d1c9Sdrahn    program counter, then we need to signal an error.  */
200c074d1c9Sdrahn 
2012159047fSniklas static bfd_reloc_status_type
mips_fix_jmp_addr(abfd,reloc_entry,symbol,data,input_section,output_bfd,error_message)202c074d1c9Sdrahn mips_fix_jmp_addr (abfd, reloc_entry, symbol, data, input_section, output_bfd,
203c074d1c9Sdrahn 		   error_message)
204b305b0f1Sespie      bfd *abfd ATTRIBUTE_UNUSED;
2052159047fSniklas      arelent *reloc_entry;
206*007c2a45Smiod      struct bfd_symbol *symbol;
207b305b0f1Sespie      PTR data ATTRIBUTE_UNUSED;
2082159047fSniklas      asection *input_section;
2092159047fSniklas      bfd *output_bfd;
210c074d1c9Sdrahn      char **error_message ATTRIBUTE_UNUSED;
2112159047fSniklas {
2122159047fSniklas   bfd_vma relocation, pc;
2132159047fSniklas 
2142159047fSniklas   /* If this is a partial relocation, just continue.  */
2152159047fSniklas   if (output_bfd != (bfd *)NULL)
2162159047fSniklas     return bfd_reloc_continue;
2172159047fSniklas 
2182159047fSniklas   /* If this is an undefined symbol, return error */
2192159047fSniklas   if (bfd_is_und_section (symbol->section)
2202159047fSniklas       && (symbol->flags & BSF_WEAK) == 0)
2212159047fSniklas     return bfd_reloc_undefined;
2222159047fSniklas 
223*007c2a45Smiod   /* Work out which section the relocation is targeted at and the
224c074d1c9Sdrahn      initial relocation command value.  */
2252159047fSniklas   if (bfd_is_com_section (symbol->section))
2262159047fSniklas     relocation = 0;
2272159047fSniklas   else
2282159047fSniklas     relocation = symbol->value;
2292159047fSniklas 
2302159047fSniklas   relocation += symbol->section->output_section->vma;
2312159047fSniklas   relocation += symbol->section->output_offset;
2322159047fSniklas   relocation += reloc_entry->addend;
2332159047fSniklas 
2342159047fSniklas   pc = input_section->output_section->vma + input_section->output_offset +
2352159047fSniklas     reloc_entry->address + 4;
2362159047fSniklas 
2372159047fSniklas   if ((relocation & 0xF0000000) != (pc & 0xF0000000))
2382159047fSniklas     return bfd_reloc_overflow;
2392159047fSniklas 
2402159047fSniklas   return bfd_reloc_continue;
2412159047fSniklas }
2422159047fSniklas 
243c074d1c9Sdrahn /* This is only called when performing a BFD_RELOC_HI16_S relocation.
244c074d1c9Sdrahn    We need to see if bit 15 is set in the result. If it is, we add
245c074d1c9Sdrahn    0x10000 and continue normally. This will compensate for the sign extension
246c074d1c9Sdrahn    when the low bits are added at run time.  */
247c074d1c9Sdrahn 
2482159047fSniklas static bfd_reloc_status_type
2492159047fSniklas mips_fix_hi16_s PARAMS ((bfd *, arelent *, asymbol *, PTR,
2502159047fSniklas 			 asection *, bfd *, char **));
2512159047fSniklas 
2522159047fSniklas static bfd_reloc_status_type
mips_fix_hi16_s(abfd,reloc_entry,symbol,data,input_section,output_bfd,error_message)2532159047fSniklas mips_fix_hi16_s (abfd, reloc_entry, symbol, data, input_section,
2542159047fSniklas 		 output_bfd, error_message)
255b305b0f1Sespie      bfd *abfd ATTRIBUTE_UNUSED;
2562159047fSniklas      arelent *reloc_entry;
2572159047fSniklas      asymbol *symbol;
258b305b0f1Sespie      PTR data ATTRIBUTE_UNUSED;
259b305b0f1Sespie      asection *input_section ATTRIBUTE_UNUSED;
2602159047fSniklas      bfd *output_bfd;
261b305b0f1Sespie      char **error_message ATTRIBUTE_UNUSED;
2622159047fSniklas {
2632159047fSniklas   bfd_vma relocation;
2642159047fSniklas 
2652159047fSniklas   /* If this is a partial relocation, just continue.  */
2662159047fSniklas   if (output_bfd != (bfd *)NULL)
2672159047fSniklas     return bfd_reloc_continue;
2682159047fSniklas 
269c074d1c9Sdrahn   /* If this is an undefined symbol, return error.  */
2702159047fSniklas   if (bfd_is_und_section (symbol->section)
2712159047fSniklas       && (symbol->flags & BSF_WEAK) == 0)
2722159047fSniklas     return bfd_reloc_undefined;
2732159047fSniklas 
274*007c2a45Smiod   /* Work out which section the relocation is targeted at and the
275c074d1c9Sdrahn      initial relocation command value.  */
2762159047fSniklas   if (bfd_is_com_section (symbol->section))
2772159047fSniklas     relocation = 0;
2782159047fSniklas   else
2792159047fSniklas     relocation = symbol->value;
2802159047fSniklas 
2812159047fSniklas   relocation += symbol->section->output_section->vma;
2822159047fSniklas   relocation += symbol->section->output_offset;
2832159047fSniklas   relocation += reloc_entry->addend;
2842159047fSniklas 
2852159047fSniklas   if (relocation & 0x8000)
2862159047fSniklas     reloc_entry->addend += 0x10000;
2872159047fSniklas 
2882159047fSniklas   return bfd_reloc_continue;
2892159047fSniklas }
2902159047fSniklas 
2912159047fSniklas static reloc_howto_type mips_howto_table_ext[] = {
292c074d1c9Sdrahn   {MIPS_RELOC_32,      0, 2, 32, FALSE, 0,  complain_overflow_bitfield, 0,
293c074d1c9Sdrahn 	"32",       FALSE, 0, 0xffffffff, FALSE},
294c074d1c9Sdrahn   {MIPS_RELOC_JMP,     2, 2, 26, FALSE, 0, complain_overflow_dont,
2952159047fSniklas 	mips_fix_jmp_addr,
296c074d1c9Sdrahn 	"MIPS_JMP", FALSE, 0, 0x03ffffff, FALSE},
297c074d1c9Sdrahn   {MIPS_RELOC_WDISP16, 2, 2, 16, TRUE,  0, complain_overflow_signed, 0,
298c074d1c9Sdrahn 	"WDISP16",  FALSE, 0, 0x0000ffff, FALSE},
299c074d1c9Sdrahn   {MIPS_RELOC_HI16,   16, 2, 16, FALSE, 0, complain_overflow_bitfield, 0,
300c074d1c9Sdrahn 	"HI16",     FALSE, 0, 0x0000ffff, FALSE},
301c074d1c9Sdrahn   {MIPS_RELOC_HI16_S, 16, 2, 16, FALSE, 0, complain_overflow_bitfield,
3022159047fSniklas         mips_fix_hi16_s,
303c074d1c9Sdrahn         "HI16_S",   FALSE, 0, 0x0000ffff, FALSE},
304c074d1c9Sdrahn   {MIPS_RELOC_LO16,    0, 2, 16, FALSE, 0, complain_overflow_dont, 0,
305c074d1c9Sdrahn 	"LO16",     FALSE, 0, 0x0000ffff, FALSE},
3062159047fSniklas };
3072159047fSniklas 
3082159047fSniklas static reloc_howto_type *
3092159047fSniklas MY(reloc_howto_type_lookup) (abfd, code)
3102159047fSniklas      bfd *abfd;
3112159047fSniklas      bfd_reloc_code_real_type code;
3122159047fSniklas {
3132159047fSniklas 
3142159047fSniklas   if (bfd_get_arch (abfd) != bfd_arch_mips)
3152159047fSniklas     return 0;
3162159047fSniklas 
3172159047fSniklas   switch (code)
3182159047fSniklas     {
3192159047fSniklas     case BFD_RELOC_CTOR:
3202159047fSniklas     case BFD_RELOC_32:
3212159047fSniklas       return (&mips_howto_table_ext[MIPS_RELOC_32]);
3222159047fSniklas     case BFD_RELOC_MIPS_JMP:
3232159047fSniklas       return (&mips_howto_table_ext[MIPS_RELOC_JMP]);
3242159047fSniklas     case BFD_RELOC_16_PCREL_S2:
3252159047fSniklas       return (&mips_howto_table_ext[MIPS_RELOC_WDISP16]);
3262159047fSniklas     case BFD_RELOC_HI16:
3272159047fSniklas       return (&mips_howto_table_ext[MIPS_RELOC_HI16]);
3282159047fSniklas     case BFD_RELOC_HI16_S:
3292159047fSniklas       return (&mips_howto_table_ext[MIPS_RELOC_HI16_S]);
3302159047fSniklas     case BFD_RELOC_LO16:
3312159047fSniklas       return (&mips_howto_table_ext[MIPS_RELOC_LO16]);
3322159047fSniklas     default:
3332159047fSniklas       return 0;
3342159047fSniklas     }
3352159047fSniklas }
3362159047fSniklas 
337c074d1c9Sdrahn /* This is just like the standard aoutx.h version but we need to do our
338c074d1c9Sdrahn    own mapping of external reloc type values to howto entries.  */
3392159047fSniklas long
3402159047fSniklas MY(canonicalize_reloc) (abfd, section, relptr, symbols)
3412159047fSniklas       bfd *abfd;
3422159047fSniklas       sec_ptr section;
3432159047fSniklas       arelent **relptr;
3442159047fSniklas       asymbol **symbols;
3452159047fSniklas {
3462159047fSniklas   arelent *tblptr = section->relocation;
3472159047fSniklas   unsigned int count, c;
3482159047fSniklas   extern reloc_howto_type NAME(aout,ext_howto_table)[];
3492159047fSniklas 
3502159047fSniklas   /* If we have already read in the relocation table, return the values.  */
351c074d1c9Sdrahn   if (section->flags & SEC_CONSTRUCTOR)
352c074d1c9Sdrahn     {
3532159047fSniklas       arelent_chain *chain = section->constructor_chain;
3542159047fSniklas 
355c074d1c9Sdrahn       for (count = 0; count < section->reloc_count; count++)
356c074d1c9Sdrahn 	{
3572159047fSniklas 	  *relptr++ = &chain->relent;
3582159047fSniklas 	  chain = chain->next;
3592159047fSniklas 	}
3602159047fSniklas       *relptr = 0;
3612159047fSniklas       return section->reloc_count;
3622159047fSniklas     }
363c074d1c9Sdrahn 
364c074d1c9Sdrahn   if (tblptr && section->reloc_count)
365c074d1c9Sdrahn     {
3662159047fSniklas       for (count = 0; count++ < section->reloc_count;)
3672159047fSniklas 	*relptr++ = tblptr++;
3682159047fSniklas       *relptr = 0;
3692159047fSniklas       return section->reloc_count;
3702159047fSniklas     }
3712159047fSniklas 
3722159047fSniklas   if (!NAME(aout,slurp_reloc_table) (abfd, section, symbols))
3732159047fSniklas     return -1;
3742159047fSniklas   tblptr = section->relocation;
3752159047fSniklas 
376c074d1c9Sdrahn   /* fix up howto entries.  */
3772159047fSniklas   for (count = 0; count++ < section->reloc_count;)
3782159047fSniklas     {
3792159047fSniklas       c = tblptr->howto - NAME(aout,ext_howto_table);
3802159047fSniklas       tblptr->howto = &mips_howto_table_ext[c];
3812159047fSniklas 
3822159047fSniklas       *relptr++ = tblptr++;
3832159047fSniklas     }
3842159047fSniklas   *relptr = 0;
3852159047fSniklas   return section->reloc_count;
3862159047fSniklas }
3872159047fSniklas 
388c074d1c9Sdrahn static const struct aout_backend_data MY(backend_data) = {
3892159047fSniklas   0,				/* zmagic contiguous */
3902159047fSniklas   1,				/* text incl header */
391b305b0f1Sespie   0,				/* entry is text address */
3922159047fSniklas   0,				/* exec_hdr_flags */
3932159047fSniklas   TARGET_PAGE_SIZE,			/* text vma */
3942159047fSniklas   MY_set_sizes,
3952159047fSniklas   0,				/* text size includes exec header */
3962159047fSniklas   0,				/* add_dynamic_symbols */
3972159047fSniklas   0,				/* add_one_symbol */
3982159047fSniklas   0,				/* link_dynamic_object */
3992159047fSniklas   0,				/* write_dynamic_symbol */
4002159047fSniklas   0,				/* check_dynamic_reloc */
4012159047fSniklas   0				/* finish_dynamic_link */
4022159047fSniklas };
4032159047fSniklas 
404b305b0f1Sespie extern const bfd_target aout_mips_big_vec;
405b305b0f1Sespie 
4062159047fSniklas const bfd_target aout_mips_little_vec =
4072159047fSniklas   {
4082159047fSniklas     "a.out-mips-little",		/* name */
4092159047fSniklas     bfd_target_aout_flavour,
410c88b1d6cSniklas     BFD_ENDIAN_LITTLE,		/* target byte order (little) */
411c88b1d6cSniklas     BFD_ENDIAN_LITTLE,		/* target headers byte order (little) */
4122159047fSniklas     (HAS_RELOC | EXEC_P |		/* object flags */
4132159047fSniklas      HAS_LINENO | HAS_DEBUG |
4142159047fSniklas      HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
415b305b0f1Sespie     (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
4162159047fSniklas     MY_symbol_leading_char,
4172159047fSniklas     ' ',				/* ar_pad_char */
4182159047fSniklas     15,				/* ar_max_namelen */
4192159047fSniklas     bfd_getl64, bfd_getl_signed_64, bfd_putl64,
4202159047fSniklas     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
4212159047fSniklas     bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
4222159047fSniklas     bfd_getl64, bfd_getl_signed_64, bfd_putl64,
4232159047fSniklas     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
4242159047fSniklas     bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
4252159047fSniklas     {_bfd_dummy_target, MY_object_p, /* bfd_check_format */
4262159047fSniklas      bfd_generic_archive_p, MY_core_file_p},
4272159047fSniklas     {bfd_false, MY_mkobject,	/* bfd_set_format */
4282159047fSniklas      _bfd_generic_mkarchive, bfd_false},
4292159047fSniklas     {bfd_false, MY_write_object_contents, /* bfd_write_contents */
4302159047fSniklas      _bfd_write_archive_contents, bfd_false},
4312159047fSniklas 
4322159047fSniklas     BFD_JUMP_TABLE_GENERIC (MY),
4332159047fSniklas     BFD_JUMP_TABLE_COPY (MY),
4342159047fSniklas     BFD_JUMP_TABLE_CORE (MY),
4352159047fSniklas     BFD_JUMP_TABLE_ARCHIVE (MY),
4362159047fSniklas     BFD_JUMP_TABLE_SYMBOLS (MY),
4372159047fSniklas     BFD_JUMP_TABLE_RELOCS (MY),
4382159047fSniklas     BFD_JUMP_TABLE_WRITE (MY),
4392159047fSniklas     BFD_JUMP_TABLE_LINK (MY),
4402159047fSniklas     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
4412159047fSniklas 
442b305b0f1Sespie     & aout_mips_big_vec,
443b305b0f1Sespie 
444b305b0f1Sespie     (PTR) MY_backend_data
4452159047fSniklas   };
4462159047fSniklas 
4472159047fSniklas const bfd_target aout_mips_big_vec =
4482159047fSniklas   {
4492159047fSniklas     "a.out-mips-big",		/* name */
4502159047fSniklas     bfd_target_aout_flavour,
451c88b1d6cSniklas     BFD_ENDIAN_BIG,		/* target byte order (big) */
452c88b1d6cSniklas     BFD_ENDIAN_BIG,		/* target headers byte order (big) */
4532159047fSniklas     (HAS_RELOC | EXEC_P |		/* object flags */
4542159047fSniklas      HAS_LINENO | HAS_DEBUG |
4552159047fSniklas      HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
456b305b0f1Sespie     (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
4572159047fSniklas     MY_symbol_leading_char,
4582159047fSniklas     ' ',				/* ar_pad_char */
4592159047fSniklas     15,				/* ar_max_namelen */
4602159047fSniklas     bfd_getb64, bfd_getb_signed_64, bfd_putb64,
4612159047fSniklas     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
4622159047fSniklas     bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
4632159047fSniklas     bfd_getb64, bfd_getb_signed_64, bfd_putb64,
4642159047fSniklas     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
4652159047fSniklas     bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
4662159047fSniklas     {_bfd_dummy_target, MY_object_p, /* bfd_check_format */
4672159047fSniklas      bfd_generic_archive_p, MY_core_file_p},
4682159047fSniklas     {bfd_false, MY_mkobject,	/* bfd_set_format */
4692159047fSniklas      _bfd_generic_mkarchive, bfd_false},
4702159047fSniklas     {bfd_false, MY_write_object_contents, /* bfd_write_contents */
4712159047fSniklas      _bfd_write_archive_contents, bfd_false},
4722159047fSniklas 
4732159047fSniklas     BFD_JUMP_TABLE_GENERIC (MY),
4742159047fSniklas     BFD_JUMP_TABLE_COPY (MY),
4752159047fSniklas     BFD_JUMP_TABLE_CORE (MY),
4762159047fSniklas     BFD_JUMP_TABLE_ARCHIVE (MY),
4772159047fSniklas     BFD_JUMP_TABLE_SYMBOLS (MY),
4782159047fSniklas     BFD_JUMP_TABLE_RELOCS (MY),
4792159047fSniklas     BFD_JUMP_TABLE_WRITE (MY),
4802159047fSniklas     BFD_JUMP_TABLE_LINK (MY),
4812159047fSniklas     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
4822159047fSniklas 
483b305b0f1Sespie     & aout_mips_little_vec,
484b305b0f1Sespie 
485b305b0f1Sespie     (PTR) MY_backend_data
4862159047fSniklas   };
487