1 /* BFD back-end for MIPS Extended-Coff files.
2 Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
3 Original version by Per Bothner.
6 This file is part of BFD, the Binary File Descriptor library.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
26 #include "coff/internal.h"
28 #include "coff/symconst.h"
29 #include "coff/ecoff.h"
30 #include "coff/mips.h"
34 /* Prototypes for static functions. */
36 static boolean mips_ecoff_bad_format_hook PARAMS ((bfd *abfd, PTR filehdr));
37 static void mips_ecoff_swap_reloc_in PARAMS ((bfd *, PTR,
38 struct internal_reloc *));
39 static void mips_ecoff_swap_reloc_out PARAMS ((bfd *,
40 const struct internal_reloc *,
42 static void mips_adjust_reloc_in PARAMS ((bfd *,
43 const struct internal_reloc *,
45 static void mips_adjust_reloc_out PARAMS ((bfd *, const arelent *,
46 struct internal_reloc *));
47 static bfd_reloc_status_type mips_generic_reloc PARAMS ((bfd *abfd,
53 static bfd_reloc_status_type mips_refhi_reloc PARAMS ((bfd *abfd,
59 static bfd_reloc_status_type mips_reflo_reloc PARAMS ((bfd *abfd,
65 static bfd_reloc_status_type mips_gprel_reloc PARAMS ((bfd *abfd,
72 /* ECOFF has COFF sections, but the debugging information is stored in
73 a completely different format. ECOFF targets use some of the
74 swapping routines from coffswap.h, and some of the generic COFF
75 routines in coffgen.c, but, unlike the real COFF targets, do not
76 use coffcode.h itself.
78 Get the generic COFF swapping routines, except for the reloc,
79 symbol, and lineno ones. Give them ECOFF names. */
81 #define NO_COFF_RELOCS
82 #define NO_COFF_SYMBOLS
83 #define NO_COFF_LINENOS
84 #define coff_swap_filehdr_in mips_ecoff_swap_filehdr_in
85 #define coff_swap_filehdr_out mips_ecoff_swap_filehdr_out
86 #define coff_swap_aouthdr_in mips_ecoff_swap_aouthdr_in
87 #define coff_swap_aouthdr_out mips_ecoff_swap_aouthdr_out
88 #define coff_swap_scnhdr_in mips_ecoff_swap_scnhdr_in
89 #define coff_swap_scnhdr_out mips_ecoff_swap_scnhdr_out
92 /* Get the ECOFF swapping routines. */
94 #include "ecoffswap.h"
96 /* How to process the various relocs types. */
98 static reloc_howto_type mips_howto_table[] =
100 /* Reloc type 0 is ignored. The reloc reading code ensures that
101 this is a reference to the .abs section, which will cause
102 bfd_perform_relocation to do nothing. */
103 HOWTO (MIPS_R_IGNORE, /* type */
105 0, /* size (0 = byte, 1 = short, 2 = long) */
107 false, /* pc_relative */
109 complain_overflow_dont, /* complain_on_overflow */
110 0, /* special_function */
112 false, /* partial_inplace */
115 false), /* pcrel_offset */
117 /* A 16 bit reference to a symbol, normally from a data section. */
118 HOWTO (MIPS_R_REFHALF, /* type */
120 1, /* size (0 = byte, 1 = short, 2 = long) */
122 false, /* pc_relative */
124 complain_overflow_bitfield, /* complain_on_overflow */
125 mips_generic_reloc, /* special_function */
126 "REFHALF", /* name */
127 true, /* partial_inplace */
128 0xffff, /* src_mask */
129 0xffff, /* dst_mask */
130 false), /* pcrel_offset */
132 /* A 32 bit reference to a symbol, normally from a data section. */
133 HOWTO (MIPS_R_REFWORD, /* type */
135 2, /* size (0 = byte, 1 = short, 2 = long) */
137 false, /* pc_relative */
139 complain_overflow_bitfield, /* complain_on_overflow */
140 mips_generic_reloc, /* special_function */
141 "REFWORD", /* name */
142 true, /* partial_inplace */
143 0xffffffff, /* src_mask */
144 0xffffffff, /* dst_mask */
145 false), /* pcrel_offset */
147 /* A 26 bit absolute jump address. */
148 HOWTO (MIPS_R_JMPADDR, /* type */
150 2, /* size (0 = byte, 1 = short, 2 = long) */
152 false, /* pc_relative */
154 complain_overflow_dont, /* complain_on_overflow */
155 /* This needs complex overflow
156 detection, because the upper four
157 bits must match the PC. */
158 mips_generic_reloc, /* special_function */
159 "JMPADDR", /* name */
160 true, /* partial_inplace */
161 0x3ffffff, /* src_mask */
162 0x3ffffff, /* dst_mask */
163 false), /* pcrel_offset */
165 /* The high 16 bits of a symbol value. Handled by the function
167 HOWTO (MIPS_R_REFHI, /* type */
169 2, /* size (0 = byte, 1 = short, 2 = long) */
171 false, /* pc_relative */
173 complain_overflow_bitfield, /* complain_on_overflow */
174 mips_refhi_reloc, /* special_function */
176 true, /* partial_inplace */
177 0xffff, /* src_mask */
178 0xffff, /* dst_mask */
179 false), /* pcrel_offset */
181 /* The low 16 bits of a symbol value. */
182 HOWTO (MIPS_R_REFLO, /* type */
184 2, /* size (0 = byte, 1 = short, 2 = long) */
186 false, /* pc_relative */
188 complain_overflow_dont, /* complain_on_overflow */
189 mips_reflo_reloc, /* special_function */
191 true, /* partial_inplace */
192 0xffff, /* src_mask */
193 0xffff, /* dst_mask */
194 false), /* pcrel_offset */
196 /* A reference to an offset from the gp register. Handled by the
197 function mips_gprel_reloc. */
198 HOWTO (MIPS_R_GPREL, /* type */
200 2, /* size (0 = byte, 1 = short, 2 = long) */
202 false, /* pc_relative */
204 complain_overflow_signed, /* complain_on_overflow */
205 mips_gprel_reloc, /* special_function */
207 true, /* partial_inplace */
208 0xffff, /* src_mask */
209 0xffff, /* dst_mask */
210 false), /* pcrel_offset */
212 /* A reference to a literal using an offset from the gp register.
213 Handled by the function mips_gprel_reloc. */
214 HOWTO (MIPS_R_LITERAL, /* type */
216 2, /* size (0 = byte, 1 = short, 2 = long) */
218 false, /* pc_relative */
220 complain_overflow_signed, /* complain_on_overflow */
221 mips_gprel_reloc, /* special_function */
222 "LITERAL", /* name */
223 true, /* partial_inplace */
224 0xffff, /* src_mask */
225 0xffff, /* dst_mask */
226 false) /* pcrel_offset */
229 #define MIPS_HOWTO_COUNT \
230 (sizeof mips_howto_table / sizeof mips_howto_table[0])
232 /* See whether the magic number matches. */
235 mips_ecoff_bad_format_hook (abfd, filehdr)
239 struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
241 switch (internal_f->f_magic)
244 /* I don't know what endianness this implies. */
248 case MIPS_MAGIC_BIG2:
249 case MIPS_MAGIC_BIG3:
250 return abfd->xvec->byteorder_big_p;
252 case MIPS_MAGIC_LITTLE:
253 case MIPS_MAGIC_LITTLE2:
254 case MIPS_MAGIC_LITTLE3:
255 return abfd->xvec->byteorder_big_p == false;
262 /* Reloc handling. MIPS ECOFF relocs are packed into 8 bytes in
263 external form. They use a bit which indicates whether the symbol
266 /* Swap a reloc in. */
269 mips_ecoff_swap_reloc_in (abfd, ext_ptr, intern)
272 struct internal_reloc *intern;
274 const RELOC *ext = (RELOC *) ext_ptr;
276 intern->r_vaddr = bfd_h_get_32 (abfd, (bfd_byte *) ext->r_vaddr);
277 if (abfd->xvec->header_byteorder_big_p != false)
279 intern->r_symndx = (((int) ext->r_bits[0]
280 << RELOC_BITS0_SYMNDX_SH_LEFT_BIG)
281 | ((int) ext->r_bits[1]
282 << RELOC_BITS1_SYMNDX_SH_LEFT_BIG)
283 | ((int) ext->r_bits[2]
284 << RELOC_BITS2_SYMNDX_SH_LEFT_BIG));
285 intern->r_type = ((ext->r_bits[3] & RELOC_BITS3_TYPE_BIG)
286 >> RELOC_BITS3_TYPE_SH_BIG);
287 intern->r_extern = (ext->r_bits[3] & RELOC_BITS3_EXTERN_BIG) != 0;
291 intern->r_symndx = (((int) ext->r_bits[0]
292 << RELOC_BITS0_SYMNDX_SH_LEFT_LITTLE)
293 | ((int) ext->r_bits[1]
294 << RELOC_BITS1_SYMNDX_SH_LEFT_LITTLE)
295 | ((int) ext->r_bits[2]
296 << RELOC_BITS2_SYMNDX_SH_LEFT_LITTLE));
297 intern->r_type = ((ext->r_bits[3] & RELOC_BITS3_TYPE_LITTLE)
298 >> RELOC_BITS3_TYPE_SH_LITTLE);
299 intern->r_extern = (ext->r_bits[3] & RELOC_BITS3_EXTERN_LITTLE) != 0;
303 /* Swap a reloc out. */
306 mips_ecoff_swap_reloc_out (abfd, intern, dst)
308 const struct internal_reloc *intern;
311 RELOC *ext = (RELOC *) dst;
313 BFD_ASSERT (intern->r_extern
314 || (intern->r_symndx >= 0 && intern->r_symndx <= 12));
316 bfd_h_put_32 (abfd, intern->r_vaddr, (bfd_byte *) ext->r_vaddr);
317 if (abfd->xvec->header_byteorder_big_p != false)
319 ext->r_bits[0] = intern->r_symndx >> RELOC_BITS0_SYMNDX_SH_LEFT_BIG;
320 ext->r_bits[1] = intern->r_symndx >> RELOC_BITS1_SYMNDX_SH_LEFT_BIG;
321 ext->r_bits[2] = intern->r_symndx >> RELOC_BITS2_SYMNDX_SH_LEFT_BIG;
322 ext->r_bits[3] = (((intern->r_type << RELOC_BITS3_TYPE_SH_BIG)
323 & RELOC_BITS3_TYPE_BIG)
324 | (intern->r_extern ? RELOC_BITS3_EXTERN_BIG : 0));
328 ext->r_bits[0] = intern->r_symndx >> RELOC_BITS0_SYMNDX_SH_LEFT_LITTLE;
329 ext->r_bits[1] = intern->r_symndx >> RELOC_BITS1_SYMNDX_SH_LEFT_LITTLE;
330 ext->r_bits[2] = intern->r_symndx >> RELOC_BITS2_SYMNDX_SH_LEFT_LITTLE;
331 ext->r_bits[3] = (((intern->r_type << RELOC_BITS3_TYPE_SH_LITTLE)
332 & RELOC_BITS3_TYPE_LITTLE)
333 | (intern->r_extern ? RELOC_BITS3_EXTERN_LITTLE : 0));
337 /* Finish canonicalizing a reloc. Part of this is generic to all
338 ECOFF targets, and that part is in ecoff.c. The rest is done in
339 this backend routine. It must fill in the howto field. */
342 mips_adjust_reloc_in (abfd, intern, rptr)
344 const struct internal_reloc *intern;
347 if (intern->r_type > MIPS_R_LITERAL)
350 if (! intern->r_extern
351 && (intern->r_type == MIPS_R_GPREL
352 || intern->r_type == MIPS_R_LITERAL))
353 rptr->addend += ecoff_data (abfd)->gp;
355 /* If the type is MIPS_R_IGNORE, make sure this is a reference to
356 the absolute section so that the reloc is ignored. */
357 if (intern->r_type == MIPS_R_IGNORE)
358 rptr->sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr;
360 rptr->howto = &mips_howto_table[intern->r_type];
363 /* Make any adjustments needed to a reloc before writing it out. None
364 are needed for MIPS. */
367 mips_adjust_reloc_in (abfd, rel, intern)
370 struct internal_reloc *intern;
374 /* ECOFF relocs are either against external symbols, or against
375 sections. If we are producing relocateable output, and the reloc
376 is against an external symbol, and nothing has given us any
377 additional addend, the resulting reloc will also be against the
378 same symbol. In such a case, we don't want to change anything
379 about the way the reloc is handled, since it will all be done at
380 final link time. Rather than put special case code into
381 bfd_perform_relocation, all the reloc types use this howto
382 function. It just short circuits the reloc if producing
383 relocateable output against an external symbol. */
385 static bfd_reloc_status_type
386 mips_generic_reloc (abfd,
393 arelent *reloc_entry;
396 asection *input_section;
399 if (output_bfd != (bfd *) NULL
400 && (symbol->flags & BSF_SECTION_SYM) == 0
401 && reloc_entry->addend == 0)
403 reloc_entry->address += input_section->output_offset;
407 return bfd_reloc_continue;
410 /* Do a REFHI relocation. This has to be done in combination with a
411 REFLO reloc, because there is a carry from the REFLO to the REFHI.
412 Here we just save the information we need; we do the actual
413 relocation when we see the REFLO. MIPS ECOFF requires that the
414 REFLO immediately follow the REFHI, so this ought to work. */
416 static bfd_byte *mips_refhi_addr;
417 static bfd_vma mips_refhi_addend;
419 static bfd_reloc_status_type
420 mips_refhi_reloc (abfd,
427 arelent *reloc_entry;
430 asection *input_section;
433 bfd_reloc_status_type ret;
436 /* If we're relocating, and this an external symbol, we don't want
437 to change anything. */
438 if (output_bfd != (bfd *) NULL
439 && (symbol->flags & BSF_SECTION_SYM) == 0
440 && reloc_entry->addend == 0)
442 reloc_entry->address += input_section->output_offset;
447 if (symbol->section == &bfd_und_section
448 && output_bfd == (bfd *) NULL)
449 ret = bfd_reloc_undefined;
451 if (bfd_is_com_section (symbol->section))
454 relocation = symbol->value;
456 relocation += symbol->section->output_section->vma;
457 relocation += symbol->section->output_offset;
458 relocation += reloc_entry->addend;
460 if (reloc_entry->address > input_section->_cooked_size)
461 return bfd_reloc_outofrange;
463 /* Save the information, and let REFLO do the actual relocation. */
464 mips_refhi_addr = (bfd_byte *) data + reloc_entry->address;
465 mips_refhi_addend = relocation;
467 if (output_bfd != (bfd *) NULL)
468 reloc_entry->address += input_section->output_offset;
473 /* Do a REFLO relocation. This is a straightforward 16 bit inplace
474 relocation; this function exists in order to do the REFHI
475 relocation described above. */
477 static bfd_reloc_status_type
478 mips_reflo_reloc (abfd,
485 arelent *reloc_entry;
488 asection *input_section;
491 if (mips_refhi_addr != (bfd_byte *) NULL)
497 /* Do the REFHI relocation. Note that we actually don't need to
498 know anything about the REFLO itself, except where to find
499 the low 16 bits of the addend needed by the REFHI. */
500 insn = bfd_get_32 (abfd, mips_refhi_addr);
501 vallo = (bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address)
503 val = ((insn & 0xffff) << 16) + vallo;
504 val += mips_refhi_addend;
506 /* The low order 16 bits are always treated as a signed value.
507 Therefore, a negative value in the low order bits requires an
508 adjustment in the high order bits. We need to make this
509 adjustment in two ways: once for the bits we took from the
510 data, and once for the bits we are putting back in to the
512 if ((vallo & 0x8000) != 0)
514 if ((val & 0x8000) != 0)
517 insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff);
518 bfd_put_32 (abfd, insn, mips_refhi_addr);
520 mips_refhi_addr = (bfd_byte *) NULL;
523 /* Now do the REFLO reloc in the usual way. */
524 return mips_generic_reloc (abfd, reloc_entry, symbol, data,
525 input_section, output_bfd);
528 /* Do a GPREL relocation. This is a 16 bit value which must become
529 the offset from the gp register. */
531 static bfd_reloc_status_type
532 mips_gprel_reloc (abfd,
539 arelent *reloc_entry;
542 asection *input_section;
545 boolean relocateable;
550 /* If we're relocating, and this is an external symbol with no
551 addend, we don't want to change anything. We will only have an
552 addend if this is a newly created reloc, not read from an ECOFF
554 if (output_bfd != (bfd *) NULL
555 && (symbol->flags & BSF_SECTION_SYM) == 0
556 && reloc_entry->addend == 0)
558 reloc_entry->address += input_section->output_offset;
562 if (output_bfd != (bfd *) NULL)
566 relocateable = false;
567 output_bfd = symbol->section->output_section->owner;
570 if (symbol->section == &bfd_und_section
571 && relocateable == false)
572 return bfd_reloc_undefined;
574 /* We have to figure out the gp value, so that we can adjust the
575 symbol value correctly. We look up the symbol _gp in the output
576 BFD. If we can't find it, we're stuck. We cache it in the ECOFF
577 target data. We don't need to adjust the symbol value for an
578 external symbol if we are producing relocateable output. */
579 if (ecoff_data (output_bfd)->gp == 0
580 && (relocateable == false
581 || (symbol->flags & BSF_SECTION_SYM) != 0))
583 if (relocateable != false)
585 /* Make up a value. */
586 ecoff_data (output_bfd)->gp =
587 symbol->section->output_section->vma + 0x4000;
595 count = bfd_get_symcount (output_bfd);
596 sym = bfd_get_outsymbols (output_bfd);
598 if (sym == (asymbol **) NULL)
602 for (i = 0; i < count; i++, sym++)
604 register CONST char *name;
606 name = bfd_asymbol_name (*sym);
607 if (*name == '_' && strcmp (name, "_gp") == 0)
609 ecoff_data (output_bfd)->gp = bfd_asymbol_value (*sym);
617 /* Only get the error once. */
618 ecoff_data (output_bfd)->gp = 4;
619 /* FIXME: How can we get the program name here? */
621 "GP relative relocation when _gp not defined\n");
622 return bfd_reloc_dangerous;
627 if (bfd_is_com_section (symbol->section))
630 relocation = symbol->value;
632 relocation += symbol->section->output_section->vma;
633 relocation += symbol->section->output_offset;
635 if (reloc_entry->address > input_section->_cooked_size)
636 return bfd_reloc_outofrange;
638 insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
640 /* Set val to the offset into the section or symbol. */
641 val = ((insn & 0xffff) + reloc_entry->addend) & 0xffff;
645 /* Adjust val for the final section location and GP value. If we
646 are producing relocateable output, we don't want to do this for
647 an external symbol. */
648 if (relocateable == false
649 || (symbol->flags & BSF_SECTION_SYM) != 0)
650 val += relocation - ecoff_data (output_bfd)->gp;
652 insn = (insn &~ 0xffff) | (val & 0xffff);
653 bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
655 if (relocateable != false)
656 reloc_entry->address += input_section->output_offset;
658 /* Make sure it fit in 16 bits. */
659 if (val >= 0x8000 && val < 0xffff8000)
660 return bfd_reloc_outofrange;
665 /* Get the howto structure for a generic reloc type. */
667 static CONST struct reloc_howto_struct *
668 mips_bfd_reloc_type_lookup (abfd, code)
670 bfd_reloc_code_real_type code;
677 mips_type = MIPS_R_REFHALF;
680 mips_type = MIPS_R_REFWORD;
682 case BFD_RELOC_MIPS_JMP:
683 mips_type = MIPS_R_JMPADDR;
685 case BFD_RELOC_HI16_S:
686 mips_type = MIPS_R_REFHI;
689 mips_type = MIPS_R_REFLO;
691 case BFD_RELOC_MIPS_GPREL:
692 mips_type = MIPS_R_GPREL;
695 return (CONST struct reloc_howto_struct *) NULL;
698 return &mips_howto_table[mips_type];
703 #include <core.out.h>
705 struct sgi_core_struct
708 char cmd[CORE_NAMESIZE];
711 #define core_hdr(bfd) ((bfd)->tdata.sgi_core_data)
712 #define core_signal(bfd) (core_hdr(bfd)->sig)
713 #define core_command(bfd) (core_hdr(bfd)->cmd)
716 make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos)
720 bfd_size_type _raw_size;
726 asect = bfd_make_section (abfd, name);
730 asect->flags = flags;
731 asect->_raw_size = _raw_size;
733 asect->filepos = filepos;
734 asect->alignment_power = 4;
740 ecoff_core_file_p (abfd)
746 struct coreout coreout;
747 struct idesc *idg, *idf, *ids;
749 val = bfd_read ((PTR)&coreout, 1, sizeof coreout, abfd);
750 if (val != sizeof coreout)
753 if (coreout.c_magic != CORE_MAGIC
754 || coreout.c_version != CORE_VERSION1)
757 core_hdr (abfd) = (struct sgi_core_struct *) bfd_zalloc (abfd, sizeof (struct sgi_core_struct));
758 if (!core_hdr (abfd))
761 strncpy (core_command (abfd), coreout.c_name, CORE_NAMESIZE);
762 core_signal (abfd) = coreout.c_sigcause;
764 bfd_seek (abfd, coreout.c_vmapoffset, SEEK_SET);
766 for (i = 0; i < coreout.c_nvmap; i++)
770 val = bfd_read ((PTR)&vmap, 1, sizeof vmap, abfd);
771 if (val != sizeof vmap)
786 if (!make_bfd_asection (abfd, secname,
787 SEC_ALLOC+SEC_LOAD+SEC_HAS_CONTENTS,
795 /* Make sure that the regs are contiguous within the core file. */
797 idg = &coreout.c_idesc[I_GPREGS];
798 idf = &coreout.c_idesc[I_FPREGS];
799 ids = &coreout.c_idesc[I_SPECREGS];
801 if (idg->i_offset + idg->i_len != idf->i_offset
802 || idf->i_offset + idf->i_len != ids->i_offset)
803 return 0; /* Can't deal with non-contig regs */
805 bfd_seek (abfd, idg->i_offset, SEEK_SET);
807 make_bfd_asection (abfd, ".reg",
808 SEC_ALLOC+SEC_HAS_CONTENTS,
809 idg->i_len + idf->i_len + ids->i_len,
813 /* OK, we believe you. You're a core file (sure, sure). */
819 ecoff_core_file_failing_command (abfd)
822 return core_command (abfd);
826 ecoff_core_file_failing_signal (abfd)
829 return core_signal (abfd);
833 ecoff_core_file_matches_executable_p (core_bfd, exec_bfd)
834 bfd *core_bfd, *exec_bfd;
836 return true; /* XXX - FIXME */
838 #else /* not def HOST_IRIX4 */
839 #define ecoff_core_file_p _bfd_dummy_target
840 #define ecoff_core_file_failing_command _bfd_dummy_core_file_failing_command
841 #define ecoff_core_file_failing_signal _bfd_dummy_core_file_failing_signal
842 #define ecoff_core_file_matches_executable_p \
843 _bfd_dummy_core_file_matches_executable_p
846 /* This is the ECOFF backend structure. The backend field of the
847 target vector points to this. */
849 static const struct ecoff_backend_data mips_ecoff_backend_data =
851 /* COFF backend structure. */
853 (void (*) PARAMS ((bfd *,PTR,int,int,PTR))) bfd_void, /* aux_in */
854 (void (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* sym_in */
855 (void (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* lineno_in */
856 (unsigned (*) PARAMS ((bfd *,PTR,int,int,PTR))) bfd_void, /* aux_out */
857 (unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* sym_out */
858 (unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* lineno_out */
859 (unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* reloc_out */
860 mips_ecoff_swap_filehdr_out, mips_ecoff_swap_aouthdr_out,
861 mips_ecoff_swap_scnhdr_out,
862 FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, true,
863 mips_ecoff_swap_filehdr_in, mips_ecoff_swap_aouthdr_in,
864 mips_ecoff_swap_scnhdr_in, mips_ecoff_bad_format_hook,
865 ecoff_set_arch_mach_hook, ecoff_mkobject_hook,
866 ecoff_styp_to_sec_flags, ecoff_make_section_hook, ecoff_set_alignment_hook,
867 ecoff_slurp_symbol_table, NULL, NULL
869 /* Supported architecture. */
871 /* Symbol table magic number. */
873 /* Initial portion of armap string. */
875 /* Alignment of debugging information. E.g., 4. */
877 /* The page boundary used to align sections in a demand-paged
878 executable file. E.g., 0x1000. */
880 /* True if the .rdata section is part of the text segment, as on the
881 Alpha. False if .rdata is part of the data segment, as on the
884 /* Bitsize of constructor entries. */
886 /* Reloc to use for constructor entries. */
887 &mips_howto_table[MIPS_R_REFWORD],
888 /* Sizes of external symbolic information. */
889 sizeof (struct hdr_ext),
890 sizeof (struct dnr_ext),
891 sizeof (struct pdr_ext),
892 sizeof (struct sym_ext),
893 sizeof (struct opt_ext),
894 sizeof (struct fdr_ext),
895 sizeof (struct rfd_ext),
896 sizeof (struct ext_ext),
897 /* Functions to swap in external symbolic data. */
906 /* Functions to swap out external symbolic data. */
915 /* External reloc size. */
917 /* Reloc swapping functions. */
918 mips_ecoff_swap_reloc_in,
919 mips_ecoff_swap_reloc_out,
920 /* Backend reloc tweaking. */
921 mips_adjust_reloc_in,
922 mips_adjust_reloc_out
925 /* Looking up a reloc type is MIPS specific. */
926 #define ecoff_bfd_reloc_type_lookup mips_bfd_reloc_type_lookup
928 /* Getting relocated section contents is generic. */
929 #define ecoff_bfd_get_relocated_section_contents \
930 bfd_generic_get_relocated_section_contents
932 bfd_target ecoff_little_vec =
934 "ecoff-littlemips", /* name */
935 bfd_target_ecoff_flavour,
936 false, /* data byte order is little */
937 false, /* header byte order is little */
939 (HAS_RELOC | EXEC_P | /* object flags */
940 HAS_LINENO | HAS_DEBUG |
941 HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
943 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* sect
945 0, /* leading underscore */
946 ' ', /* ar_pad_char */
947 15, /* ar_max_namelen */
948 4, /* minimum alignment power */
949 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
950 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
951 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
952 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
953 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
954 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
956 {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
957 ecoff_archive_p, _bfd_dummy_target},
958 {bfd_false, ecoff_mkobject, /* bfd_set_format */
959 _bfd_generic_mkarchive, bfd_false},
960 {bfd_false, ecoff_write_object_contents, /* bfd_write_contents */
961 _bfd_write_archive_contents, bfd_false},
963 (PTR) &mips_ecoff_backend_data
966 bfd_target ecoff_big_vec =
968 "ecoff-bigmips", /* name */
969 bfd_target_ecoff_flavour,
970 true, /* data byte order is big */
971 true, /* header byte order is big */
973 (HAS_RELOC | EXEC_P | /* object flags */
974 HAS_LINENO | HAS_DEBUG |
975 HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
977 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* sect flags */
978 0, /* leading underscore */
979 ' ', /* ar_pad_char */
980 15, /* ar_max_namelen */
981 4, /* minimum alignment power */
982 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
983 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
984 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
985 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
986 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
987 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
988 {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
989 ecoff_archive_p, ecoff_core_file_p},
990 {bfd_false, ecoff_mkobject, /* bfd_set_format */
991 _bfd_generic_mkarchive, bfd_false},
992 {bfd_false, ecoff_write_object_contents, /* bfd_write_contents */
993 _bfd_write_archive_contents, bfd_false},
995 (PTR) &mips_ecoff_backend_data
996 /* Note that there is another bfd_target just above this one. If
997 you are adding initializers here, you should be adding them there