1*3d8817e4Smiod /* BFD backend for MIPS BSD (a.out) binaries.
2*3d8817e4Smiod Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003
3*3d8817e4Smiod Free Software Foundation, Inc.
4*3d8817e4Smiod Written by Ralph Campbell.
5*3d8817e4Smiod
6*3d8817e4Smiod This file is part of BFD, the Binary File Descriptor library.
7*3d8817e4Smiod
8*3d8817e4Smiod This program is free software; you can redistribute it and/or modify
9*3d8817e4Smiod it under the terms of the GNU General Public License as published by
10*3d8817e4Smiod the Free Software Foundation; either version 2 of the License, or
11*3d8817e4Smiod (at your option) any later version.
12*3d8817e4Smiod
13*3d8817e4Smiod This program is distributed in the hope that it will be useful,
14*3d8817e4Smiod but WITHOUT ANY WARRANTY; without even the implied warranty of
15*3d8817e4Smiod MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16*3d8817e4Smiod GNU General Public License for more details.
17*3d8817e4Smiod
18*3d8817e4Smiod You should have received a copy of the GNU General Public License
19*3d8817e4Smiod along with this program; if not, write to the Free Software
20*3d8817e4Smiod Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
21*3d8817e4Smiod
22*3d8817e4Smiod /* #define ENTRY_CAN_BE_ZERO */
23*3d8817e4Smiod #define N_HEADER_IN_TEXT(x) 1
24*3d8817e4Smiod #define N_SHARED_LIB(x) 0
25*3d8817e4Smiod #define N_TXTADDR(x) \
26*3d8817e4Smiod (N_MAGIC(x) != ZMAGIC ? (x).a_entry : /* object file or NMAGIC */\
27*3d8817e4Smiod TEXT_START_ADDR + EXEC_BYTES_SIZE /* no padding */\
28*3d8817e4Smiod )
29*3d8817e4Smiod #define N_DATADDR(x) (N_TXTADDR(x)+N_TXTSIZE(x))
30*3d8817e4Smiod #define TEXT_START_ADDR 4096
31*3d8817e4Smiod #define TARGET_PAGE_SIZE 4096
32*3d8817e4Smiod #define SEGMENT_SIZE TARGET_PAGE_SIZE
33*3d8817e4Smiod #define DEFAULT_ARCH bfd_arch_mips
34*3d8817e4Smiod #define MACHTYPE_OK(mtype) ((mtype) == M_UNKNOWN \
35*3d8817e4Smiod || (mtype) == M_MIPS1 || (mtype) == M_MIPS2)
36*3d8817e4Smiod #define MY_symbol_leading_char '\0'
37*3d8817e4Smiod
38*3d8817e4Smiod /* Do not "beautify" the CONCAT* macro args. Traditional C will not
39*3d8817e4Smiod remove whitespace added here, and thus will fail to concatenate
40*3d8817e4Smiod the tokens. */
41*3d8817e4Smiod #define MY(OP) CONCAT2 (mipsbsd_,OP)
42*3d8817e4Smiod
43*3d8817e4Smiod #include "bfd.h"
44*3d8817e4Smiod #include "sysdep.h"
45*3d8817e4Smiod #include "libbfd.h"
46*3d8817e4Smiod #include "libaout.h"
47*3d8817e4Smiod
48*3d8817e4Smiod #define SET_ARCH_MACH(ABFD, EXEC) \
49*3d8817e4Smiod MY(set_arch_mach) (ABFD, N_MACHTYPE (EXEC)); \
50*3d8817e4Smiod MY(choose_reloc_size) (ABFD);
51*3d8817e4Smiod static void MY(set_arch_mach) PARAMS ((bfd *abfd, unsigned long machtype));
52*3d8817e4Smiod static void MY(choose_reloc_size) PARAMS ((bfd *abfd));
53*3d8817e4Smiod
54*3d8817e4Smiod #define MY_write_object_contents MY(write_object_contents)
55*3d8817e4Smiod static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd));
56*3d8817e4Smiod
57*3d8817e4Smiod /* We can't use MY(x) here because it leads to a recursive call to CONCAT2
58*3d8817e4Smiod when expanded inside JUMP_TABLE. */
59*3d8817e4Smiod #define MY_bfd_reloc_type_lookup mipsbsd_reloc_howto_type_lookup
60*3d8817e4Smiod #define MY_canonicalize_reloc mipsbsd_canonicalize_reloc
61*3d8817e4Smiod
62*3d8817e4Smiod #define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
63*3d8817e4Smiod #define MY_bfd_link_add_symbols _bfd_generic_link_add_symbols
64*3d8817e4Smiod #define MY_final_link_callback unused
65*3d8817e4Smiod #define MY_bfd_final_link _bfd_generic_final_link
66*3d8817e4Smiod
67*3d8817e4Smiod #define MY_backend_data &MY(backend_data)
68*3d8817e4Smiod #define MY_BFD_TARGET
69*3d8817e4Smiod
70*3d8817e4Smiod #include "aout-target.h"
71*3d8817e4Smiod
72*3d8817e4Smiod static bfd_reloc_status_type mips_fix_jmp_addr
73*3d8817e4Smiod PARAMS ((bfd *, arelent *, struct bfd_symbol *, PTR, asection *,
74*3d8817e4Smiod bfd *, char **));
75*3d8817e4Smiod static reloc_howto_type *MY(reloc_howto_type_lookup)
76*3d8817e4Smiod PARAMS ((bfd *, bfd_reloc_code_real_type));
77*3d8817e4Smiod
78*3d8817e4Smiod long MY(canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
79*3d8817e4Smiod
80*3d8817e4Smiod static void
81*3d8817e4Smiod MY(set_arch_mach) (abfd, machtype)
82*3d8817e4Smiod bfd *abfd;
83*3d8817e4Smiod unsigned long machtype;
84*3d8817e4Smiod {
85*3d8817e4Smiod enum bfd_architecture arch;
86*3d8817e4Smiod unsigned int machine;
87*3d8817e4Smiod
88*3d8817e4Smiod /* Determine the architecture and machine type of the object file. */
89*3d8817e4Smiod switch (machtype)
90*3d8817e4Smiod {
91*3d8817e4Smiod case M_MIPS1:
92*3d8817e4Smiod arch = bfd_arch_mips;
93*3d8817e4Smiod machine = bfd_mach_mips3000;
94*3d8817e4Smiod break;
95*3d8817e4Smiod
96*3d8817e4Smiod case M_MIPS2:
97*3d8817e4Smiod arch = bfd_arch_mips;
98*3d8817e4Smiod machine = bfd_mach_mips4000;
99*3d8817e4Smiod break;
100*3d8817e4Smiod
101*3d8817e4Smiod default:
102*3d8817e4Smiod arch = bfd_arch_obscure;
103*3d8817e4Smiod machine = 0;
104*3d8817e4Smiod break;
105*3d8817e4Smiod }
106*3d8817e4Smiod
107*3d8817e4Smiod bfd_set_arch_mach (abfd, arch, machine);
108*3d8817e4Smiod }
109*3d8817e4Smiod
110*3d8817e4Smiod /* Determine the size of a relocation entry, based on the architecture */
111*3d8817e4Smiod static void
112*3d8817e4Smiod MY (choose_reloc_size) (abfd)
113*3d8817e4Smiod bfd *abfd;
114*3d8817e4Smiod {
115*3d8817e4Smiod switch (bfd_get_arch (abfd))
116*3d8817e4Smiod {
117*3d8817e4Smiod case bfd_arch_sparc:
118*3d8817e4Smiod case bfd_arch_mips:
119*3d8817e4Smiod obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
120*3d8817e4Smiod break;
121*3d8817e4Smiod default:
122*3d8817e4Smiod obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
123*3d8817e4Smiod break;
124*3d8817e4Smiod }
125*3d8817e4Smiod }
126*3d8817e4Smiod
127*3d8817e4Smiod /* Write an object file in BSD a.out format.
128*3d8817e4Smiod Section contents have already been written. We write the
129*3d8817e4Smiod file header, symbols, and relocation. */
130*3d8817e4Smiod
131*3d8817e4Smiod static bfd_boolean
132*3d8817e4Smiod MY (write_object_contents) (abfd)
133*3d8817e4Smiod bfd *abfd;
134*3d8817e4Smiod {
135*3d8817e4Smiod struct external_exec exec_bytes;
136*3d8817e4Smiod struct internal_exec *execp = exec_hdr (abfd);
137*3d8817e4Smiod
138*3d8817e4Smiod /* Magic number, maestro, please! */
139*3d8817e4Smiod switch (bfd_get_arch (abfd))
140*3d8817e4Smiod {
141*3d8817e4Smiod case bfd_arch_m68k:
142*3d8817e4Smiod switch (bfd_get_mach (abfd))
143*3d8817e4Smiod {
144*3d8817e4Smiod case bfd_mach_m68010:
145*3d8817e4Smiod N_SET_MACHTYPE (*execp, M_68010);
146*3d8817e4Smiod break;
147*3d8817e4Smiod default:
148*3d8817e4Smiod case bfd_mach_m68020:
149*3d8817e4Smiod N_SET_MACHTYPE (*execp, M_68020);
150*3d8817e4Smiod break;
151*3d8817e4Smiod }
152*3d8817e4Smiod break;
153*3d8817e4Smiod case bfd_arch_sparc:
154*3d8817e4Smiod N_SET_MACHTYPE (*execp, M_SPARC);
155*3d8817e4Smiod break;
156*3d8817e4Smiod case bfd_arch_i386:
157*3d8817e4Smiod N_SET_MACHTYPE (*execp, M_386);
158*3d8817e4Smiod break;
159*3d8817e4Smiod case bfd_arch_mips:
160*3d8817e4Smiod switch (bfd_get_mach (abfd))
161*3d8817e4Smiod {
162*3d8817e4Smiod case bfd_mach_mips4000:
163*3d8817e4Smiod case bfd_mach_mips6000:
164*3d8817e4Smiod N_SET_MACHTYPE (*execp, M_MIPS2);
165*3d8817e4Smiod break;
166*3d8817e4Smiod default:
167*3d8817e4Smiod N_SET_MACHTYPE (*execp, M_MIPS1);
168*3d8817e4Smiod break;
169*3d8817e4Smiod }
170*3d8817e4Smiod break;
171*3d8817e4Smiod default:
172*3d8817e4Smiod N_SET_MACHTYPE (*execp, M_UNKNOWN);
173*3d8817e4Smiod }
174*3d8817e4Smiod
175*3d8817e4Smiod MY (choose_reloc_size) (abfd);
176*3d8817e4Smiod
177*3d8817e4Smiod WRITE_HEADERS (abfd, execp);
178*3d8817e4Smiod
179*3d8817e4Smiod return TRUE;
180*3d8817e4Smiod }
181*3d8817e4Smiod
182*3d8817e4Smiod /* MIPS relocation types. */
183*3d8817e4Smiod #define MIPS_RELOC_32 0
184*3d8817e4Smiod #define MIPS_RELOC_JMP 1
185*3d8817e4Smiod #define MIPS_RELOC_WDISP16 2
186*3d8817e4Smiod #define MIPS_RELOC_HI16 3
187*3d8817e4Smiod #define MIPS_RELOC_HI16_S 4
188*3d8817e4Smiod #define MIPS_RELOC_LO16 5
189*3d8817e4Smiod
190*3d8817e4Smiod /* This is only called when performing a BFD_RELOC_MIPS_JMP relocation.
191*3d8817e4Smiod The jump destination address is formed from the upper 4 bits of the
192*3d8817e4Smiod "current" program counter concatenated with the jump instruction's
193*3d8817e4Smiod 26 bit field and two trailing zeros.
194*3d8817e4Smiod If the destination address is not in the same segment as the "current"
195*3d8817e4Smiod program counter, then we need to signal an error. */
196*3d8817e4Smiod
197*3d8817e4Smiod static bfd_reloc_status_type
mips_fix_jmp_addr(abfd,reloc_entry,symbol,data,input_section,output_bfd,error_message)198*3d8817e4Smiod mips_fix_jmp_addr (abfd, reloc_entry, symbol, data, input_section, output_bfd,
199*3d8817e4Smiod error_message)
200*3d8817e4Smiod bfd *abfd ATTRIBUTE_UNUSED;
201*3d8817e4Smiod arelent *reloc_entry;
202*3d8817e4Smiod struct bfd_symbol *symbol;
203*3d8817e4Smiod PTR data ATTRIBUTE_UNUSED;
204*3d8817e4Smiod asection *input_section;
205*3d8817e4Smiod bfd *output_bfd;
206*3d8817e4Smiod char **error_message ATTRIBUTE_UNUSED;
207*3d8817e4Smiod {
208*3d8817e4Smiod bfd_vma relocation, pc;
209*3d8817e4Smiod
210*3d8817e4Smiod /* If this is a partial relocation, just continue. */
211*3d8817e4Smiod if (output_bfd != (bfd *)NULL)
212*3d8817e4Smiod return bfd_reloc_continue;
213*3d8817e4Smiod
214*3d8817e4Smiod /* If this is an undefined symbol, return error */
215*3d8817e4Smiod if (bfd_is_und_section (symbol->section)
216*3d8817e4Smiod && (symbol->flags & BSF_WEAK) == 0)
217*3d8817e4Smiod return bfd_reloc_undefined;
218*3d8817e4Smiod
219*3d8817e4Smiod /* Work out which section the relocation is targeted at and the
220*3d8817e4Smiod initial relocation command value. */
221*3d8817e4Smiod if (bfd_is_com_section (symbol->section))
222*3d8817e4Smiod relocation = 0;
223*3d8817e4Smiod else
224*3d8817e4Smiod relocation = symbol->value;
225*3d8817e4Smiod
226*3d8817e4Smiod relocation += symbol->section->output_section->vma;
227*3d8817e4Smiod relocation += symbol->section->output_offset;
228*3d8817e4Smiod relocation += reloc_entry->addend;
229*3d8817e4Smiod
230*3d8817e4Smiod pc = input_section->output_section->vma + input_section->output_offset +
231*3d8817e4Smiod reloc_entry->address + 4;
232*3d8817e4Smiod
233*3d8817e4Smiod if ((relocation & 0xF0000000) != (pc & 0xF0000000))
234*3d8817e4Smiod return bfd_reloc_overflow;
235*3d8817e4Smiod
236*3d8817e4Smiod return bfd_reloc_continue;
237*3d8817e4Smiod }
238*3d8817e4Smiod
239*3d8817e4Smiod /* This is only called when performing a BFD_RELOC_HI16_S relocation.
240*3d8817e4Smiod We need to see if bit 15 is set in the result. If it is, we add
241*3d8817e4Smiod 0x10000 and continue normally. This will compensate for the sign extension
242*3d8817e4Smiod when the low bits are added at run time. */
243*3d8817e4Smiod
244*3d8817e4Smiod static bfd_reloc_status_type
245*3d8817e4Smiod mips_fix_hi16_s PARAMS ((bfd *, arelent *, asymbol *, PTR,
246*3d8817e4Smiod asection *, bfd *, char **));
247*3d8817e4Smiod
248*3d8817e4Smiod static bfd_reloc_status_type
mips_fix_hi16_s(abfd,reloc_entry,symbol,data,input_section,output_bfd,error_message)249*3d8817e4Smiod mips_fix_hi16_s (abfd, reloc_entry, symbol, data, input_section,
250*3d8817e4Smiod output_bfd, error_message)
251*3d8817e4Smiod bfd *abfd ATTRIBUTE_UNUSED;
252*3d8817e4Smiod arelent *reloc_entry;
253*3d8817e4Smiod asymbol *symbol;
254*3d8817e4Smiod PTR data ATTRIBUTE_UNUSED;
255*3d8817e4Smiod asection *input_section ATTRIBUTE_UNUSED;
256*3d8817e4Smiod bfd *output_bfd;
257*3d8817e4Smiod char **error_message ATTRIBUTE_UNUSED;
258*3d8817e4Smiod {
259*3d8817e4Smiod bfd_vma relocation;
260*3d8817e4Smiod
261*3d8817e4Smiod /* If this is a partial relocation, just continue. */
262*3d8817e4Smiod if (output_bfd != (bfd *)NULL)
263*3d8817e4Smiod return bfd_reloc_continue;
264*3d8817e4Smiod
265*3d8817e4Smiod /* If this is an undefined symbol, return error. */
266*3d8817e4Smiod if (bfd_is_und_section (symbol->section)
267*3d8817e4Smiod && (symbol->flags & BSF_WEAK) == 0)
268*3d8817e4Smiod return bfd_reloc_undefined;
269*3d8817e4Smiod
270*3d8817e4Smiod /* Work out which section the relocation is targeted at and the
271*3d8817e4Smiod initial relocation command value. */
272*3d8817e4Smiod if (bfd_is_com_section (symbol->section))
273*3d8817e4Smiod relocation = 0;
274*3d8817e4Smiod else
275*3d8817e4Smiod relocation = symbol->value;
276*3d8817e4Smiod
277*3d8817e4Smiod relocation += symbol->section->output_section->vma;
278*3d8817e4Smiod relocation += symbol->section->output_offset;
279*3d8817e4Smiod relocation += reloc_entry->addend;
280*3d8817e4Smiod
281*3d8817e4Smiod if (relocation & 0x8000)
282*3d8817e4Smiod reloc_entry->addend += 0x10000;
283*3d8817e4Smiod
284*3d8817e4Smiod return bfd_reloc_continue;
285*3d8817e4Smiod }
286*3d8817e4Smiod
287*3d8817e4Smiod static reloc_howto_type mips_howto_table_ext[] = {
288*3d8817e4Smiod {MIPS_RELOC_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, 0,
289*3d8817e4Smiod "32", FALSE, 0, 0xffffffff, FALSE},
290*3d8817e4Smiod {MIPS_RELOC_JMP, 2, 2, 26, FALSE, 0, complain_overflow_dont,
291*3d8817e4Smiod mips_fix_jmp_addr,
292*3d8817e4Smiod "MIPS_JMP", FALSE, 0, 0x03ffffff, FALSE},
293*3d8817e4Smiod {MIPS_RELOC_WDISP16, 2, 2, 16, TRUE, 0, complain_overflow_signed, 0,
294*3d8817e4Smiod "WDISP16", FALSE, 0, 0x0000ffff, FALSE},
295*3d8817e4Smiod {MIPS_RELOC_HI16, 16, 2, 16, FALSE, 0, complain_overflow_bitfield, 0,
296*3d8817e4Smiod "HI16", FALSE, 0, 0x0000ffff, FALSE},
297*3d8817e4Smiod {MIPS_RELOC_HI16_S, 16, 2, 16, FALSE, 0, complain_overflow_bitfield,
298*3d8817e4Smiod mips_fix_hi16_s,
299*3d8817e4Smiod "HI16_S", FALSE, 0, 0x0000ffff, FALSE},
300*3d8817e4Smiod {MIPS_RELOC_LO16, 0, 2, 16, FALSE, 0, complain_overflow_dont, 0,
301*3d8817e4Smiod "LO16", FALSE, 0, 0x0000ffff, FALSE},
302*3d8817e4Smiod };
303*3d8817e4Smiod
304*3d8817e4Smiod static reloc_howto_type *
305*3d8817e4Smiod MY(reloc_howto_type_lookup) (abfd, code)
306*3d8817e4Smiod bfd *abfd;
307*3d8817e4Smiod bfd_reloc_code_real_type code;
308*3d8817e4Smiod {
309*3d8817e4Smiod
310*3d8817e4Smiod if (bfd_get_arch (abfd) != bfd_arch_mips)
311*3d8817e4Smiod return 0;
312*3d8817e4Smiod
313*3d8817e4Smiod switch (code)
314*3d8817e4Smiod {
315*3d8817e4Smiod case BFD_RELOC_CTOR:
316*3d8817e4Smiod case BFD_RELOC_32:
317*3d8817e4Smiod return (&mips_howto_table_ext[MIPS_RELOC_32]);
318*3d8817e4Smiod case BFD_RELOC_MIPS_JMP:
319*3d8817e4Smiod return (&mips_howto_table_ext[MIPS_RELOC_JMP]);
320*3d8817e4Smiod case BFD_RELOC_16_PCREL_S2:
321*3d8817e4Smiod return (&mips_howto_table_ext[MIPS_RELOC_WDISP16]);
322*3d8817e4Smiod case BFD_RELOC_HI16:
323*3d8817e4Smiod return (&mips_howto_table_ext[MIPS_RELOC_HI16]);
324*3d8817e4Smiod case BFD_RELOC_HI16_S:
325*3d8817e4Smiod return (&mips_howto_table_ext[MIPS_RELOC_HI16_S]);
326*3d8817e4Smiod case BFD_RELOC_LO16:
327*3d8817e4Smiod return (&mips_howto_table_ext[MIPS_RELOC_LO16]);
328*3d8817e4Smiod default:
329*3d8817e4Smiod return 0;
330*3d8817e4Smiod }
331*3d8817e4Smiod }
332*3d8817e4Smiod
333*3d8817e4Smiod /* This is just like the standard aoutx.h version but we need to do our
334*3d8817e4Smiod own mapping of external reloc type values to howto entries. */
335*3d8817e4Smiod long
336*3d8817e4Smiod MY(canonicalize_reloc) (abfd, section, relptr, symbols)
337*3d8817e4Smiod bfd *abfd;
338*3d8817e4Smiod sec_ptr section;
339*3d8817e4Smiod arelent **relptr;
340*3d8817e4Smiod asymbol **symbols;
341*3d8817e4Smiod {
342*3d8817e4Smiod arelent *tblptr = section->relocation;
343*3d8817e4Smiod unsigned int count, c;
344*3d8817e4Smiod extern reloc_howto_type NAME(aout,ext_howto_table)[];
345*3d8817e4Smiod
346*3d8817e4Smiod /* If we have already read in the relocation table, return the values. */
347*3d8817e4Smiod if (section->flags & SEC_CONSTRUCTOR)
348*3d8817e4Smiod {
349*3d8817e4Smiod arelent_chain *chain = section->constructor_chain;
350*3d8817e4Smiod
351*3d8817e4Smiod for (count = 0; count < section->reloc_count; count++)
352*3d8817e4Smiod {
353*3d8817e4Smiod *relptr++ = &chain->relent;
354*3d8817e4Smiod chain = chain->next;
355*3d8817e4Smiod }
356*3d8817e4Smiod *relptr = 0;
357*3d8817e4Smiod return section->reloc_count;
358*3d8817e4Smiod }
359*3d8817e4Smiod
360*3d8817e4Smiod if (tblptr && section->reloc_count)
361*3d8817e4Smiod {
362*3d8817e4Smiod for (count = 0; count++ < section->reloc_count;)
363*3d8817e4Smiod *relptr++ = tblptr++;
364*3d8817e4Smiod *relptr = 0;
365*3d8817e4Smiod return section->reloc_count;
366*3d8817e4Smiod }
367*3d8817e4Smiod
368*3d8817e4Smiod if (!NAME(aout,slurp_reloc_table) (abfd, section, symbols))
369*3d8817e4Smiod return -1;
370*3d8817e4Smiod tblptr = section->relocation;
371*3d8817e4Smiod
372*3d8817e4Smiod /* fix up howto entries. */
373*3d8817e4Smiod for (count = 0; count++ < section->reloc_count;)
374*3d8817e4Smiod {
375*3d8817e4Smiod c = tblptr->howto - NAME(aout,ext_howto_table);
376*3d8817e4Smiod tblptr->howto = &mips_howto_table_ext[c];
377*3d8817e4Smiod
378*3d8817e4Smiod *relptr++ = tblptr++;
379*3d8817e4Smiod }
380*3d8817e4Smiod *relptr = 0;
381*3d8817e4Smiod return section->reloc_count;
382*3d8817e4Smiod }
383*3d8817e4Smiod
384*3d8817e4Smiod static const struct aout_backend_data MY(backend_data) = {
385*3d8817e4Smiod 0, /* zmagic contiguous */
386*3d8817e4Smiod 1, /* text incl header */
387*3d8817e4Smiod 0, /* entry is text address */
388*3d8817e4Smiod 0, /* exec_hdr_flags */
389*3d8817e4Smiod TARGET_PAGE_SIZE, /* text vma */
390*3d8817e4Smiod MY_set_sizes,
391*3d8817e4Smiod 0, /* text size includes exec header */
392*3d8817e4Smiod 0, /* add_dynamic_symbols */
393*3d8817e4Smiod 0, /* add_one_symbol */
394*3d8817e4Smiod 0, /* link_dynamic_object */
395*3d8817e4Smiod 0, /* write_dynamic_symbol */
396*3d8817e4Smiod 0, /* check_dynamic_reloc */
397*3d8817e4Smiod 0 /* finish_dynamic_link */
398*3d8817e4Smiod };
399*3d8817e4Smiod
400*3d8817e4Smiod extern const bfd_target aout_mips_big_vec;
401*3d8817e4Smiod
402*3d8817e4Smiod const bfd_target aout_mips_little_vec =
403*3d8817e4Smiod {
404*3d8817e4Smiod "a.out-mips-little", /* name */
405*3d8817e4Smiod bfd_target_aout_flavour,
406*3d8817e4Smiod BFD_ENDIAN_LITTLE, /* target byte order (little) */
407*3d8817e4Smiod BFD_ENDIAN_LITTLE, /* target headers byte order (little) */
408*3d8817e4Smiod (HAS_RELOC | EXEC_P | /* object flags */
409*3d8817e4Smiod HAS_LINENO | HAS_DEBUG |
410*3d8817e4Smiod HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
411*3d8817e4Smiod (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
412*3d8817e4Smiod MY_symbol_leading_char,
413*3d8817e4Smiod ' ', /* ar_pad_char */
414*3d8817e4Smiod 15, /* ar_max_namelen */
415*3d8817e4Smiod bfd_getl64, bfd_getl_signed_64, bfd_putl64,
416*3d8817e4Smiod bfd_getl32, bfd_getl_signed_32, bfd_putl32,
417*3d8817e4Smiod bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
418*3d8817e4Smiod bfd_getl64, bfd_getl_signed_64, bfd_putl64,
419*3d8817e4Smiod bfd_getl32, bfd_getl_signed_32, bfd_putl32,
420*3d8817e4Smiod bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
421*3d8817e4Smiod {_bfd_dummy_target, MY_object_p, /* bfd_check_format */
422*3d8817e4Smiod bfd_generic_archive_p, MY_core_file_p},
423*3d8817e4Smiod {bfd_false, MY_mkobject, /* bfd_set_format */
424*3d8817e4Smiod _bfd_generic_mkarchive, bfd_false},
425*3d8817e4Smiod {bfd_false, MY_write_object_contents, /* bfd_write_contents */
426*3d8817e4Smiod _bfd_write_archive_contents, bfd_false},
427*3d8817e4Smiod
428*3d8817e4Smiod BFD_JUMP_TABLE_GENERIC (MY),
429*3d8817e4Smiod BFD_JUMP_TABLE_COPY (MY),
430*3d8817e4Smiod BFD_JUMP_TABLE_CORE (MY),
431*3d8817e4Smiod BFD_JUMP_TABLE_ARCHIVE (MY),
432*3d8817e4Smiod BFD_JUMP_TABLE_SYMBOLS (MY),
433*3d8817e4Smiod BFD_JUMP_TABLE_RELOCS (MY),
434*3d8817e4Smiod BFD_JUMP_TABLE_WRITE (MY),
435*3d8817e4Smiod BFD_JUMP_TABLE_LINK (MY),
436*3d8817e4Smiod BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
437*3d8817e4Smiod
438*3d8817e4Smiod & aout_mips_big_vec,
439*3d8817e4Smiod
440*3d8817e4Smiod (PTR) MY_backend_data
441*3d8817e4Smiod };
442*3d8817e4Smiod
443*3d8817e4Smiod const bfd_target aout_mips_big_vec =
444*3d8817e4Smiod {
445*3d8817e4Smiod "a.out-mips-big", /* name */
446*3d8817e4Smiod bfd_target_aout_flavour,
447*3d8817e4Smiod BFD_ENDIAN_BIG, /* target byte order (big) */
448*3d8817e4Smiod BFD_ENDIAN_BIG, /* target headers byte order (big) */
449*3d8817e4Smiod (HAS_RELOC | EXEC_P | /* object flags */
450*3d8817e4Smiod HAS_LINENO | HAS_DEBUG |
451*3d8817e4Smiod HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
452*3d8817e4Smiod (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
453*3d8817e4Smiod MY_symbol_leading_char,
454*3d8817e4Smiod ' ', /* ar_pad_char */
455*3d8817e4Smiod 15, /* ar_max_namelen */
456*3d8817e4Smiod bfd_getb64, bfd_getb_signed_64, bfd_putb64,
457*3d8817e4Smiod bfd_getb32, bfd_getb_signed_32, bfd_putb32,
458*3d8817e4Smiod bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
459*3d8817e4Smiod bfd_getb64, bfd_getb_signed_64, bfd_putb64,
460*3d8817e4Smiod bfd_getb32, bfd_getb_signed_32, bfd_putb32,
461*3d8817e4Smiod bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
462*3d8817e4Smiod {_bfd_dummy_target, MY_object_p, /* bfd_check_format */
463*3d8817e4Smiod bfd_generic_archive_p, MY_core_file_p},
464*3d8817e4Smiod {bfd_false, MY_mkobject, /* bfd_set_format */
465*3d8817e4Smiod _bfd_generic_mkarchive, bfd_false},
466*3d8817e4Smiod {bfd_false, MY_write_object_contents, /* bfd_write_contents */
467*3d8817e4Smiod _bfd_write_archive_contents, bfd_false},
468*3d8817e4Smiod
469*3d8817e4Smiod BFD_JUMP_TABLE_GENERIC (MY),
470*3d8817e4Smiod BFD_JUMP_TABLE_COPY (MY),
471*3d8817e4Smiod BFD_JUMP_TABLE_CORE (MY),
472*3d8817e4Smiod BFD_JUMP_TABLE_ARCHIVE (MY),
473*3d8817e4Smiod BFD_JUMP_TABLE_SYMBOLS (MY),
474*3d8817e4Smiod BFD_JUMP_TABLE_RELOCS (MY),
475*3d8817e4Smiod BFD_JUMP_TABLE_WRITE (MY),
476*3d8817e4Smiod BFD_JUMP_TABLE_LINK (MY),
477*3d8817e4Smiod BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
478*3d8817e4Smiod
479*3d8817e4Smiod & aout_mips_little_vec,
480*3d8817e4Smiod
481*3d8817e4Smiod (PTR) MY_backend_data
482*3d8817e4Smiod };
483